diff --git a/addrs/provider.go b/addrs/provider.go new file mode 100644 index 000000000..04fb731bd --- /dev/null +++ b/addrs/provider.go @@ -0,0 +1,47 @@ +package addrs + +import svchost "github.com/hashicorp/terraform-svchost" + +// Provider encapsulates a single provider type. In the future this will be +// extended to include additional fields including Namespace and SourceHost +type Provider struct { + Type string + Namespace string + Hostname svchost.Hostname +} + +// String returns an FQN string, indended for use in output. +func (pt Provider) String() string { + return pt.Hostname.ForDisplay() + "/" + pt.Namespace + "/" + pt.Type +} + +// NewDefaultProvider returns the default address of a HashiCorp-maintained, +// Registry-hosted provider. +func NewDefaultProvider(name string) Provider { + return Provider{ + Type: name, + Namespace: "hashicorp", + Hostname: "registry.terraform.io", + } +} + +// NewLegacyProvider returns a mock address for a provider. +// This will be removed when ProviderType is fully integrated. +func NewLegacyProvider(name string) Provider { + return Provider{ + Type: name, + Namespace: "-", + Hostname: "registry.terraform.io", + } +} + +// LegacyString returns the provider type, which is frequently used +// interchangeably with provider name. This function can and should be removed +// when provider type is fully integrated. As a safeguard for future +// refactoring, this function panics if the Provider is not a legacy provider. +func (pt Provider) LegacyString() string { + if pt.Namespace != "-" { + panic("not a legacy Provider") + } + return pt.Type +} diff --git a/addrs/provider_type.go b/addrs/provider_type.go deleted file mode 100644 index dc341f9b6..000000000 --- a/addrs/provider_type.go +++ /dev/null @@ -1,7 +0,0 @@ -package addrs - -// ProviderType encapsulates a single provider type. In the future this will be -// extended to include additional fields including Namespace and SourceHost -type ProviderType struct { - Type string -} diff --git a/backend/local/testing.go b/backend/local/testing.go index dccddb5da..fb73cce87 100644 --- a/backend/local/testing.go +++ b/backend/local/testing.go @@ -113,8 +113,8 @@ func TestLocalProvider(t *testing.T, b *Local, name string, schema *terraform.Pr // Setup our provider b.ContextOpts.ProviderResolver = providers.ResolverFixed( - map[string]providers.Factory{ - name: providers.FactoryFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider(name): providers.FactoryFixed(p), }, ) diff --git a/builtin/providers/test/resource_import_other_test.go b/builtin/providers/test/resource_import_other_test.go index 1965d9e66..9ace0525e 100644 --- a/builtin/providers/test/resource_import_other_test.go +++ b/builtin/providers/test/resource_import_other_test.go @@ -23,7 +23,6 @@ resource "test_resource_import_other" "foo" { { ImportState: true, ResourceName: "test_resource_import_other.foo", - ImportStateCheck: func(iss []*terraform.InstanceState) error { if got, want := len(iss), 2; got != want { return fmt.Errorf("wrong number of resources %d; want %d", got, want) diff --git a/command/apply_test.go b/command/apply_test.go index bfc396438..c15718104 100644 --- a/command/apply_test.go +++ b/command/apply_test.go @@ -177,7 +177,7 @@ func TestApply_parallelism(t *testing.T) { // to ApplyResourceChange, we need to use a number of separate providers // here. They will all have the same mock implementation function assigned // but crucially they will each have their own mutex. - providerFactories := map[string]providers.Factory{} + providerFactories := map[addrs.Provider]providers.Factory{} for i := 0; i < 10; i++ { name := fmt.Sprintf("test%d", i) provider := &terraform.MockProvider{} @@ -203,7 +203,7 @@ func TestApply_parallelism(t *testing.T) { NewState: cty.EmptyObjectVal, } } - providerFactories[name] = providers.FactoryFixed(provider) + providerFactories[addrs.NewLegacyProvider(name)] = providers.FactoryFixed(provider) } testingOverrides := &testingOverrides{ ProviderResolver: providers.ResolverFixed(providerFactories), diff --git a/command/command_test.go b/command/command_test.go index f87ad7554..b6c16ea52 100644 --- a/command/command_test.go +++ b/command/command_test.go @@ -114,8 +114,8 @@ func testFixturePath(name string) string { func metaOverridesForProvider(p providers.Interface) *testingOverrides { return &testingOverrides{ ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": providers.FactoryFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): providers.FactoryFixed(p), }, ), } @@ -124,8 +124,8 @@ func metaOverridesForProvider(p providers.Interface) *testingOverrides { func metaOverridesForProviderAndProvisioner(p providers.Interface, pr provisioners.Interface) *testingOverrides { return &testingOverrides{ ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": providers.FactoryFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): providers.FactoryFixed(p), }, ), Provisioners: map[string]provisioners.Factory{ diff --git a/command/import_test.go b/command/import_test.go index 504c1d3e9..2fefb8e31 100644 --- a/command/import_test.go +++ b/command/import_test.go @@ -12,6 +12,7 @@ import ( "github.com/mitchellh/cli" "github.com/zclconf/go-cty/cty" + "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/helper/copy" "github.com/hashicorp/terraform/plugin/discovery" @@ -549,8 +550,8 @@ func TestImport_providerNameMismatch(t *testing.T) { Meta: Meta{ testingOverrides: &testingOverrides{ ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test-beta": providers.FactoryFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test-beta"): providers.FactoryFixed(p), }, ), }, diff --git a/command/init.go b/command/init.go index daeb051ac..0d3b9bd6c 100644 --- a/command/init.go +++ b/command/init.go @@ -517,7 +517,7 @@ func (c *InitCommand) getProviders(earlyConfig *earlyconfig.Config, state *state } for provider, reqd := range missing { - pty := addrs.ProviderType{Type: provider} + pty := addrs.Provider{Type: provider} _, providerDiags, err := c.providerInstaller.Get(pty, reqd.Versions) diags = diags.Append(providerDiags) diff --git a/command/internal_plugin_test.go b/command/internal_plugin_test.go index f96b5feae..83a3f844e 100644 --- a/command/internal_plugin_test.go +++ b/command/internal_plugin_test.go @@ -1,13 +1,17 @@ package command -import "testing" +import ( + "testing" + + "github.com/hashicorp/terraform/addrs" +) func TestInternalPlugin_InternalProviders(t *testing.T) { m := new(Meta) providers := m.internalProviders() // terraform is the only provider moved back to internal for _, name := range []string{"terraform"} { - pf, ok := providers[name] + pf, ok := providers[addrs.NewLegacyProvider(name)] if !ok { t.Errorf("Expected to find %s in InternalProviders", name) } diff --git a/command/plugins.go b/command/plugins.go index bc0a02933..2264324e5 100644 --- a/command/plugins.go +++ b/command/plugins.go @@ -15,6 +15,7 @@ import ( plugin "github.com/hashicorp/go-plugin" "github.com/kardianos/osext" + "github.com/hashicorp/terraform/addrs" terraformProvider "github.com/hashicorp/terraform/builtin/providers/terraform" tfplugin "github.com/hashicorp/terraform/plugin" "github.com/hashicorp/terraform/plugin/discovery" @@ -35,16 +36,16 @@ type multiVersionProviderResolver struct { // (will produce an error if one is set). This should be used only in // exceptional circumstances since it forces the provider's release // schedule to be tied to that of Terraform Core. - Internal map[string]providers.Factory + Internal map[addrs.Provider]providers.Factory } -func choosePlugins(avail discovery.PluginMetaSet, internal map[string]providers.Factory, reqd discovery.PluginRequirements) map[string]discovery.PluginMeta { +func choosePlugins(avail discovery.PluginMetaSet, internal map[addrs.Provider]providers.Factory, reqd discovery.PluginRequirements) map[string]discovery.PluginMeta { candidates := avail.ConstrainVersions(reqd) ret := map[string]discovery.PluginMeta{} for name, metas := range candidates { // If the provider is in our internal map then we ignore any // discovered plugins for it since these are dealt with separately. - if _, isInternal := internal[name]; isInternal { + if _, isInternal := internal[addrs.NewLegacyProvider(name)]; isInternal { continue } @@ -58,18 +59,18 @@ func choosePlugins(avail discovery.PluginMetaSet, internal map[string]providers. func (r *multiVersionProviderResolver) ResolveProviders( reqd discovery.PluginRequirements, -) (map[string]providers.Factory, []error) { - factories := make(map[string]providers.Factory, len(reqd)) +) (map[addrs.Provider]providers.Factory, []error) { + factories := make(map[addrs.Provider]providers.Factory, len(reqd)) var errs []error chosen := choosePlugins(r.Available, r.Internal, reqd) for name, req := range reqd { - if factory, isInternal := r.Internal[name]; isInternal { + if factory, isInternal := r.Internal[addrs.NewLegacyProvider(name)]; isInternal { if !req.Versions.Unconstrained() { errs = append(errs, fmt.Errorf("provider.%s: this provider is built in to Terraform and so it does not support version constraints", name)) continue } - factories[name] = factory + factories[addrs.NewLegacyProvider(name)] = factory continue } @@ -84,7 +85,7 @@ func (r *multiVersionProviderResolver) ResolveProviders( continue } - factories[name] = providerFactory(newest) + factories[addrs.NewLegacyProvider(name)] = providerFactory(newest) } else { msg := fmt.Sprintf("provider.%s: no suitable version installed", name) @@ -280,9 +281,9 @@ func (m *Meta) providerResolver() providers.Resolver { } } -func (m *Meta) internalProviders() map[string]providers.Factory { - return map[string]providers.Factory{ - "terraform": func() (providers.Interface, error) { +func (m *Meta) internalProviders() map[addrs.Provider]providers.Factory { + return map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("terraform"): func() (providers.Interface, error) { return terraformProvider.NewProvider(), nil }, } @@ -297,7 +298,7 @@ func (m *Meta) missingPlugins(avail discovery.PluginMetaSet, reqd discovery.Plug for name, versionSet := range reqd { // internal providers can't be missing - if _, ok := internal[name]; ok { + if _, ok := internal[addrs.NewLegacyProvider(name)]; ok { continue } diff --git a/command/plugins_test.go b/command/plugins_test.go index 8ac26986e..5b3c40cf2 100644 --- a/command/plugins_test.go +++ b/command/plugins_test.go @@ -24,8 +24,8 @@ func TestMultiVersionProviderResolver(t *testing.T) { }) resolver := &multiVersionProviderResolver{ - Internal: map[string]providers.Factory{ - "internal": providers.FactoryFixed( + Internal: map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("internal"): providers.FactoryFixed( &terraform.MockProvider{ GetSchemaReturn: &terraform.ProviderSchema{ ResourceTypes: map[string]*configschema.Block{ @@ -51,7 +51,7 @@ func TestMultiVersionProviderResolver(t *testing.T) { if ct := len(got); ct != 1 { t.Errorf("wrong number of results %d; want 1", ct) } - if _, exists := got["plugin"]; !exists { + if _, exists := got[addrs.NewLegacyProvider("plugin")]; !exists { t.Errorf("provider \"plugin\" not in result") } }) @@ -79,7 +79,7 @@ func TestMultiVersionProviderResolver(t *testing.T) { if ct := len(got); ct != 1 { t.Errorf("wrong number of results %d; want 1", ct) } - if _, exists := got["internal"]; !exists { + if _, exists := got[addrs.NewLegacyProvider("internal")]; !exists { t.Errorf("provider \"internal\" not in result") } }) @@ -121,7 +121,7 @@ func TestPluginPath(t *testing.T) { func TestInternalProviders(t *testing.T) { m := Meta{} internal := m.internalProviders() - tfProvider, err := internal["terraform"]() + tfProvider, err := internal[addrs.NewLegacyProvider("terraform")]() if err != nil { t.Fatal(err) } @@ -148,7 +148,7 @@ func (i *mockProviderInstaller) FileName(provider, version string) string { return fmt.Sprintf("terraform-provider-%s_v%s_x4", provider, version) } -func (i *mockProviderInstaller) Get(provider addrs.ProviderType, req discovery.Constraints) (discovery.PluginMeta, tfdiags.Diagnostics, error) { +func (i *mockProviderInstaller) Get(provider addrs.Provider, req discovery.Constraints) (discovery.PluginMeta, tfdiags.Diagnostics, error) { var diags tfdiags.Diagnostics noMeta := discovery.PluginMeta{} versions := i.Providers[provider.Type] @@ -200,7 +200,7 @@ func (i *mockProviderInstaller) PurgeUnused(map[string]discovery.PluginMeta) (di type callbackPluginInstaller func(provider string, req discovery.Constraints) (discovery.PluginMeta, tfdiags.Diagnostics, error) -func (cb callbackPluginInstaller) Get(provider addrs.ProviderType, req discovery.Constraints) (discovery.PluginMeta, tfdiags.Diagnostics, error) { +func (cb callbackPluginInstaller) Get(provider addrs.Provider, req discovery.Constraints) (discovery.PluginMeta, tfdiags.Diagnostics, error) { return cb(provider.Type, req) } diff --git a/configs/configupgrade/analysis.go b/configs/configupgrade/analysis.go index 93209fcde..49b63d845 100644 --- a/configs/configupgrade/analysis.go +++ b/configs/configupgrade/analysis.go @@ -241,11 +241,11 @@ func (u *Upgrader) analyze(ms ModuleSources) (*analysis, error) { return nil, fmt.Errorf("error resolving providers:\n%s", errorsMsg) } - for name, fn := range providerFactories { - log.Printf("[TRACE] Fetching schema from provider %q", name) + for fqn, fn := range providerFactories { + log.Printf("[TRACE] Fetching schema from provider %q", fqn.LegacyString()) provider, err := fn() if err != nil { - return nil, fmt.Errorf("failed to load provider %q: %s", name, err) + return nil, fmt.Errorf("failed to load provider %q: %s", fqn.LegacyString(), err) } resp := provider.GetSchema() @@ -264,7 +264,7 @@ func (u *Upgrader) analyze(ms ModuleSources) (*analysis, error) { for t, s := range resp.DataSources { schema.DataSources[t] = s.Block } - ret.ProviderSchemas[name] = schema + ret.ProviderSchemas[fqn.LegacyString()] = schema } for name, fn := range u.Provisioners { diff --git a/configs/configupgrade/upgrade_test.go b/configs/configupgrade/upgrade_test.go index f4940ebee..db15d850f 100644 --- a/configs/configupgrade/upgrade_test.go +++ b/configs/configupgrade/upgrade_test.go @@ -14,6 +14,7 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/zclconf/go-cty/cty" + "github.com/hashicorp/terraform/addrs" backendinit "github.com/hashicorp/terraform/backend/init" "github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/helper/logging" @@ -186,8 +187,8 @@ func diffSourceFilesFallback(got, want []byte) []byte { return buf.Bytes() } -var testProviders = map[string]providers.Factory{ - "test": providers.Factory(func() (providers.Interface, error) { +var testProviders = map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): providers.Factory(func() (providers.Interface, error) { p := &terraform.MockProvider{} p.GetSchemaReturn = &terraform.ProviderSchema{ ResourceTypes: map[string]*configschema.Block{ @@ -236,7 +237,7 @@ var testProviders = map[string]providers.Factory{ } return p, nil }), - "terraform": providers.Factory(func() (providers.Interface, error) { + addrs.NewLegacyProvider("terraform"): providers.Factory(func() (providers.Interface, error) { p := &terraform.MockProvider{} p.GetSchemaReturn = &terraform.ProviderSchema{ DataSources: map[string]*configschema.Block{ @@ -252,7 +253,7 @@ var testProviders = map[string]providers.Factory{ } return p, nil }), - "aws": providers.Factory(func() (providers.Interface, error) { + addrs.NewLegacyProvider("aws"): providers.Factory(func() (providers.Interface, error) { // This is here only so we can test the provisioner connection info // migration behavior, which is resource-type specific. Do not use // it in any other tests. diff --git a/helper/resource/testing.go b/helper/resource/testing.go index 576ef31f3..26ea72a8d 100644 --- a/helper/resource/testing.go +++ b/helper/resource/testing.go @@ -677,11 +677,11 @@ func testProviderResolver(c TestCase) (providers.Resolver, error) { // wrap the old provider factories in the test grpc server so they can be // called from terraform. - newProviders := make(map[string]providers.Factory) + newProviders := make(map[addrs.Provider]providers.Factory) for k, pf := range ctxProviders { factory := pf // must copy to ensure each closure sees its own value - newProviders[k] = func() (providers.Interface, error) { + newProviders[addrs.NewLegacyProvider(k)] = func() (providers.Interface, error) { p, err := factory() if err != nil { return nil, err diff --git a/helper/resource/testing_import_state.go b/helper/resource/testing_import_state.go index 3473f8e52..1f3796176 100644 --- a/helper/resource/testing_import_state.go +++ b/helper/resource/testing_import_state.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform/terraform" ) -// testStepImportState runs an imort state test step +// testStepImportState runs an import state test step func testStepImportState( opts terraform.ContextOpts, state *terraform.State, @@ -96,7 +96,6 @@ func testStepImportState( if err != nil { return nil, err } - // Go through the new state and verify if step.ImportStateCheck != nil { var states []*terraform.InstanceState diff --git a/helper/resource/testing_test.go b/helper/resource/testing_test.go index 1c358f663..96e098edf 100644 --- a/helper/resource/testing_test.go +++ b/helper/resource/testing_test.go @@ -14,6 +14,7 @@ import ( "testing" "github.com/hashicorp/go-multierror" + "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/plugin/discovery" "github.com/hashicorp/terraform/terraform" @@ -1080,7 +1081,7 @@ func TestTestProviderResolver(t *testing.T) { for name := range reqd { t.Run(name, func(t *testing.T) { - pf, ok := factories[name] + pf, ok := factories[addrs.NewLegacyProvider(name)] if !ok { t.Fatalf("no factory for %q", name) } diff --git a/plugin/discovery/get.go b/plugin/discovery/get.go index 5c22dac17..9c497ea74 100644 --- a/plugin/discovery/get.go +++ b/plugin/discovery/get.go @@ -50,7 +50,7 @@ func init() { // An Installer maintains a local cache of plugins by downloading plugins // from an online repository. type Installer interface { - Get(provider addrs.ProviderType, req Constraints) (PluginMeta, tfdiags.Diagnostics, error) + Get(provider addrs.Provider, req Constraints) (PluginMeta, tfdiags.Diagnostics, error) PurgeUnused(used map[string]PluginMeta) (removed PluginMetaSet, err error) } @@ -107,7 +107,7 @@ type ProviderInstaller struct { // are produced under the assumption that if presented to the user they will // be presented alongside context about what is being installed, and thus the // error messages do not redundantly include such information. -func (i *ProviderInstaller) Get(provider addrs.ProviderType, req Constraints) (PluginMeta, tfdiags.Diagnostics, error) { +func (i *ProviderInstaller) Get(provider addrs.Provider, req Constraints) (PluginMeta, tfdiags.Diagnostics, error) { var diags tfdiags.Diagnostics // a little bit of initialization. @@ -276,7 +276,7 @@ func (i *ProviderInstaller) Get(provider addrs.ProviderType, req Constraints) (P return metas.Newest(), diags, nil } -func (i *ProviderInstaller) install(provider addrs.ProviderType, version Version, url string) error { +func (i *ProviderInstaller) install(provider addrs.Provider, version Version, url string) error { if i.Cache != nil { log.Printf("[DEBUG] looking for provider %s %s in plugin cache", provider.Type, version) cached := i.Cache.CachedPluginPath("provider", provider.Type, version) @@ -472,7 +472,7 @@ func (i *ProviderInstaller) hostname() (string, error) { } // list all versions available for the named provider -func (i *ProviderInstaller) listProviderVersions(provider addrs.ProviderType) (*response.TerraformProviderVersions, error) { +func (i *ProviderInstaller) listProviderVersions(provider addrs.Provider) (*response.TerraformProviderVersions, error) { req := regsrc.NewTerraformProvider(provider.Type, i.OS, i.Arch) versions, err := i.registry.TerraformProviderVersions(req) return versions, err diff --git a/plugin/discovery/get_test.go b/plugin/discovery/get_test.go index 397fbbc15..119a2a5bd 100644 --- a/plugin/discovery/get_test.go +++ b/plugin/discovery/get_test.go @@ -152,7 +152,7 @@ func TestVersionListing(t *testing.T) { i := newProviderInstaller(server) - allVersions, err := i.listProviderVersions(addrs.ProviderType{Type: "test"}) + allVersions, err := i.listProviderVersions(addrs.Provider{Type: "test"}) if err != nil { t.Fatal(err) @@ -419,7 +419,7 @@ func TestProviderInstallerGet(t *testing.T) { registry: registry.NewClient(Disco(server), nil), } - _, _, err = i.Get(addrs.ProviderType{Type: "test"}, AllVersions) + _, _, err = i.Get(addrs.Provider{Type: "test"}, AllVersions) if err != ErrorNoVersionCompatibleWithPlatform { t.Fatal("want error for incompatible version") @@ -436,21 +436,21 @@ func TestProviderInstallerGet(t *testing.T) { } { - _, _, err := i.Get(addrs.ProviderType{Type: "test"}, ConstraintStr(">9.0.0").MustParse()) + _, _, err := i.Get(addrs.Provider{Type: "test"}, ConstraintStr(">9.0.0").MustParse()) if err != ErrorNoSuitableVersion { t.Fatal("want error for mismatching constraints") } } { - provider := addrs.ProviderType{Type: "nonexist"} + provider := addrs.Provider{Type: "nonexist"} _, _, err := i.Get(provider, AllVersions) if err != ErrorNoSuchProvider { t.Fatal("want error for no such provider") } } - gotMeta, _, err := i.Get(addrs.ProviderType{Type: "test"}, AllVersions) + gotMeta, _, err := i.Get(addrs.Provider{Type: "test"}, AllVersions) if err != nil { t.Fatal(err) } @@ -508,7 +508,7 @@ func TestProviderInstallerGet_cache(t *testing.T) { Arch: "mockarch", } - gotMeta, _, err := i.Get(addrs.ProviderType{Type: "test"}, AllVersions) + gotMeta, _, err := i.Get(addrs.Provider{Type: "test"}, AllVersions) if err != nil { t.Fatal(err) } diff --git a/providers/resolver.go b/providers/resolver.go index 4de8e0acd..2ef387e46 100644 --- a/providers/resolver.go +++ b/providers/resolver.go @@ -3,6 +3,7 @@ package providers import ( "fmt" + "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/plugin/discovery" ) @@ -13,17 +14,17 @@ type Resolver interface { // Given a constraint map, return a Factory for each requested provider. // If some or all of the constraints cannot be satisfied, return a non-nil // slice of errors describing the problems. - ResolveProviders(reqd discovery.PluginRequirements) (map[string]Factory, []error) + ResolveProviders(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) } // ResolverFunc wraps a callback function and turns it into a Resolver // implementation, for convenience in situations where a function and its // associated closure are sufficient as a resolver implementation. -type ResolverFunc func(reqd discovery.PluginRequirements) (map[string]Factory, []error) +type ResolverFunc func(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) // ResolveProviders implements Resolver by calling the // wrapped function. -func (f ResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[string]Factory, []error) { +func (f ResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) { return f(reqd) } @@ -34,13 +35,14 @@ func (f ResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[s // // This function is primarily used in tests, to provide mock providers or // in-process providers under test. -func ResolverFixed(factories map[string]Factory) Resolver { - return ResolverFunc(func(reqd discovery.PluginRequirements) (map[string]Factory, []error) { - ret := make(map[string]Factory, len(reqd)) +func ResolverFixed(factories map[addrs.Provider]Factory) Resolver { + return ResolverFunc(func(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) { + ret := make(map[addrs.Provider]Factory, len(reqd)) var errs []error for name := range reqd { - if factory, exists := factories[name]; exists { - ret[name] = factory + fqn := addrs.NewLegacyProvider(name) + if factory, exists := factories[fqn]; exists { + ret[fqn] = factory } else { errs = append(errs, fmt.Errorf("provider %q is not available", name)) } diff --git a/repl/session_test.go b/repl/session_test.go index d79ba33a8..0d2f37326 100644 --- a/repl/session_test.go +++ b/repl/session_test.go @@ -211,8 +211,8 @@ func testSession(t *testing.T, test testSessionTest) { // Build the TF context ctx, diags := terraform.NewContext(&terraform.ContextOpts{ State: test.State, - ProviderResolver: providers.ResolverFixed(map[string]providers.Factory{ - "test": providers.FactoryFixed(p), + ProviderResolver: providers.ResolverFixed(map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): providers.FactoryFixed(p), }), Config: config, }) diff --git a/terraform/context.go b/terraform/context.go index 911ad088d..5637083ce 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -159,7 +159,7 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) { variables = variables.Override(opts.Variables) // Bind available provider plugins to the constraints in config - var providerFactories map[string]providers.Factory + var providerFactories map[addrs.Provider]providers.Factory if opts.ProviderResolver != nil { deps := ConfigTreeDependencies(opts.Config, state) reqd := deps.AllPluginRequirements() @@ -167,7 +167,6 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) { reqd.LockExecutables(opts.ProviderSHA256s) } log.Printf("[TRACE] terraform.NewContext: resolving provider version selections") - var providerDiags tfdiags.Diagnostics providerFactories, providerDiags = resourceProviderFactories(opts.ProviderResolver, reqd) diags = diags.Append(providerDiags) @@ -176,7 +175,7 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) { return nil, diags } } else { - providerFactories = make(map[string]providers.Factory) + providerFactories = make(map[addrs.Provider]providers.Factory) } components := &basicComponentFactory{ diff --git a/terraform/context_apply_test.go b/terraform/context_apply_test.go index f53393a7e..7fc9f3682 100644 --- a/terraform/context_apply_test.go +++ b/terraform/context_apply_test.go @@ -39,8 +39,8 @@ func TestContext2Apply_basic(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -82,8 +82,8 @@ func TestContext2Apply_unstable(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -138,8 +138,8 @@ func TestContext2Apply_escape(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -170,8 +170,8 @@ func TestContext2Apply_resourceCountOneList(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), }) @@ -203,8 +203,8 @@ func TestContext2Apply_resourceCountZeroList(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), }) @@ -261,8 +261,8 @@ func TestContext2Apply_resourceDependsOnModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -349,8 +349,8 @@ func TestContext2Apply_resourceDependsOnModuleStateOnly(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -382,8 +382,8 @@ func TestContext2Apply_resourceDependsOnModuleDestroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -429,8 +429,8 @@ func TestContext2Apply_resourceDependsOnModuleDestroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: globalState, @@ -488,8 +488,8 @@ func TestContext2Apply_resourceDependsOnModuleGrandchild(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -541,8 +541,8 @@ func TestContext2Apply_resourceDependsOnModuleInModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -572,8 +572,8 @@ func TestContext2Apply_mapVarBetweenModules(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), }) @@ -614,8 +614,8 @@ func TestContext2Apply_refCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -649,8 +649,8 @@ func TestContext2Apply_providerAlias(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -687,8 +687,8 @@ func TestContext2Apply_providerAliasConfigure(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "another": testProviderFuncFixed(p2), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("another"): testProviderFuncFixed(p2), }, ), }) @@ -745,8 +745,8 @@ func TestContext2Apply_providerWarning(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -783,8 +783,8 @@ func TestContext2Apply_emptyModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -832,8 +832,8 @@ func TestContext2Apply_createBeforeDestroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -889,8 +889,8 @@ func TestContext2Apply_createBeforeDestroyUpdate(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -957,8 +957,8 @@ func TestContext2Apply_createBeforeDestroy_dependsNonCBD(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1033,8 +1033,8 @@ func TestContext2Apply_createBeforeDestroy_hook(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1111,8 +1111,8 @@ func TestContext2Apply_createBeforeDestroy_deposedCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1177,8 +1177,8 @@ func TestContext2Apply_createBeforeDestroy_deposedOnly(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1229,8 +1229,8 @@ func TestContext2Apply_destroyComputed(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1303,8 +1303,8 @@ func testContext2Apply_destroyDependsOn(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1430,8 +1430,8 @@ func testContext2Apply_destroyDependsOnStateOnly(t *testing.T, state *states.Sta ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1558,8 +1558,8 @@ func testContext2Apply_destroyDependsOnStateOnlyModule(t *testing.T, state *stat ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1596,8 +1596,8 @@ func TestContext2Apply_dataBasic(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), }) @@ -1646,8 +1646,8 @@ func TestContext2Apply_destroyData(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), State: state, @@ -1717,8 +1717,8 @@ func TestContext2Apply_destroySkipsCBD(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1759,8 +1759,8 @@ func TestContext2Apply_destroyModuleVarProviderConfig(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1805,8 +1805,8 @@ func TestContext2Apply_destroyCrossProviders(t *testing.T) { }, } - providers := map[string]providers.Factory{ - "aws": testProviderFuncFixed(p_aws), + providers := map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p_aws), } // Bug only appears from time to time, @@ -1829,7 +1829,7 @@ func TestContext2Apply_destroyCrossProviders(t *testing.T) { } } -func getContextForApply_destroyCrossProviders(t *testing.T, m *configs.Config, providerFactories map[string]providers.Factory) *Context { +func getContextForApply_destroyCrossProviders(t *testing.T, m *configs.Config, providerFactories map[addrs.Provider]providers.Factory) *Context { state := MustShimLegacyState(&State{ Modules: []*ModuleState{ &ModuleState{ @@ -1882,8 +1882,8 @@ func TestContext2Apply_minimal(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1912,8 +1912,8 @@ func TestContext2Apply_badDiff(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1947,8 +1947,8 @@ func TestContext2Apply_cancel(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2026,8 +2026,8 @@ func TestContext2Apply_cancelBlock(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2156,8 +2156,8 @@ func TestContext2Apply_provisionerDestroyForEach(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -2201,8 +2201,8 @@ func TestContext2Apply_cancelProvisioner(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -2299,8 +2299,8 @@ func TestContext2Apply_compute(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2375,8 +2375,8 @@ func TestContext2Apply_countDecrease(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -2436,8 +2436,8 @@ func TestContext2Apply_countDecreaseToOneX(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -2500,8 +2500,8 @@ func TestContext2Apply_countDecreaseToOneCorrupted(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -2557,8 +2557,8 @@ func TestContext2Apply_countTainted(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -2612,8 +2612,8 @@ func TestContext2Apply_countVariable(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2642,8 +2642,8 @@ func TestContext2Apply_countVariableRef(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2678,8 +2678,8 @@ func TestContext2Apply_provisionerInterpCount(t *testing.T) { pr := testProvisioner() providerResolver := providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ) provisioners := map[string]ProvisionerFactory{ @@ -2732,8 +2732,8 @@ func TestContext2Apply_foreachVariable(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -2767,8 +2767,8 @@ func TestContext2Apply_moduleBasic(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2855,8 +2855,8 @@ func TestContext2Apply_moduleDestroyOrder(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -2907,8 +2907,8 @@ func TestContext2Apply_moduleInheritAlias(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2952,8 +2952,8 @@ func TestContext2Apply_orphanResource(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -2997,8 +2997,8 @@ func TestContext2Apply_orphanResource(t *testing.T) { Config: m, State: state, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -3059,8 +3059,8 @@ func TestContext2Apply_moduleOrphanInheritAlias(t *testing.T) { Config: m, State: state, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -3117,8 +3117,8 @@ func TestContext2Apply_moduleOrphanProvider(t *testing.T) { Config: m, State: state, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -3168,8 +3168,8 @@ func TestContext2Apply_moduleOrphanGrandchildProvider(t *testing.T) { Config: m, State: state, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -3205,8 +3205,8 @@ func TestContext2Apply_moduleGrandchildProvider(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -3242,9 +3242,9 @@ func TestContext2Apply_moduleOnlyProvider(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), - "test": testProviderFuncFixed(pTest), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), + addrs.NewLegacyProvider("test"): testProviderFuncFixed(pTest), }, ), }) @@ -3273,8 +3273,8 @@ func TestContext2Apply_moduleProviderAlias(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -3303,8 +3303,8 @@ func TestContext2Apply_moduleProviderAliasTargets(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -3345,8 +3345,8 @@ func TestContext2Apply_moduleProviderCloseNested(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -3410,8 +3410,8 @@ func TestContext2Apply_moduleVarRefExisting(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -3441,8 +3441,8 @@ func TestContext2Apply_moduleVarResourceCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -3465,8 +3465,8 @@ func TestContext2Apply_moduleVarResourceCount(t *testing.T) { ctx = testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -3495,8 +3495,8 @@ func TestContext2Apply_moduleBool(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -3527,8 +3527,8 @@ func TestContext2Apply_moduleTarget(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -3582,9 +3582,9 @@ func TestContext2Apply_multiProvider(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), - "do": testProviderFuncFixed(pDO), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), + addrs.NewLegacyProvider("do"): testProviderFuncFixed(pDO), }, ), }) @@ -3650,9 +3650,9 @@ func TestContext2Apply_multiProviderDestroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), - "vault": testProviderFuncFixed(p2), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), + addrs.NewLegacyProvider("vault"): testProviderFuncFixed(p2), }, ), }) @@ -3707,9 +3707,9 @@ func TestContext2Apply_multiProviderDestroy(t *testing.T) { State: state, Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), - "vault": testProviderFuncFixed(p2), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), + addrs.NewLegacyProvider("vault"): testProviderFuncFixed(p2), }, ), }) @@ -3777,9 +3777,9 @@ func TestContext2Apply_multiProviderDestroyChild(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), - "vault": testProviderFuncFixed(p2), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), + addrs.NewLegacyProvider("vault"): testProviderFuncFixed(p2), }, ), }) @@ -3834,9 +3834,9 @@ func TestContext2Apply_multiProviderDestroyChild(t *testing.T) { State: state, Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), - "vault": testProviderFuncFixed(p2), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), + addrs.NewLegacyProvider("vault"): testProviderFuncFixed(p2), }, ), }) @@ -3872,8 +3872,8 @@ func TestContext2Apply_multiVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -3907,8 +3907,8 @@ func TestContext2Apply_multiVar(t *testing.T) { Config: m, State: state, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -4015,8 +4015,8 @@ func TestContext2Apply_multiVarComprehensive(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -4168,8 +4168,8 @@ func TestContext2Apply_multiVarOrder(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -4204,8 +4204,8 @@ func TestContext2Apply_multiVarOrderInterp(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -4242,8 +4242,8 @@ func TestContext2Apply_multiVarCountDec(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -4310,8 +4310,8 @@ func TestContext2Apply_multiVarCountDec(t *testing.T) { State: s, Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -4370,8 +4370,8 @@ func TestContext2Apply_multiVarMissingState(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -4396,8 +4396,8 @@ func TestContext2Apply_nilDiff(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -4438,8 +4438,8 @@ func TestContext2Apply_outputDependsOn(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -4463,8 +4463,8 @@ func TestContext2Apply_outputDependsOn(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -4519,8 +4519,8 @@ func TestContext2Apply_outputOrphan(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -4569,8 +4569,8 @@ func TestContext2Apply_outputOrphanModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state.DeepCopy(), @@ -4596,8 +4596,8 @@ func TestContext2Apply_outputOrphanModule(t *testing.T) { ctx = testContext2(t, &ContextOpts{ Config: configs.NewEmptyConfig(), ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state.DeepCopy(), @@ -4630,9 +4630,9 @@ func TestContext2Apply_providerComputedVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), - "test": testProviderFuncFixed(pTest), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), + addrs.NewLegacyProvider("test"): testProviderFuncFixed(pTest), }, ), }) @@ -4682,8 +4682,8 @@ func TestContext2Apply_providerConfigureDisabled(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -4720,8 +4720,8 @@ func TestContext2Apply_provisionerModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -4767,8 +4767,8 @@ func TestContext2Apply_Provisioner_compute(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -4817,8 +4817,8 @@ func TestContext2Apply_provisionerCreateFail(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -4858,8 +4858,8 @@ func TestContext2Apply_provisionerCreateFailNoId(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -4897,8 +4897,8 @@ func TestContext2Apply_provisionerFail(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -4953,8 +4953,8 @@ func TestContext2Apply_provisionerFail_createBeforeDestroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5003,8 +5003,8 @@ func TestContext2Apply_error_createBeforeDestroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -5054,8 +5054,8 @@ func TestContext2Apply_errorDestroy_createBeforeDestroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -5107,7 +5107,7 @@ func TestContext2Apply_multiDepose_createBeforeDestroy(t *testing.T) { }, }, } - ps := map[string]providers.Factory{"aws": testProviderFuncFixed(p)} + ps := map[addrs.Provider]providers.Factory{addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p)} state := MustShimLegacyState(&State{ Modules: []*ModuleState{ &ModuleState{ @@ -5319,8 +5319,8 @@ func TestContext2Apply_provisionerFailContinue(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5368,8 +5368,8 @@ func TestContext2Apply_provisionerFailContinueHook(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5429,8 +5429,8 @@ func TestContext2Apply_provisionerDestroy(t *testing.T) { State: state, Destroy: true, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5487,8 +5487,8 @@ func TestContext2Apply_provisionerDestroyFail(t *testing.T) { State: state, Destroy: true, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5561,8 +5561,8 @@ func TestContext2Apply_provisionerDestroyFailContinue(t *testing.T) { State: state, Destroy: true, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5637,8 +5637,8 @@ func TestContext2Apply_provisionerDestroyFailContinueFail(t *testing.T) { State: state, Destroy: true, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5717,8 +5717,8 @@ func TestContext2Apply_provisionerDestroyTainted(t *testing.T) { Config: m, State: state, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5789,8 +5789,8 @@ func TestContext2Apply_provisionerDestroyModule(t *testing.T) { State: state, Destroy: true, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5863,8 +5863,8 @@ func TestContext2Apply_provisionerDestroyRef(t *testing.T) { State: state, Destroy: true, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5928,8 +5928,8 @@ func TestContext2Apply_provisionerDestroyRefInvalid(t *testing.T) { State: state, Destroy: true, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -5962,8 +5962,8 @@ func TestContext2Apply_provisionerResourceRef(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -6010,8 +6010,8 @@ func TestContext2Apply_provisionerSelfRef(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -6065,8 +6065,8 @@ func TestContext2Apply_provisionerMultiSelfRef(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -6127,8 +6127,8 @@ func TestContext2Apply_provisionerMultiSelfRefSingle(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -6184,8 +6184,8 @@ func TestContext2Apply_provisionerExplicitSelfRef(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -6215,8 +6215,8 @@ func TestContext2Apply_provisionerExplicitSelfRef(t *testing.T) { Destroy: true, State: state, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -6257,8 +6257,8 @@ func TestContext2Apply_provisionerForEachSelfRef(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -6289,8 +6289,8 @@ func TestContext2Apply_Provisioner_Diff(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -6339,8 +6339,8 @@ func TestContext2Apply_Provisioner_Diff(t *testing.T) { ctx = testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -6392,8 +6392,8 @@ func TestContext2Apply_outputDiffVars(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -6455,8 +6455,8 @@ func TestContext2Apply_destroyX(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6479,8 +6479,8 @@ func TestContext2Apply_destroyX(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6519,8 +6519,8 @@ func TestContext2Apply_destroyOrder(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6545,8 +6545,8 @@ func TestContext2Apply_destroyOrder(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6586,8 +6586,8 @@ func TestContext2Apply_destroyModulePrefix(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6615,8 +6615,8 @@ func TestContext2Apply_destroyModulePrefix(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6662,8 +6662,8 @@ func TestContext2Apply_destroyNestedModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -6712,8 +6712,8 @@ func TestContext2Apply_destroyDeeplyNestedModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -6747,8 +6747,8 @@ func TestContext2Apply_destroyModuleWithAttrsReferencingResource(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6779,8 +6779,8 @@ func TestContext2Apply_destroyModuleWithAttrsReferencingResource(t *testing.T) { State: state, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6799,8 +6799,8 @@ func TestContext2Apply_destroyModuleWithAttrsReferencingResource(t *testing.T) { } ctxOpts.ProviderResolver = providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ) ctx, diags = NewContext(ctxOpts) @@ -6836,8 +6836,8 @@ func TestContext2Apply_destroyWithModuleVariableAndCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6863,8 +6863,8 @@ func TestContext2Apply_destroyWithModuleVariableAndCount(t *testing.T) { State: state, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6881,8 +6881,8 @@ func TestContext2Apply_destroyWithModuleVariableAndCount(t *testing.T) { } ctxOpts.ProviderResolver = providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ) ctx, diags = NewContext(ctxOpts) @@ -6919,8 +6919,8 @@ func TestContext2Apply_destroyTargetWithModuleVariableAndCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -6942,8 +6942,8 @@ func TestContext2Apply_destroyTargetWithModuleVariableAndCount(t *testing.T) { Config: m, State: state, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -7002,8 +7002,8 @@ func TestContext2Apply_destroyWithModuleVariableAndCountNested(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7029,8 +7029,8 @@ func TestContext2Apply_destroyWithModuleVariableAndCountNested(t *testing.T) { State: state, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7047,8 +7047,8 @@ func TestContext2Apply_destroyWithModuleVariableAndCountNested(t *testing.T) { } ctxOpts.ProviderResolver = providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ) ctx, diags = NewContext(ctxOpts) @@ -7081,8 +7081,8 @@ func TestContext2Apply_destroyOutputs(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7104,8 +7104,8 @@ func TestContext2Apply_destroyOutputs(t *testing.T) { State: state, Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7130,8 +7130,8 @@ func TestContext2Apply_destroyOutputs(t *testing.T) { State: state, Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7165,8 +7165,8 @@ func TestContext2Apply_destroyOrphan(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -7249,8 +7249,8 @@ func TestContext2Apply_destroyTaintedProvisioner(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -7288,8 +7288,8 @@ func TestContext2Apply_error(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7391,8 +7391,8 @@ func TestContext2Apply_errorDestroy(t *testing.T) { ) }), ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -7452,8 +7452,8 @@ func TestContext2Apply_errorCreateInvalidNew(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7530,8 +7530,8 @@ func TestContext2Apply_errorUpdateNullNew(t *testing.T) { ) }), ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7593,8 +7593,8 @@ func TestContext2Apply_errorPartial(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -7661,8 +7661,8 @@ func TestContext2Apply_hook(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7715,8 +7715,8 @@ func TestContext2Apply_hookOrphan(t *testing.T) { State: state, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7746,8 +7746,8 @@ func TestContext2Apply_idAttr(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7804,8 +7804,8 @@ func TestContext2Apply_outputBasic(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7834,8 +7834,8 @@ func TestContext2Apply_outputAdd(t *testing.T) { ctx1 := testContext2(t, &ContextOpts{ Config: m1, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p1), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p1), }, ), }) @@ -7856,8 +7856,8 @@ func TestContext2Apply_outputAdd(t *testing.T) { ctx2 := testContext2(t, &ContextOpts{ Config: m2, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p2), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p2), }, ), State: state1, @@ -7887,8 +7887,8 @@ func TestContext2Apply_outputList(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7917,8 +7917,8 @@ func TestContext2Apply_outputMulti(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -7947,8 +7947,8 @@ func TestContext2Apply_outputMultiIndex(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -8011,8 +8011,8 @@ func TestContext2Apply_taintX(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -8079,8 +8079,8 @@ func TestContext2Apply_taintDep(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -8143,8 +8143,8 @@ func TestContext2Apply_taintDepRequiresNew(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -8176,8 +8176,8 @@ func TestContext2Apply_targeted(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -8218,8 +8218,8 @@ func TestContext2Apply_targetedCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -8259,8 +8259,8 @@ func TestContext2Apply_targetedCountIndex(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -8294,8 +8294,8 @@ func TestContext2Apply_targetedDestroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -8370,8 +8370,8 @@ func TestContext2Apply_destroyProvisionerWithLocals(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -8467,8 +8467,8 @@ func TestContext2Apply_destroyProvisionerWithMultipleLocals(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -8518,8 +8518,8 @@ func TestContext2Apply_destroyProvisionerWithOutput(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -8594,8 +8594,8 @@ func TestContext2Apply_targetedDestroyCountDeps(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -8638,8 +8638,8 @@ func TestContext2Apply_targetedDestroyModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -8700,8 +8700,8 @@ func TestContext2Apply_targetedDestroyCountIndex(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -8763,8 +8763,8 @@ func TestContext2Apply_targetedModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -8814,8 +8814,8 @@ func TestContext2Apply_targetedModuleDep(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -8867,8 +8867,8 @@ func TestContext2Apply_targetedModuleUnrelatedOutputs(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -8938,8 +8938,8 @@ func TestContext2Apply_targetedModuleResource(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -8999,8 +8999,8 @@ func TestContext2Apply_targetedResourceOrphanModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -9028,8 +9028,8 @@ func TestContext2Apply_unknownAttribute(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -9058,8 +9058,8 @@ func TestContext2Apply_unknownAttributeInterpolate(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -9221,8 +9221,8 @@ func TestContext2Apply_createBefore_depends(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -9352,8 +9352,8 @@ func TestContext2Apply_singleDestroy(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -9396,8 +9396,8 @@ func TestContext2Apply_issue7824(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "template": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("template"): testProviderFuncFixed(p), }, ), }) @@ -9414,8 +9414,8 @@ func TestContext2Apply_issue7824(t *testing.T) { } ctxOpts.ProviderResolver = providers.ResolverFixed( - map[string]providers.Factory{ - "template": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("template"): testProviderFuncFixed(p), }, ) ctx, diags = NewContext(ctxOpts) @@ -9454,8 +9454,8 @@ func TestContext2Apply_issue5254(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: testModule(t, "issue-5254/step-0"), ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "template": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("template"): testProviderFuncFixed(p), }, ), }) @@ -9477,8 +9477,8 @@ func TestContext2Apply_issue5254(t *testing.T) { Config: m, State: state, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "template": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("template"): testProviderFuncFixed(p), }, ), }) @@ -9495,8 +9495,8 @@ func TestContext2Apply_issue5254(t *testing.T) { } ctxOpts.ProviderResolver = providers.ResolverFixed( - map[string]providers.Factory{ - "template": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("template"): testProviderFuncFixed(p), }, ) ctx, diags = NewContext(ctxOpts) @@ -9539,8 +9539,8 @@ func TestContext2Apply_targetedWithTaintedInState(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -9578,8 +9578,8 @@ func TestContext2Apply_targetedWithTaintedInState(t *testing.T) { } ctxOpts.ProviderResolver = providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ) ctx, diags = NewContext(ctxOpts) @@ -9623,8 +9623,8 @@ func TestContext2Apply_ignoreChangesCreate(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -9736,8 +9736,8 @@ func TestContext2Apply_ignoreChangesWithDep(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -9771,8 +9771,8 @@ func TestContext2Apply_ignoreChangesWildcard(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -9819,8 +9819,8 @@ func TestContext2Apply_destroyNestedModuleWithAttrsReferencingResource(t *testin ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), }) @@ -9842,8 +9842,8 @@ func TestContext2Apply_destroyNestedModuleWithAttrsReferencingResource(t *testin Config: m, State: state, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), }) @@ -9859,8 +9859,8 @@ func TestContext2Apply_destroyNestedModuleWithAttrsReferencingResource(t *testin } ctxOpts.ProviderResolver = providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ) ctx, diags = NewContext(ctxOpts) @@ -9888,8 +9888,8 @@ func TestContext2Apply_dataDependsOn(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), }) @@ -9955,8 +9955,8 @@ func TestContext2Apply_terraformWorkspace(t *testing.T) { Meta: &ContextMeta{Env: "foo"}, Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -9986,8 +9986,8 @@ func TestContext2Apply_multiRef(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -10015,8 +10015,8 @@ func TestContext2Apply_targetedModuleRecursive(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -10059,7 +10059,7 @@ func TestContext2Apply_localVal(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{}, + map[addrs.Provider]providers.Factory{}, ), }) @@ -10129,8 +10129,8 @@ func TestContext2Apply_destroyWithLocals(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -10170,8 +10170,8 @@ func TestContext2Apply_providerWithLocals(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -10188,8 +10188,8 @@ func TestContext2Apply_providerWithLocals(t *testing.T) { ctx = testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -10247,8 +10247,8 @@ func TestContext2Apply_destroyWithProviders(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -10365,8 +10365,8 @@ func TestContext2Apply_providersFromState(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: tc.state, @@ -10403,8 +10403,8 @@ func TestContext2Apply_plannedInterpolatedCount(t *testing.T) { p.DiffFn = testDiffFn providerResolver := providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ) @@ -10465,8 +10465,8 @@ func TestContext2Apply_plannedDestroyInterpolatedCount(t *testing.T) { p.DiffFn = testDiffFn providerResolver := providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ) @@ -10542,8 +10542,8 @@ func TestContext2Apply_scaleInMultivarRef(t *testing.T) { p.DiffFn = testDiffFn providerResolver := providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ) @@ -10625,8 +10625,8 @@ func TestContext2Apply_inconsistentWithPlan(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -10692,8 +10692,8 @@ func TestContext2Apply_issue19908(t *testing.T) { ) }), ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -10749,8 +10749,8 @@ func TestContext2Apply_invalidIndexRef(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -10901,8 +10901,8 @@ func TestContext2Apply_moduleReplaceCycle(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -10956,8 +10956,8 @@ func TestContext2Apply_destroyDataCycle(t *testing.T) { ) providerResolver := providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ) @@ -11058,8 +11058,8 @@ func TestContext2Apply_taintedDestroyFailure(t *testing.T) { ) providerResolver := providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ) @@ -11211,8 +11211,8 @@ func TestContext2Apply_cbdCycle(t *testing.T) { ) providerResolver := providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ) diff --git a/terraform/context_components.go b/terraform/context_components.go index 26ec99595..e824848f0 100644 --- a/terraform/context_components.go +++ b/terraform/context_components.go @@ -3,6 +3,7 @@ package terraform import ( "fmt" + "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/providers" "github.com/hashicorp/terraform/provisioners" ) @@ -27,14 +28,14 @@ type contextComponentFactory interface { // basicComponentFactory just calls a factory from a map directly. type basicComponentFactory struct { - providers map[string]providers.Factory + providers map[addrs.Provider]providers.Factory provisioners map[string]ProvisionerFactory } func (c *basicComponentFactory) ResourceProviders() []string { result := make([]string, len(c.providers)) for k := range c.providers { - result = append(result, k) + result = append(result, k.LegacyString()) } return result @@ -50,7 +51,7 @@ func (c *basicComponentFactory) ResourceProvisioners() []string { } func (c *basicComponentFactory) ResourceProvider(typ, uid string) (providers.Interface, error) { - f, ok := c.providers[typ] + f, ok := c.providers[addrs.NewLegacyProvider(typ)] if !ok { return nil, fmt.Errorf("unknown provider %q", typ) } diff --git a/terraform/context_components_test.go b/terraform/context_components_test.go index cdd4da076..edca24257 100644 --- a/terraform/context_components_test.go +++ b/terraform/context_components_test.go @@ -3,6 +3,7 @@ package terraform import ( "github.com/zclconf/go-cty/cty" + "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/providers" "github.com/hashicorp/terraform/provisioners" @@ -26,8 +27,8 @@ func simpleMockComponentFactory() *basicComponentFactory { provider := simpleMockProvider() provisioner := simpleMockProvisioner() return &basicComponentFactory{ - providers: map[string]providers.Factory{ - "test": func() (providers.Interface, error) { + providers: map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): func() (providers.Interface, error) { return provider, nil }, }, diff --git a/terraform/context_fixtures_test.go b/terraform/context_fixtures_test.go index acc4fd589..96cdb13d5 100644 --- a/terraform/context_fixtures_test.go +++ b/terraform/context_fixtures_test.go @@ -3,6 +3,7 @@ package terraform import ( "testing" + "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/configs" "github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/providers" @@ -52,8 +53,8 @@ func contextFixtureApplyVars(t *testing.T) *contextTestFixture { return &contextTestFixture{ Config: c, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), } @@ -80,8 +81,8 @@ func contextFixtureApplyVarsEnv(t *testing.T) *contextTestFixture { return &contextTestFixture{ Config: c, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), } diff --git a/terraform/context_import_test.go b/terraform/context_import_test.go index 619ae0c33..56d60f1b9 100644 --- a/terraform/context_import_test.go +++ b/terraform/context_import_test.go @@ -18,8 +18,8 @@ func TestContextImport_basic(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -57,8 +57,8 @@ func TestContextImport_countIndex(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -97,8 +97,8 @@ func TestContextImport_collision(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), @@ -164,8 +164,8 @@ func TestContextImport_missingType(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -216,8 +216,8 @@ func TestContextImport_moduleProvider(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -255,8 +255,8 @@ func TestContextImport_providerModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -307,8 +307,8 @@ func TestContextImport_providerVarConfig(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -369,8 +369,8 @@ func TestContextImport_providerNonVarConfig(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -404,8 +404,8 @@ func TestContextImport_refresh(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -454,8 +454,8 @@ func TestContextImport_refreshNil(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -501,8 +501,8 @@ func TestContextImport_module(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -542,8 +542,8 @@ func TestContextImport_moduleDepth2(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -583,8 +583,8 @@ func TestContextImport_moduleDiff(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), @@ -641,8 +641,8 @@ func TestContextImport_moduleExisting(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), @@ -731,8 +731,8 @@ func TestContextImport_multiState(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -801,8 +801,8 @@ func TestContextImport_multiStateSame(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -836,8 +836,8 @@ func TestContextImport_customProviderMissing(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -871,8 +871,8 @@ func TestContextImport_customProvider(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) diff --git a/terraform/context_input_test.go b/terraform/context_input_test.go index 312ca1d7c..5782184e9 100644 --- a/terraform/context_input_test.go +++ b/terraform/context_input_test.go @@ -43,8 +43,8 @@ func TestContext2Input_provider(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), UIInput: inp, @@ -114,8 +114,8 @@ func TestContext2Input_providerMulti(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), UIInput: inp, @@ -159,8 +159,8 @@ func TestContext2Input_providerOnce(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -215,8 +215,8 @@ func TestContext2Input_providerId(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), UIInput: input, @@ -280,8 +280,8 @@ func TestContext2Input_providerOnly(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -336,8 +336,8 @@ func TestContext2Input_providerVars(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -389,8 +389,8 @@ func TestContext2Input_providerVarsModuleInherit(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), UIInput: input, @@ -421,8 +421,8 @@ func TestContext2Input_submoduleTriggersInvalidCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), UIInput: input, @@ -485,8 +485,8 @@ func TestContext2Input_dataSourceRequiresRefresh(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), State: state, diff --git a/terraform/context_plan_test.go b/terraform/context_plan_test.go index 7ca47f778..b069c3ec6 100644 --- a/terraform/context_plan_test.go +++ b/terraform/context_plan_test.go @@ -31,8 +31,8 @@ func TestContext2Plan_basic(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), ProviderSHA256s: map[string][]byte{ @@ -117,8 +117,8 @@ func TestContext2Plan_createBefore_deposed(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -209,8 +209,8 @@ func TestContext2Plan_createBefore_maintainRoot(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -249,8 +249,8 @@ func TestContext2Plan_emptyDiff(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -290,8 +290,8 @@ func TestContext2Plan_escapedVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -334,8 +334,8 @@ func TestContext2Plan_minimal(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -375,8 +375,8 @@ func TestContext2Plan_modules(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -450,8 +450,8 @@ func TestContext2Plan_moduleCycle(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -506,8 +506,8 @@ func TestContext2Plan_moduleDeadlock(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -552,8 +552,8 @@ func TestContext2Plan_moduleInput(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -609,8 +609,8 @@ func TestContext2Plan_moduleInputComputed(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -663,8 +663,8 @@ func TestContext2Plan_moduleInputFromVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -734,8 +734,8 @@ func TestContext2Plan_moduleMultiVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -815,8 +815,8 @@ func TestContext2Plan_moduleOrphans(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -918,8 +918,8 @@ func TestContext2Plan_moduleOrphansWithProvisioner(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -991,8 +991,8 @@ func TestContext2Plan_moduleProviderInherit(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": func() (providers.Interface, error) { + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): func() (providers.Interface, error) { l.Lock() defer l.Unlock() @@ -1057,8 +1057,8 @@ func TestContext2Plan_moduleProviderInheritDeep(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": func() (providers.Interface, error) { + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): func() (providers.Interface, error) { l.Lock() defer l.Unlock() @@ -1118,8 +1118,8 @@ func TestContext2Plan_moduleProviderDefaultsVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": func() (providers.Interface, error) { + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): func() (providers.Interface, error) { l.Lock() defer l.Unlock() @@ -1203,8 +1203,8 @@ func TestContext2Plan_moduleProviderVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1248,8 +1248,8 @@ func TestContext2Plan_moduleVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1305,8 +1305,8 @@ func TestContext2Plan_moduleVarWrongTypeBasic(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1324,8 +1324,8 @@ func TestContext2Plan_moduleVarWrongTypeNested(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), }) @@ -1343,8 +1343,8 @@ func TestContext2Plan_moduleVarWithDefaultValue(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), }) @@ -1362,8 +1362,8 @@ func TestContext2Plan_moduleVarComputed(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1415,8 +1415,8 @@ func TestContext2Plan_preventDestroy_bad(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -1454,8 +1454,8 @@ func TestContext2Plan_preventDestroy_good(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -1492,8 +1492,8 @@ func TestContext2Plan_preventDestroy_countBad(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -1547,8 +1547,8 @@ func TestContext2Plan_preventDestroy_countGood(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -1601,8 +1601,8 @@ func TestContext2Plan_preventDestroy_countGoodNoChange(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -1643,8 +1643,8 @@ func TestContext2Plan_preventDestroy_destroyPlan(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -1684,8 +1684,8 @@ func TestContext2Plan_provisionerCycle(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -1706,8 +1706,8 @@ func TestContext2Plan_computed(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1781,8 +1781,8 @@ func TestContext2Plan_blockNestingGroup(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -1854,8 +1854,8 @@ func TestContext2Plan_computedDataResource(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1923,8 +1923,8 @@ func TestContext2Plan_computedInFunction(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1977,8 +1977,8 @@ func TestContext2Plan_computedDataCountResource(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2009,8 +2009,8 @@ func TestContext2Plan_localValueCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -2079,8 +2079,8 @@ func TestContext2Plan_dataResourceBecomesComputed(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -2209,8 +2209,8 @@ func TestContext2Plan_computedList(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2321,8 +2321,8 @@ func TestContext2Plan_computedMultiIndex(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2379,8 +2379,8 @@ func TestContext2Plan_count(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2456,8 +2456,8 @@ func TestContext2Plan_countComputed(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2475,8 +2475,8 @@ func TestContext2Plan_countComputedModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2497,8 +2497,8 @@ func TestContext2Plan_countModuleStatic(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2550,8 +2550,8 @@ func TestContext2Plan_countModuleStaticGrandchild(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2603,8 +2603,8 @@ func TestContext2Plan_countIndex(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2656,8 +2656,8 @@ func TestContext2Plan_countVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -2742,8 +2742,8 @@ func TestContext2Plan_countZero(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2785,8 +2785,8 @@ func TestContext2Plan_countOneIndex(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -2869,8 +2869,8 @@ func TestContext2Plan_countDecreaseToOne(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -2964,8 +2964,8 @@ func TestContext2Plan_countIncreaseFromNotSet(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -3053,8 +3053,8 @@ func TestContext2Plan_countIncreaseFromOne(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -3157,8 +3157,8 @@ func TestContext2Plan_countIncreaseFromOneCorrupted(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -3295,8 +3295,8 @@ func TestContext2Plan_countIncreaseWithSplatReference(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -3352,8 +3352,8 @@ func TestContext2Plan_forEach(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -3390,8 +3390,8 @@ func TestContext2Plan_forEachUnknownValue(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -3444,8 +3444,8 @@ func TestContext2Plan_destroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -3515,8 +3515,8 @@ func TestContext2Plan_moduleDestroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -3586,8 +3586,8 @@ func TestContext2Plan_moduleDestroyCycle(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -3656,8 +3656,8 @@ func TestContext2Plan_moduleDestroyMultivar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -3718,8 +3718,8 @@ func TestContext2Plan_pathVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -3782,8 +3782,8 @@ func TestContext2Plan_diffVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -3862,8 +3862,8 @@ func TestContext2Plan_hook(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -3891,8 +3891,8 @@ func TestContext2Plan_closeProvider(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -3929,8 +3929,8 @@ func TestContext2Plan_orphan(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -3983,8 +3983,8 @@ func TestContext2Plan_shadowUuid(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -4017,8 +4017,8 @@ func TestContext2Plan_state(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -4105,8 +4105,8 @@ func TestContext2Plan_taint(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -4190,8 +4190,8 @@ func TestContext2Plan_taintIgnoreChanges(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -4270,8 +4270,8 @@ func TestContext2Plan_taintDestroyInterpolatedCountRace(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -4324,8 +4324,8 @@ func TestContext2Plan_targeted(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -4377,8 +4377,8 @@ func TestContext2Plan_targetedCrossModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -4444,8 +4444,8 @@ func TestContext2Plan_targetedModuleWithProvider(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -4483,8 +4483,8 @@ func TestContext2Plan_targetedOrphan(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -4553,8 +4553,8 @@ func TestContext2Plan_targetedModuleOrphan(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -4621,8 +4621,8 @@ func TestContext2Plan_targetedModuleUntargetedVariable(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -4679,8 +4679,8 @@ func TestContext2Plan_outputContainsTargetedResource(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Targets: []addrs.Targetable{ @@ -4726,8 +4726,8 @@ func TestContext2Plan_targetedOverTen(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -4778,8 +4778,8 @@ func TestContext2Plan_provider(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -4805,8 +4805,8 @@ func TestContext2Plan_varListErr(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -4843,8 +4843,8 @@ func TestContext2Plan_ignoreChanges(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -4915,8 +4915,8 @@ func TestContext2Plan_ignoreChangesWildcard(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -4985,8 +4985,8 @@ func TestContext2Plan_ignoreChangesInMap(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), State: s, @@ -5065,8 +5065,8 @@ func TestContext2Plan_moduleMapLiteral(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5112,8 +5112,8 @@ func TestContext2Plan_computedValueInMap(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5171,8 +5171,8 @@ func TestContext2Plan_moduleVariableFromSplat(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5254,8 +5254,8 @@ func TestContext2Plan_createBeforeDestroy_depends_datasource(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5367,8 +5367,8 @@ func TestContext2Plan_listOrder(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5448,8 +5448,8 @@ func TestContext2Plan_ignoreChangesWithFlatmaps(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -5584,8 +5584,8 @@ func TestContext2Plan_resourceNestedCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -5666,8 +5666,8 @@ func TestContext2Plan_computedAttrRefTypeMismatch(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5699,8 +5699,8 @@ func TestContext2Plan_selfRef(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5738,8 +5738,8 @@ func TestContext2Plan_selfRefMulti(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5777,8 +5777,8 @@ func TestContext2Plan_selfRefMultiAll(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5818,8 +5818,8 @@ output "out" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5860,8 +5860,8 @@ resource "aws_instance" "foo" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5909,8 +5909,8 @@ resource "aws_instance" "foo" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -5959,8 +5959,8 @@ func TestContext2Plan_requiredModuleOutput(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -6026,8 +6026,8 @@ func TestContext2Plan_requiredModuleObject(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) diff --git a/terraform/context_refresh_test.go b/terraform/context_refresh_test.go index 0c4fa0302..65e091e6c 100644 --- a/terraform/context_refresh_test.go +++ b/terraform/context_refresh_test.go @@ -45,8 +45,8 @@ func TestContext2Refresh(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: startingState, @@ -132,8 +132,8 @@ func TestContext2Refresh_dynamicAttr(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), State: startingState, @@ -168,8 +168,8 @@ func TestContext2Refresh_dataComputedModuleVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -259,8 +259,8 @@ func TestContext2Refresh_targeted(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -342,8 +342,8 @@ func TestContext2Refresh_targetedCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -435,8 +435,8 @@ func TestContext2Refresh_targetedCountIndex(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -504,8 +504,8 @@ func TestContext2Refresh_moduleComputedVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -523,8 +523,8 @@ func TestContext2Refresh_delete(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -566,8 +566,8 @@ func TestContext2Refresh_ignoreUncreated(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: nil, @@ -597,8 +597,8 @@ func TestContext2Refresh_hook(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -663,8 +663,8 @@ func TestContext2Refresh_modules(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -725,8 +725,8 @@ func TestContext2Refresh_moduleInputComputedOutput(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -743,8 +743,8 @@ func TestContext2Refresh_moduleVarModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -761,8 +761,8 @@ func TestContext2Refresh_noState(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -803,8 +803,8 @@ func TestContext2Refresh_output(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -879,8 +879,8 @@ func TestContext2Refresh_outputPartial(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -934,8 +934,8 @@ func TestContext2Refresh_stateBasic(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1009,8 +1009,8 @@ func TestContext2Refresh_dataCount(t *testing.T) { ctx := testContext2(t, &ContextOpts{ ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), Config: m, @@ -1055,8 +1055,8 @@ func TestContext2Refresh_dataOrphan(t *testing.T) { }) ctx := testContext2(t, &ContextOpts{ ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), State: state, @@ -1105,8 +1105,8 @@ func TestContext2Refresh_dataState(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), State: state, @@ -1212,8 +1212,8 @@ func TestContext2Refresh_dataStateRefData(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "null": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("null"): testProviderFuncFixed(p), }, ), State: state, @@ -1263,8 +1263,8 @@ func TestContext2Refresh_tainted(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1307,7 +1307,7 @@ func TestContext2Refresh_unknownProvider(t *testing.T) { _, diags := NewContext(&ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{}, + map[addrs.Provider]providers.Factory{}, ), State: MustShimLegacyState(&State{ Modules: []*ModuleState{ @@ -1360,8 +1360,8 @@ func TestContext2Refresh_vars(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: MustShimLegacyState(&State{ @@ -1522,8 +1522,8 @@ func TestContext2Refresh_orphanModule(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1567,8 +1567,8 @@ func TestContext2Validate(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1630,8 +1630,8 @@ func TestContext2Refresh_noDiffHookOnScaleOut(t *testing.T) { Config: m, Hooks: []Hook{h}, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -1678,8 +1678,8 @@ func TestContext2Refresh_updateProviderInState(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: s, @@ -1746,8 +1746,8 @@ func TestContext2Refresh_schemaUpgradeFlatmap(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), State: s, @@ -1829,8 +1829,8 @@ func TestContext2Refresh_schemaUpgradeJSON(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), State: s, @@ -1889,8 +1889,8 @@ data "aws_data_source" "foo" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1952,8 +1952,8 @@ func TestContext2Refresh_dataResourceDependsOn(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), State: s, @@ -2026,8 +2026,8 @@ resource "aws_instance" "foo" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, diff --git a/terraform/context_validate_test.go b/terraform/context_validate_test.go index 5557fa67b..131831b27 100644 --- a/terraform/context_validate_test.go +++ b/terraform/context_validate_test.go @@ -30,8 +30,8 @@ func TestContext2Validate_badCount(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -59,8 +59,8 @@ func TestContext2Validate_badVar(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -90,8 +90,8 @@ func TestContext2Validate_varMapOverrideOld(t *testing.T) { _, diags := NewContext(&ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{}, @@ -142,9 +142,9 @@ func TestContext2Validate_computedVar(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), - "test": testProviderFuncFixed(pt), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), + addrs.NewLegacyProvider("test"): testProviderFuncFixed(pt), }, ), }) @@ -191,8 +191,8 @@ func TestContext2Validate_computedInFunction(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -228,8 +228,8 @@ func TestContext2Validate_countComputed(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -254,8 +254,8 @@ func TestContext2Validate_countNegative(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -282,8 +282,8 @@ func TestContext2Validate_countVariable(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -310,8 +310,8 @@ func TestContext2Validate_countVariableNoDefault(t *testing.T) { _, diags := NewContext(&ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -337,8 +337,8 @@ func TestContext2Validate_moduleBadOutput(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -365,8 +365,8 @@ func TestContext2Validate_moduleGood(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -391,8 +391,8 @@ func TestContext2Validate_moduleBadResource(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -423,8 +423,8 @@ func TestContext2Validate_moduleDepsShouldNotCycle(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -456,8 +456,8 @@ func TestContext2Validate_moduleProviderVar(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -499,8 +499,8 @@ func TestContext2Validate_moduleProviderInheritUnused(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -547,8 +547,8 @@ func TestContext2Validate_orphans(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -589,8 +589,8 @@ func TestContext2Validate_providerConfig_bad(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -627,8 +627,8 @@ func TestContext2Validate_providerConfig_badEmpty(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -662,8 +662,8 @@ func TestContext2Validate_providerConfig_good(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -692,8 +692,8 @@ func TestContext2Validate_provisionerConfig_bad(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -729,8 +729,8 @@ func TestContext2Validate_badResourceConnection(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -763,8 +763,8 @@ func TestContext2Validate_badProvisionerConnection(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -811,8 +811,8 @@ func TestContext2Validate_provisionerConfig_good(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -842,8 +842,8 @@ func TestContext2Validate_requiredVar(t *testing.T) { _, diags := NewContext(&ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -869,8 +869,8 @@ func TestContext2Validate_resourceConfig_bad(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -901,8 +901,8 @@ func TestContext2Validate_resourceConfig_good(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -946,8 +946,8 @@ func TestContext2Validate_tainted(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), State: state, @@ -989,8 +989,8 @@ func TestContext2Validate_targetedDestroy(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Provisioners: map[string]ProvisionerFactory{ @@ -1036,8 +1036,8 @@ func TestContext2Validate_varRefUnknown(t *testing.T) { c := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), Variables: InputValues{ @@ -1086,8 +1086,8 @@ func TestContext2Validate_interpolateVar(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "template": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("template"): testProviderFuncFixed(p), }, ), UIInput: input, @@ -1121,8 +1121,8 @@ func TestContext2Validate_interpolateComputedModuleVarDef(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), UIInput: input, @@ -1146,8 +1146,8 @@ func TestContext2Validate_interpolateMap(t *testing.T) { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "template": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("template"): testProviderFuncFixed(p), }, ), UIInput: input, @@ -1226,8 +1226,8 @@ output "out" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1265,8 +1265,8 @@ resource "aws_instance" "foo" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1296,8 +1296,8 @@ output "out" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1329,8 +1329,8 @@ output "out" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1362,8 +1362,8 @@ output "out" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "aws": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p), }, ), }) @@ -1394,8 +1394,8 @@ resource "test_instance" "bar" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) @@ -1429,8 +1429,8 @@ resource "test_instance" "bar" { ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( - map[string]providers.Factory{ - "test": testProviderFuncFixed(p), + map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): testProviderFuncFixed(p), }, ), }) diff --git a/terraform/eval_context_builtin_test.go b/terraform/eval_context_builtin_test.go index a0d7bed94..1907d136e 100644 --- a/terraform/eval_context_builtin_test.go +++ b/terraform/eval_context_builtin_test.go @@ -52,8 +52,8 @@ func TestBuildingEvalContextInitProvider(t *testing.T) { ctx.ProviderLock = &lock ctx.ProviderCache = make(map[string]providers.Interface) ctx.Components = &basicComponentFactory{ - providers: map[string]providers.Factory{ - "test": providers.FactoryFixed(testP), + providers: map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): providers.FactoryFixed(testP), }, } diff --git a/terraform/graph_builder_plan_test.go b/terraform/graph_builder_plan_test.go index 9b81cb87c..336f5be82 100644 --- a/terraform/graph_builder_plan_test.go +++ b/terraform/graph_builder_plan_test.go @@ -34,9 +34,9 @@ func TestPlanGraphBuilder(t *testing.T) { }, } components := &basicComponentFactory{ - providers: map[string]providers.Factory{ - "aws": providers.FactoryFixed(awsProvider), - "openstack": providers.FactoryFixed(openstackProvider), + providers: map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): providers.FactoryFixed(awsProvider), + addrs.NewLegacyProvider("openstack"): providers.FactoryFixed(openstackProvider), }, } @@ -92,8 +92,8 @@ func TestPlanGraphBuilder_dynamicBlock(t *testing.T) { }, } components := &basicComponentFactory{ - providers: map[string]providers.Factory{ - "test": providers.FactoryFixed(provider), + providers: map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): providers.FactoryFixed(provider), }, } @@ -171,8 +171,8 @@ func TestPlanGraphBuilder_attrAsBlocks(t *testing.T) { }, } components := &basicComponentFactory{ - providers: map[string]providers.Factory{ - "test": providers.FactoryFixed(provider), + providers: map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("test"): providers.FactoryFixed(provider), }, } @@ -258,8 +258,8 @@ func TestPlanGraphBuilder_forEach(t *testing.T) { } components := &basicComponentFactory{ - providers: map[string]providers.Factory{ - "aws": providers.FactoryFixed(awsProvider), + providers: map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider("aws"): providers.FactoryFixed(awsProvider), }, } diff --git a/terraform/resource_provider.go b/terraform/resource_provider.go index 3455ad88c..27f98c0fe 100644 --- a/terraform/resource_provider.go +++ b/terraform/resource_provider.go @@ -3,6 +3,7 @@ package terraform import ( "fmt" + "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/tfdiags" "github.com/hashicorp/terraform/plugin/discovery" @@ -209,18 +210,18 @@ type ResourceProviderResolver interface { // Given a constraint map, return a ResourceProviderFactory for each // requested provider. If some or all of the constraints cannot be // satisfied, return a non-nil slice of errors describing the problems. - ResolveProviders(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) + ResolveProviders(reqd discovery.PluginRequirements) (map[addrs.Provider]ResourceProviderFactory, []error) } // ResourceProviderResolverFunc wraps a callback function and turns it into // a ResourceProviderResolver implementation, for convenience in situations // where a function and its associated closure are sufficient as a resolver // implementation. -type ResourceProviderResolverFunc func(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) +type ResourceProviderResolverFunc func(reqd discovery.PluginRequirements) (map[addrs.Provider]ResourceProviderFactory, []error) // ResolveProviders implements ResourceProviderResolver by calling the // wrapped function. -func (f ResourceProviderResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) { +func (f ResourceProviderResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[addrs.Provider]ResourceProviderFactory, []error) { return f(reqd) } @@ -231,13 +232,15 @@ func (f ResourceProviderResolverFunc) ResolveProviders(reqd discovery.PluginRequ // // This function is primarily used in tests, to provide mock providers or // in-process providers under test. -func ResourceProviderResolverFixed(factories map[string]ResourceProviderFactory) ResourceProviderResolver { - return ResourceProviderResolverFunc(func(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) { - ret := make(map[string]ResourceProviderFactory, len(reqd)) +func ResourceProviderResolverFixed(factories map[addrs.Provider]ResourceProviderFactory) ResourceProviderResolver { + return ResourceProviderResolverFunc(func(reqd discovery.PluginRequirements) (map[addrs.Provider]ResourceProviderFactory, []error) { + ret := make(map[addrs.Provider]ResourceProviderFactory, len(reqd)) var errs []error for name := range reqd { - if factory, exists := factories[name]; exists { - ret[name] = factory + // Provider Source Readiness! + fqn := addrs.NewLegacyProvider(name) + if factory, exists := factories[fqn]; exists { + ret[fqn] = factory } else { errs = append(errs, fmt.Errorf("provider %q is not available", name)) } @@ -285,7 +288,7 @@ func ProviderHasDataSource(p ResourceProvider, n string) bool { // This should be called only with configurations that have passed calls // to config.Validate(), which ensures that all of the given version // constraints are valid. It will panic if any invalid constraints are present. -func resourceProviderFactories(resolver providers.Resolver, reqd discovery.PluginRequirements) (map[string]providers.Factory, tfdiags.Diagnostics) { +func resourceProviderFactories(resolver providers.Resolver, reqd discovery.PluginRequirements) (map[addrs.Provider]providers.Factory, tfdiags.Diagnostics) { var diags tfdiags.Diagnostics ret, errs := resolver.ResolveProviders(reqd) if errs != nil { diff --git a/terraform/resource_provider_mock_test.go b/terraform/resource_provider_mock_test.go index ed6d2ba0e..ee6570917 100644 --- a/terraform/resource_provider_mock_test.go +++ b/terraform/resource_provider_mock_test.go @@ -3,6 +3,7 @@ package terraform import ( "testing" + "github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/providers" "github.com/zclconf/go-cty/cty" @@ -17,8 +18,8 @@ func TestMockResourceProvider_impl(t *testing.T) { // a single given. func testProviderComponentFactory(name string, provider providers.Interface) *basicComponentFactory { return &basicComponentFactory{ - providers: map[string]providers.Factory{ - name: providers.FactoryFixed(provider), + providers: map[addrs.Provider]providers.Factory{ + addrs.NewLegacyProvider(name): providers.FactoryFixed(provider), }, } } diff --git a/tools/terraform-bundle/package.go b/tools/terraform-bundle/package.go index e21c6fa77..c676b30da 100644 --- a/tools/terraform-bundle/package.go +++ b/tools/terraform-bundle/package.go @@ -182,7 +182,7 @@ func (c *PackageCommand) Run(args []string) int { } else { //attempt to get from the public registry if not found locally c.ui.Output(fmt.Sprintf("- Checking for provider plugin on %s...", releaseHost)) - _, _, err := installer.Get(addrs.ProviderType{Type: name}, constraint) + _, _, err := installer.Get(addrs.Provider{Type: name}, constraint) if err != nil { c.ui.Error(fmt.Sprintf("- Failed to resolve %s provider %s: %s", name, constraint, err)) return 1