providers: use addrs.Provider as map keys for provider.Factory (#23548)

* terraform/context: use new addrs.Provider as map key in provider factories
* added NewLegacyProviderType and LegacyString funcs to make it explicit that these are temporary placeholders

This PR introduces a new concept, provider fully-qualified name (FQN), encapsulated by the `addrs.Provider` struct.
This commit is contained in:
Kristin Laemmert 2019-12-04 11:30:20 -05:00 committed by GitHub
parent 26131d948c
commit 9891d0354a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 980 additions and 926 deletions

47
addrs/provider.go Normal file
View File

@ -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
}

View File

@ -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
}

View File

@ -113,8 +113,8 @@ func TestLocalProvider(t *testing.T, b *Local, name string, schema *terraform.Pr
// Setup our provider // Setup our provider
b.ContextOpts.ProviderResolver = providers.ResolverFixed( b.ContextOpts.ProviderResolver = providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
name: providers.FactoryFixed(p), addrs.NewLegacyProvider(name): providers.FactoryFixed(p),
}, },
) )

View File

@ -23,7 +23,6 @@ resource "test_resource_import_other" "foo" {
{ {
ImportState: true, ImportState: true,
ResourceName: "test_resource_import_other.foo", ResourceName: "test_resource_import_other.foo",
ImportStateCheck: func(iss []*terraform.InstanceState) error { ImportStateCheck: func(iss []*terraform.InstanceState) error {
if got, want := len(iss), 2; got != want { if got, want := len(iss), 2; got != want {
return fmt.Errorf("wrong number of resources %d; want %d", got, want) return fmt.Errorf("wrong number of resources %d; want %d", got, want)

View File

@ -177,7 +177,7 @@ func TestApply_parallelism(t *testing.T) {
// to ApplyResourceChange, we need to use a number of separate providers // to ApplyResourceChange, we need to use a number of separate providers
// here. They will all have the same mock implementation function assigned // here. They will all have the same mock implementation function assigned
// but crucially they will each have their own mutex. // 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++ { for i := 0; i < 10; i++ {
name := fmt.Sprintf("test%d", i) name := fmt.Sprintf("test%d", i)
provider := &terraform.MockProvider{} provider := &terraform.MockProvider{}
@ -203,7 +203,7 @@ func TestApply_parallelism(t *testing.T) {
NewState: cty.EmptyObjectVal, NewState: cty.EmptyObjectVal,
} }
} }
providerFactories[name] = providers.FactoryFixed(provider) providerFactories[addrs.NewLegacyProvider(name)] = providers.FactoryFixed(provider)
} }
testingOverrides := &testingOverrides{ testingOverrides := &testingOverrides{
ProviderResolver: providers.ResolverFixed(providerFactories), ProviderResolver: providers.ResolverFixed(providerFactories),

View File

@ -114,8 +114,8 @@ func testFixturePath(name string) string {
func metaOverridesForProvider(p providers.Interface) *testingOverrides { func metaOverridesForProvider(p providers.Interface) *testingOverrides {
return &testingOverrides{ return &testingOverrides{
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": providers.FactoryFixed(p), 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 { func metaOverridesForProviderAndProvisioner(p providers.Interface, pr provisioners.Interface) *testingOverrides {
return &testingOverrides{ return &testingOverrides{
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": providers.FactoryFixed(p), addrs.NewLegacyProvider("test"): providers.FactoryFixed(p),
}, },
), ),
Provisioners: map[string]provisioners.Factory{ Provisioners: map[string]provisioners.Factory{

View File

@ -12,6 +12,7 @@ import (
"github.com/mitchellh/cli" "github.com/mitchellh/cli"
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/helper/copy" "github.com/hashicorp/terraform/helper/copy"
"github.com/hashicorp/terraform/plugin/discovery" "github.com/hashicorp/terraform/plugin/discovery"
@ -549,8 +550,8 @@ func TestImport_providerNameMismatch(t *testing.T) {
Meta: Meta{ Meta: Meta{
testingOverrides: &testingOverrides{ testingOverrides: &testingOverrides{
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test-beta": providers.FactoryFixed(p), addrs.NewLegacyProvider("test-beta"): providers.FactoryFixed(p),
}, },
), ),
}, },

View File

@ -517,7 +517,7 @@ func (c *InitCommand) getProviders(earlyConfig *earlyconfig.Config, state *state
} }
for provider, reqd := range missing { for provider, reqd := range missing {
pty := addrs.ProviderType{Type: provider} pty := addrs.Provider{Type: provider}
_, providerDiags, err := c.providerInstaller.Get(pty, reqd.Versions) _, providerDiags, err := c.providerInstaller.Get(pty, reqd.Versions)
diags = diags.Append(providerDiags) diags = diags.Append(providerDiags)

View File

@ -1,13 +1,17 @@
package command package command
import "testing" import (
"testing"
"github.com/hashicorp/terraform/addrs"
)
func TestInternalPlugin_InternalProviders(t *testing.T) { func TestInternalPlugin_InternalProviders(t *testing.T) {
m := new(Meta) m := new(Meta)
providers := m.internalProviders() providers := m.internalProviders()
// terraform is the only provider moved back to internal // terraform is the only provider moved back to internal
for _, name := range []string{"terraform"} { for _, name := range []string{"terraform"} {
pf, ok := providers[name] pf, ok := providers[addrs.NewLegacyProvider(name)]
if !ok { if !ok {
t.Errorf("Expected to find %s in InternalProviders", name) t.Errorf("Expected to find %s in InternalProviders", name)
} }

View File

@ -15,6 +15,7 @@ import (
plugin "github.com/hashicorp/go-plugin" plugin "github.com/hashicorp/go-plugin"
"github.com/kardianos/osext" "github.com/kardianos/osext"
"github.com/hashicorp/terraform/addrs"
terraformProvider "github.com/hashicorp/terraform/builtin/providers/terraform" terraformProvider "github.com/hashicorp/terraform/builtin/providers/terraform"
tfplugin "github.com/hashicorp/terraform/plugin" tfplugin "github.com/hashicorp/terraform/plugin"
"github.com/hashicorp/terraform/plugin/discovery" "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 // (will produce an error if one is set). This should be used only in
// exceptional circumstances since it forces the provider's release // exceptional circumstances since it forces the provider's release
// schedule to be tied to that of Terraform Core. // 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) candidates := avail.ConstrainVersions(reqd)
ret := map[string]discovery.PluginMeta{} ret := map[string]discovery.PluginMeta{}
for name, metas := range candidates { for name, metas := range candidates {
// If the provider is in our internal map then we ignore any // If the provider is in our internal map then we ignore any
// discovered plugins for it since these are dealt with separately. // discovered plugins for it since these are dealt with separately.
if _, isInternal := internal[name]; isInternal { if _, isInternal := internal[addrs.NewLegacyProvider(name)]; isInternal {
continue continue
} }
@ -58,18 +59,18 @@ func choosePlugins(avail discovery.PluginMetaSet, internal map[string]providers.
func (r *multiVersionProviderResolver) ResolveProviders( func (r *multiVersionProviderResolver) ResolveProviders(
reqd discovery.PluginRequirements, reqd discovery.PluginRequirements,
) (map[string]providers.Factory, []error) { ) (map[addrs.Provider]providers.Factory, []error) {
factories := make(map[string]providers.Factory, len(reqd)) factories := make(map[addrs.Provider]providers.Factory, len(reqd))
var errs []error var errs []error
chosen := choosePlugins(r.Available, r.Internal, reqd) chosen := choosePlugins(r.Available, r.Internal, reqd)
for name, req := range 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() { 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)) errs = append(errs, fmt.Errorf("provider.%s: this provider is built in to Terraform and so it does not support version constraints", name))
continue continue
} }
factories[name] = factory factories[addrs.NewLegacyProvider(name)] = factory
continue continue
} }
@ -84,7 +85,7 @@ func (r *multiVersionProviderResolver) ResolveProviders(
continue continue
} }
factories[name] = providerFactory(newest) factories[addrs.NewLegacyProvider(name)] = providerFactory(newest)
} else { } else {
msg := fmt.Sprintf("provider.%s: no suitable version installed", name) 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 { func (m *Meta) internalProviders() map[addrs.Provider]providers.Factory {
return map[string]providers.Factory{ return map[addrs.Provider]providers.Factory{
"terraform": func() (providers.Interface, error) { addrs.NewLegacyProvider("terraform"): func() (providers.Interface, error) {
return terraformProvider.NewProvider(), nil return terraformProvider.NewProvider(), nil
}, },
} }
@ -297,7 +298,7 @@ func (m *Meta) missingPlugins(avail discovery.PluginMetaSet, reqd discovery.Plug
for name, versionSet := range reqd { for name, versionSet := range reqd {
// internal providers can't be missing // internal providers can't be missing
if _, ok := internal[name]; ok { if _, ok := internal[addrs.NewLegacyProvider(name)]; ok {
continue continue
} }

View File

@ -24,8 +24,8 @@ func TestMultiVersionProviderResolver(t *testing.T) {
}) })
resolver := &multiVersionProviderResolver{ resolver := &multiVersionProviderResolver{
Internal: map[string]providers.Factory{ Internal: map[addrs.Provider]providers.Factory{
"internal": providers.FactoryFixed( addrs.NewLegacyProvider("internal"): providers.FactoryFixed(
&terraform.MockProvider{ &terraform.MockProvider{
GetSchemaReturn: &terraform.ProviderSchema{ GetSchemaReturn: &terraform.ProviderSchema{
ResourceTypes: map[string]*configschema.Block{ ResourceTypes: map[string]*configschema.Block{
@ -51,7 +51,7 @@ func TestMultiVersionProviderResolver(t *testing.T) {
if ct := len(got); ct != 1 { if ct := len(got); ct != 1 {
t.Errorf("wrong number of results %d; want 1", ct) 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") t.Errorf("provider \"plugin\" not in result")
} }
}) })
@ -79,7 +79,7 @@ func TestMultiVersionProviderResolver(t *testing.T) {
if ct := len(got); ct != 1 { if ct := len(got); ct != 1 {
t.Errorf("wrong number of results %d; want 1", ct) 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") t.Errorf("provider \"internal\" not in result")
} }
}) })
@ -121,7 +121,7 @@ func TestPluginPath(t *testing.T) {
func TestInternalProviders(t *testing.T) { func TestInternalProviders(t *testing.T) {
m := Meta{} m := Meta{}
internal := m.internalProviders() internal := m.internalProviders()
tfProvider, err := internal["terraform"]() tfProvider, err := internal[addrs.NewLegacyProvider("terraform")]()
if err != nil { if err != nil {
t.Fatal(err) 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) 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 var diags tfdiags.Diagnostics
noMeta := discovery.PluginMeta{} noMeta := discovery.PluginMeta{}
versions := i.Providers[provider.Type] 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) 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) return cb(provider.Type, req)
} }

View File

@ -241,11 +241,11 @@ func (u *Upgrader) analyze(ms ModuleSources) (*analysis, error) {
return nil, fmt.Errorf("error resolving providers:\n%s", errorsMsg) return nil, fmt.Errorf("error resolving providers:\n%s", errorsMsg)
} }
for name, fn := range providerFactories { for fqn, fn := range providerFactories {
log.Printf("[TRACE] Fetching schema from provider %q", name) log.Printf("[TRACE] Fetching schema from provider %q", fqn.LegacyString())
provider, err := fn() provider, err := fn()
if err != nil { 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() resp := provider.GetSchema()
@ -264,7 +264,7 @@ func (u *Upgrader) analyze(ms ModuleSources) (*analysis, error) {
for t, s := range resp.DataSources { for t, s := range resp.DataSources {
schema.DataSources[t] = s.Block schema.DataSources[t] = s.Block
} }
ret.ProviderSchemas[name] = schema ret.ProviderSchemas[fqn.LegacyString()] = schema
} }
for name, fn := range u.Provisioners { for name, fn := range u.Provisioners {

View File

@ -14,6 +14,7 @@ import (
"github.com/davecgh/go-spew/spew" "github.com/davecgh/go-spew/spew"
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/addrs"
backendinit "github.com/hashicorp/terraform/backend/init" backendinit "github.com/hashicorp/terraform/backend/init"
"github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/helper/logging" "github.com/hashicorp/terraform/helper/logging"
@ -186,8 +187,8 @@ func diffSourceFilesFallback(got, want []byte) []byte {
return buf.Bytes() return buf.Bytes()
} }
var testProviders = map[string]providers.Factory{ var testProviders = map[addrs.Provider]providers.Factory{
"test": providers.Factory(func() (providers.Interface, error) { addrs.NewLegacyProvider("test"): providers.Factory(func() (providers.Interface, error) {
p := &terraform.MockProvider{} p := &terraform.MockProvider{}
p.GetSchemaReturn = &terraform.ProviderSchema{ p.GetSchemaReturn = &terraform.ProviderSchema{
ResourceTypes: map[string]*configschema.Block{ ResourceTypes: map[string]*configschema.Block{
@ -236,7 +237,7 @@ var testProviders = map[string]providers.Factory{
} }
return p, nil return p, nil
}), }),
"terraform": providers.Factory(func() (providers.Interface, error) { addrs.NewLegacyProvider("terraform"): providers.Factory(func() (providers.Interface, error) {
p := &terraform.MockProvider{} p := &terraform.MockProvider{}
p.GetSchemaReturn = &terraform.ProviderSchema{ p.GetSchemaReturn = &terraform.ProviderSchema{
DataSources: map[string]*configschema.Block{ DataSources: map[string]*configschema.Block{
@ -252,7 +253,7 @@ var testProviders = map[string]providers.Factory{
} }
return p, nil 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 // This is here only so we can test the provisioner connection info
// migration behavior, which is resource-type specific. Do not use // migration behavior, which is resource-type specific. Do not use
// it in any other tests. // it in any other tests.

View File

@ -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 // wrap the old provider factories in the test grpc server so they can be
// called from terraform. // called from terraform.
newProviders := make(map[string]providers.Factory) newProviders := make(map[addrs.Provider]providers.Factory)
for k, pf := range ctxProviders { for k, pf := range ctxProviders {
factory := pf // must copy to ensure each closure sees its own value 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() p, err := factory()
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -16,7 +16,7 @@ import (
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
) )
// testStepImportState runs an imort state test step // testStepImportState runs an import state test step
func testStepImportState( func testStepImportState(
opts terraform.ContextOpts, opts terraform.ContextOpts,
state *terraform.State, state *terraform.State,
@ -96,7 +96,6 @@ func testStepImportState(
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Go through the new state and verify // Go through the new state and verify
if step.ImportStateCheck != nil { if step.ImportStateCheck != nil {
var states []*terraform.InstanceState var states []*terraform.InstanceState

View File

@ -14,6 +14,7 @@ import (
"testing" "testing"
"github.com/hashicorp/go-multierror" "github.com/hashicorp/go-multierror"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/plugin/discovery" "github.com/hashicorp/terraform/plugin/discovery"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
@ -1080,7 +1081,7 @@ func TestTestProviderResolver(t *testing.T) {
for name := range reqd { for name := range reqd {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
pf, ok := factories[name] pf, ok := factories[addrs.NewLegacyProvider(name)]
if !ok { if !ok {
t.Fatalf("no factory for %q", name) t.Fatalf("no factory for %q", name)
} }

View File

@ -50,7 +50,7 @@ func init() {
// An Installer maintains a local cache of plugins by downloading plugins // An Installer maintains a local cache of plugins by downloading plugins
// from an online repository. // from an online repository.
type Installer interface { 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) 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 // 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 // be presented alongside context about what is being installed, and thus the
// error messages do not redundantly include such information. // 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 var diags tfdiags.Diagnostics
// a little bit of initialization. // a little bit of initialization.
@ -276,7 +276,7 @@ func (i *ProviderInstaller) Get(provider addrs.ProviderType, req Constraints) (P
return metas.Newest(), diags, nil 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 { if i.Cache != nil {
log.Printf("[DEBUG] looking for provider %s %s in plugin cache", provider.Type, version) log.Printf("[DEBUG] looking for provider %s %s in plugin cache", provider.Type, version)
cached := i.Cache.CachedPluginPath("provider", 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 // 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) req := regsrc.NewTerraformProvider(provider.Type, i.OS, i.Arch)
versions, err := i.registry.TerraformProviderVersions(req) versions, err := i.registry.TerraformProviderVersions(req)
return versions, err return versions, err

View File

@ -152,7 +152,7 @@ func TestVersionListing(t *testing.T) {
i := newProviderInstaller(server) i := newProviderInstaller(server)
allVersions, err := i.listProviderVersions(addrs.ProviderType{Type: "test"}) allVersions, err := i.listProviderVersions(addrs.Provider{Type: "test"})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -419,7 +419,7 @@ func TestProviderInstallerGet(t *testing.T) {
registry: registry.NewClient(Disco(server), nil), 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 { if err != ErrorNoVersionCompatibleWithPlatform {
t.Fatal("want error for incompatible version") 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 { if err != ErrorNoSuitableVersion {
t.Fatal("want error for mismatching constraints") t.Fatal("want error for mismatching constraints")
} }
} }
{ {
provider := addrs.ProviderType{Type: "nonexist"} provider := addrs.Provider{Type: "nonexist"}
_, _, err := i.Get(provider, AllVersions) _, _, err := i.Get(provider, AllVersions)
if err != ErrorNoSuchProvider { if err != ErrorNoSuchProvider {
t.Fatal("want error for no such provider") 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 { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -508,7 +508,7 @@ func TestProviderInstallerGet_cache(t *testing.T) {
Arch: "mockarch", Arch: "mockarch",
} }
gotMeta, _, err := i.Get(addrs.ProviderType{Type: "test"}, AllVersions) gotMeta, _, err := i.Get(addrs.Provider{Type: "test"}, AllVersions)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -3,6 +3,7 @@ package providers
import ( import (
"fmt" "fmt"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/plugin/discovery" "github.com/hashicorp/terraform/plugin/discovery"
) )
@ -13,17 +14,17 @@ type Resolver interface {
// Given a constraint map, return a Factory for each requested provider. // 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 // If some or all of the constraints cannot be satisfied, return a non-nil
// slice of errors describing the problems. // 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 // ResolverFunc wraps a callback function and turns it into a Resolver
// implementation, for convenience in situations where a function and its // implementation, for convenience in situations where a function and its
// associated closure are sufficient as a resolver implementation. // 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 // ResolveProviders implements Resolver by calling the
// wrapped function. // 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) 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 // This function is primarily used in tests, to provide mock providers or
// in-process providers under test. // in-process providers under test.
func ResolverFixed(factories map[string]Factory) Resolver { func ResolverFixed(factories map[addrs.Provider]Factory) Resolver {
return ResolverFunc(func(reqd discovery.PluginRequirements) (map[string]Factory, []error) { return ResolverFunc(func(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) {
ret := make(map[string]Factory, len(reqd)) ret := make(map[addrs.Provider]Factory, len(reqd))
var errs []error var errs []error
for name := range reqd { for name := range reqd {
if factory, exists := factories[name]; exists { fqn := addrs.NewLegacyProvider(name)
ret[name] = factory if factory, exists := factories[fqn]; exists {
ret[fqn] = factory
} else { } else {
errs = append(errs, fmt.Errorf("provider %q is not available", name)) errs = append(errs, fmt.Errorf("provider %q is not available", name))
} }

View File

@ -211,8 +211,8 @@ func testSession(t *testing.T, test testSessionTest) {
// Build the TF context // Build the TF context
ctx, diags := terraform.NewContext(&terraform.ContextOpts{ ctx, diags := terraform.NewContext(&terraform.ContextOpts{
State: test.State, State: test.State,
ProviderResolver: providers.ResolverFixed(map[string]providers.Factory{ ProviderResolver: providers.ResolverFixed(map[addrs.Provider]providers.Factory{
"test": providers.FactoryFixed(p), addrs.NewLegacyProvider("test"): providers.FactoryFixed(p),
}), }),
Config: config, Config: config,
}) })

View File

@ -159,7 +159,7 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) {
variables = variables.Override(opts.Variables) variables = variables.Override(opts.Variables)
// Bind available provider plugins to the constraints in config // 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 { if opts.ProviderResolver != nil {
deps := ConfigTreeDependencies(opts.Config, state) deps := ConfigTreeDependencies(opts.Config, state)
reqd := deps.AllPluginRequirements() reqd := deps.AllPluginRequirements()
@ -167,7 +167,6 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) {
reqd.LockExecutables(opts.ProviderSHA256s) reqd.LockExecutables(opts.ProviderSHA256s)
} }
log.Printf("[TRACE] terraform.NewContext: resolving provider version selections") log.Printf("[TRACE] terraform.NewContext: resolving provider version selections")
var providerDiags tfdiags.Diagnostics var providerDiags tfdiags.Diagnostics
providerFactories, providerDiags = resourceProviderFactories(opts.ProviderResolver, reqd) providerFactories, providerDiags = resourceProviderFactories(opts.ProviderResolver, reqd)
diags = diags.Append(providerDiags) diags = diags.Append(providerDiags)
@ -176,7 +175,7 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) {
return nil, diags return nil, diags
} }
} else { } else {
providerFactories = make(map[string]providers.Factory) providerFactories = make(map[addrs.Provider]providers.Factory)
} }
components := &basicComponentFactory{ components := &basicComponentFactory{

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@ package terraform
import ( import (
"fmt" "fmt"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/providers" "github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/provisioners" "github.com/hashicorp/terraform/provisioners"
) )
@ -27,14 +28,14 @@ type contextComponentFactory interface {
// basicComponentFactory just calls a factory from a map directly. // basicComponentFactory just calls a factory from a map directly.
type basicComponentFactory struct { type basicComponentFactory struct {
providers map[string]providers.Factory providers map[addrs.Provider]providers.Factory
provisioners map[string]ProvisionerFactory provisioners map[string]ProvisionerFactory
} }
func (c *basicComponentFactory) ResourceProviders() []string { func (c *basicComponentFactory) ResourceProviders() []string {
result := make([]string, len(c.providers)) result := make([]string, len(c.providers))
for k := range c.providers { for k := range c.providers {
result = append(result, k) result = append(result, k.LegacyString())
} }
return result return result
@ -50,7 +51,7 @@ func (c *basicComponentFactory) ResourceProvisioners() []string {
} }
func (c *basicComponentFactory) ResourceProvider(typ, uid string) (providers.Interface, error) { func (c *basicComponentFactory) ResourceProvider(typ, uid string) (providers.Interface, error) {
f, ok := c.providers[typ] f, ok := c.providers[addrs.NewLegacyProvider(typ)]
if !ok { if !ok {
return nil, fmt.Errorf("unknown provider %q", typ) return nil, fmt.Errorf("unknown provider %q", typ)
} }

View File

@ -3,6 +3,7 @@ package terraform
import ( import (
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers" "github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/provisioners" "github.com/hashicorp/terraform/provisioners"
@ -26,8 +27,8 @@ func simpleMockComponentFactory() *basicComponentFactory {
provider := simpleMockProvider() provider := simpleMockProvider()
provisioner := simpleMockProvisioner() provisioner := simpleMockProvisioner()
return &basicComponentFactory{ return &basicComponentFactory{
providers: map[string]providers.Factory{ providers: map[addrs.Provider]providers.Factory{
"test": func() (providers.Interface, error) { addrs.NewLegacyProvider("test"): func() (providers.Interface, error) {
return provider, nil return provider, nil
}, },
}, },

View File

@ -3,6 +3,7 @@ package terraform
import ( import (
"testing" "testing"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs" "github.com/hashicorp/terraform/configs"
"github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers" "github.com/hashicorp/terraform/providers"
@ -52,8 +53,8 @@ func contextFixtureApplyVars(t *testing.T) *contextTestFixture {
return &contextTestFixture{ return &contextTestFixture{
Config: c, Config: c,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
} }
@ -80,8 +81,8 @@ func contextFixtureApplyVarsEnv(t *testing.T) *contextTestFixture {
return &contextTestFixture{ return &contextTestFixture{
Config: c, Config: c,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
} }

View File

@ -18,8 +18,8 @@ func TestContextImport_basic(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -57,8 +57,8 @@ func TestContextImport_countIndex(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -97,8 +97,8 @@ func TestContextImport_collision(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
@ -164,8 +164,8 @@ func TestContextImport_missingType(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -216,8 +216,8 @@ func TestContextImport_moduleProvider(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -255,8 +255,8 @@ func TestContextImport_providerModule(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -307,8 +307,8 @@ func TestContextImport_providerVarConfig(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -369,8 +369,8 @@ func TestContextImport_providerNonVarConfig(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -404,8 +404,8 @@ func TestContextImport_refresh(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -454,8 +454,8 @@ func TestContextImport_refreshNil(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -501,8 +501,8 @@ func TestContextImport_module(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -542,8 +542,8 @@ func TestContextImport_moduleDepth2(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -583,8 +583,8 @@ func TestContextImport_moduleDiff(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
@ -641,8 +641,8 @@ func TestContextImport_moduleExisting(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
@ -731,8 +731,8 @@ func TestContextImport_multiState(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -801,8 +801,8 @@ func TestContextImport_multiStateSame(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -836,8 +836,8 @@ func TestContextImport_customProviderMissing(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -871,8 +871,8 @@ func TestContextImport_customProvider(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })

View File

@ -43,8 +43,8 @@ func TestContext2Input_provider(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
UIInput: inp, UIInput: inp,
@ -114,8 +114,8 @@ func TestContext2Input_providerMulti(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
UIInput: inp, UIInput: inp,
@ -159,8 +159,8 @@ func TestContext2Input_providerOnce(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -215,8 +215,8 @@ func TestContext2Input_providerId(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
UIInput: input, UIInput: input,
@ -280,8 +280,8 @@ func TestContext2Input_providerOnly(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -336,8 +336,8 @@ func TestContext2Input_providerVars(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -389,8 +389,8 @@ func TestContext2Input_providerVarsModuleInherit(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
UIInput: input, UIInput: input,
@ -421,8 +421,8 @@ func TestContext2Input_submoduleTriggersInvalidCount(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
UIInput: input, UIInput: input,
@ -485,8 +485,8 @@ func TestContext2Input_dataSourceRequiresRefresh(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"null": testProviderFuncFixed(p), addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,

View File

@ -31,8 +31,8 @@ func TestContext2Plan_basic(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
ProviderSHA256s: map[string][]byte{ ProviderSHA256s: map[string][]byte{
@ -117,8 +117,8 @@ func TestContext2Plan_createBefore_deposed(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -209,8 +209,8 @@ func TestContext2Plan_createBefore_maintainRoot(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -249,8 +249,8 @@ func TestContext2Plan_emptyDiff(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -290,8 +290,8 @@ func TestContext2Plan_escapedVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -334,8 +334,8 @@ func TestContext2Plan_minimal(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -375,8 +375,8 @@ func TestContext2Plan_modules(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -450,8 +450,8 @@ func TestContext2Plan_moduleCycle(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -506,8 +506,8 @@ func TestContext2Plan_moduleDeadlock(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -552,8 +552,8 @@ func TestContext2Plan_moduleInput(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -609,8 +609,8 @@ func TestContext2Plan_moduleInputComputed(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -663,8 +663,8 @@ func TestContext2Plan_moduleInputFromVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -734,8 +734,8 @@ func TestContext2Plan_moduleMultiVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -815,8 +815,8 @@ func TestContext2Plan_moduleOrphans(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -918,8 +918,8 @@ func TestContext2Plan_moduleOrphansWithProvisioner(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Provisioners: map[string]ProvisionerFactory{ Provisioners: map[string]ProvisionerFactory{
@ -991,8 +991,8 @@ func TestContext2Plan_moduleProviderInherit(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": func() (providers.Interface, error) { addrs.NewLegacyProvider("aws"): func() (providers.Interface, error) {
l.Lock() l.Lock()
defer l.Unlock() defer l.Unlock()
@ -1057,8 +1057,8 @@ func TestContext2Plan_moduleProviderInheritDeep(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": func() (providers.Interface, error) { addrs.NewLegacyProvider("aws"): func() (providers.Interface, error) {
l.Lock() l.Lock()
defer l.Unlock() defer l.Unlock()
@ -1118,8 +1118,8 @@ func TestContext2Plan_moduleProviderDefaultsVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": func() (providers.Interface, error) { addrs.NewLegacyProvider("aws"): func() (providers.Interface, error) {
l.Lock() l.Lock()
defer l.Unlock() defer l.Unlock()
@ -1203,8 +1203,8 @@ func TestContext2Plan_moduleProviderVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1248,8 +1248,8 @@ func TestContext2Plan_moduleVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1305,8 +1305,8 @@ func TestContext2Plan_moduleVarWrongTypeBasic(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1324,8 +1324,8 @@ func TestContext2Plan_moduleVarWrongTypeNested(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"null": testProviderFuncFixed(p), addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1343,8 +1343,8 @@ func TestContext2Plan_moduleVarWithDefaultValue(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"null": testProviderFuncFixed(p), addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1362,8 +1362,8 @@ func TestContext2Plan_moduleVarComputed(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1415,8 +1415,8 @@ func TestContext2Plan_preventDestroy_bad(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -1454,8 +1454,8 @@ func TestContext2Plan_preventDestroy_good(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -1492,8 +1492,8 @@ func TestContext2Plan_preventDestroy_countBad(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -1547,8 +1547,8 @@ func TestContext2Plan_preventDestroy_countGood(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -1601,8 +1601,8 @@ func TestContext2Plan_preventDestroy_countGoodNoChange(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -1643,8 +1643,8 @@ func TestContext2Plan_preventDestroy_destroyPlan(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -1684,8 +1684,8 @@ func TestContext2Plan_provisionerCycle(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Provisioners: map[string]ProvisionerFactory{ Provisioners: map[string]ProvisionerFactory{
@ -1706,8 +1706,8 @@ func TestContext2Plan_computed(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1781,8 +1781,8 @@ func TestContext2Plan_blockNestingGroup(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1854,8 +1854,8 @@ func TestContext2Plan_computedDataResource(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1923,8 +1923,8 @@ func TestContext2Plan_computedInFunction(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1977,8 +1977,8 @@ func TestContext2Plan_computedDataCountResource(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2009,8 +2009,8 @@ func TestContext2Plan_localValueCount(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2079,8 +2079,8 @@ func TestContext2Plan_dataResourceBecomesComputed(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -2209,8 +2209,8 @@ func TestContext2Plan_computedList(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2321,8 +2321,8 @@ func TestContext2Plan_computedMultiIndex(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2379,8 +2379,8 @@ func TestContext2Plan_count(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2456,8 +2456,8 @@ func TestContext2Plan_countComputed(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2475,8 +2475,8 @@ func TestContext2Plan_countComputedModule(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2497,8 +2497,8 @@ func TestContext2Plan_countModuleStatic(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2550,8 +2550,8 @@ func TestContext2Plan_countModuleStaticGrandchild(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2603,8 +2603,8 @@ func TestContext2Plan_countIndex(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2656,8 +2656,8 @@ func TestContext2Plan_countVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -2742,8 +2742,8 @@ func TestContext2Plan_countZero(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2785,8 +2785,8 @@ func TestContext2Plan_countOneIndex(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -2869,8 +2869,8 @@ func TestContext2Plan_countDecreaseToOne(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -2964,8 +2964,8 @@ func TestContext2Plan_countIncreaseFromNotSet(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -3053,8 +3053,8 @@ func TestContext2Plan_countIncreaseFromOne(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -3157,8 +3157,8 @@ func TestContext2Plan_countIncreaseFromOneCorrupted(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -3295,8 +3295,8 @@ func TestContext2Plan_countIncreaseWithSplatReference(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -3352,8 +3352,8 @@ func TestContext2Plan_forEach(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -3390,8 +3390,8 @@ func TestContext2Plan_forEachUnknownValue(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -3444,8 +3444,8 @@ func TestContext2Plan_destroy(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -3515,8 +3515,8 @@ func TestContext2Plan_moduleDestroy(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -3586,8 +3586,8 @@ func TestContext2Plan_moduleDestroyCycle(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -3656,8 +3656,8 @@ func TestContext2Plan_moduleDestroyMultivar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -3718,8 +3718,8 @@ func TestContext2Plan_pathVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -3782,8 +3782,8 @@ func TestContext2Plan_diffVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -3862,8 +3862,8 @@ func TestContext2Plan_hook(t *testing.T) {
Config: m, Config: m,
Hooks: []Hook{h}, Hooks: []Hook{h},
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -3891,8 +3891,8 @@ func TestContext2Plan_closeProvider(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -3929,8 +3929,8 @@ func TestContext2Plan_orphan(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -3983,8 +3983,8 @@ func TestContext2Plan_shadowUuid(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -4017,8 +4017,8 @@ func TestContext2Plan_state(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -4105,8 +4105,8 @@ func TestContext2Plan_taint(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -4190,8 +4190,8 @@ func TestContext2Plan_taintIgnoreChanges(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -4270,8 +4270,8 @@ func TestContext2Plan_taintDestroyInterpolatedCountRace(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -4324,8 +4324,8 @@ func TestContext2Plan_targeted(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Targets: []addrs.Targetable{ Targets: []addrs.Targetable{
@ -4377,8 +4377,8 @@ func TestContext2Plan_targetedCrossModule(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Targets: []addrs.Targetable{ Targets: []addrs.Targetable{
@ -4444,8 +4444,8 @@ func TestContext2Plan_targetedModuleWithProvider(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"null": testProviderFuncFixed(p), addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
}, },
), ),
Targets: []addrs.Targetable{ Targets: []addrs.Targetable{
@ -4483,8 +4483,8 @@ func TestContext2Plan_targetedOrphan(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -4553,8 +4553,8 @@ func TestContext2Plan_targetedModuleOrphan(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -4621,8 +4621,8 @@ func TestContext2Plan_targetedModuleUntargetedVariable(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Targets: []addrs.Targetable{ Targets: []addrs.Targetable{
@ -4679,8 +4679,8 @@ func TestContext2Plan_outputContainsTargetedResource(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Targets: []addrs.Targetable{ Targets: []addrs.Targetable{
@ -4726,8 +4726,8 @@ func TestContext2Plan_targetedOverTen(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -4778,8 +4778,8 @@ func TestContext2Plan_provider(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -4805,8 +4805,8 @@ func TestContext2Plan_varListErr(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -4843,8 +4843,8 @@ func TestContext2Plan_ignoreChanges(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -4915,8 +4915,8 @@ func TestContext2Plan_ignoreChangesWildcard(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -4985,8 +4985,8 @@ func TestContext2Plan_ignoreChangesInMap(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -5065,8 +5065,8 @@ func TestContext2Plan_moduleMapLiteral(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5112,8 +5112,8 @@ func TestContext2Plan_computedValueInMap(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5171,8 +5171,8 @@ func TestContext2Plan_moduleVariableFromSplat(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5254,8 +5254,8 @@ func TestContext2Plan_createBeforeDestroy_depends_datasource(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5367,8 +5367,8 @@ func TestContext2Plan_listOrder(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5448,8 +5448,8 @@ func TestContext2Plan_ignoreChangesWithFlatmaps(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -5584,8 +5584,8 @@ func TestContext2Plan_resourceNestedCount(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -5666,8 +5666,8 @@ func TestContext2Plan_computedAttrRefTypeMismatch(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5699,8 +5699,8 @@ func TestContext2Plan_selfRef(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5738,8 +5738,8 @@ func TestContext2Plan_selfRefMulti(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5777,8 +5777,8 @@ func TestContext2Plan_selfRefMultiAll(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5818,8 +5818,8 @@ output "out" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5860,8 +5860,8 @@ resource "aws_instance" "foo" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5909,8 +5909,8 @@ resource "aws_instance" "foo" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -5959,8 +5959,8 @@ func TestContext2Plan_requiredModuleOutput(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -6026,8 +6026,8 @@ func TestContext2Plan_requiredModuleObject(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
}) })

View File

@ -45,8 +45,8 @@ func TestContext2Refresh(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: startingState, State: startingState,
@ -132,8 +132,8 @@ func TestContext2Refresh_dynamicAttr(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
State: startingState, State: startingState,
@ -168,8 +168,8 @@ func TestContext2Refresh_dataComputedModuleVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -259,8 +259,8 @@ func TestContext2Refresh_targeted(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -342,8 +342,8 @@ func TestContext2Refresh_targetedCount(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -435,8 +435,8 @@ func TestContext2Refresh_targetedCountIndex(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -504,8 +504,8 @@ func TestContext2Refresh_moduleComputedVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -523,8 +523,8 @@ func TestContext2Refresh_delete(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -566,8 +566,8 @@ func TestContext2Refresh_ignoreUncreated(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: nil, State: nil,
@ -597,8 +597,8 @@ func TestContext2Refresh_hook(t *testing.T) {
Config: m, Config: m,
Hooks: []Hook{h}, Hooks: []Hook{h},
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -663,8 +663,8 @@ func TestContext2Refresh_modules(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,
@ -725,8 +725,8 @@ func TestContext2Refresh_moduleInputComputedOutput(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -743,8 +743,8 @@ func TestContext2Refresh_moduleVarModule(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -761,8 +761,8 @@ func TestContext2Refresh_noState(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -803,8 +803,8 @@ func TestContext2Refresh_output(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -879,8 +879,8 @@ func TestContext2Refresh_outputPartial(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -934,8 +934,8 @@ func TestContext2Refresh_stateBasic(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,
@ -1009,8 +1009,8 @@ func TestContext2Refresh_dataCount(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
Config: m, Config: m,
@ -1055,8 +1055,8 @@ func TestContext2Refresh_dataOrphan(t *testing.T) {
}) })
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"null": testProviderFuncFixed(p), addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,
@ -1105,8 +1105,8 @@ func TestContext2Refresh_dataState(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"null": testProviderFuncFixed(p), addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,
@ -1212,8 +1212,8 @@ func TestContext2Refresh_dataStateRefData(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"null": testProviderFuncFixed(p), addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,
@ -1263,8 +1263,8 @@ func TestContext2Refresh_tainted(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,
@ -1307,7 +1307,7 @@ func TestContext2Refresh_unknownProvider(t *testing.T) {
_, diags := NewContext(&ContextOpts{ _, diags := NewContext(&ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{}, map[addrs.Provider]providers.Factory{},
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
Modules: []*ModuleState{ Modules: []*ModuleState{
@ -1360,8 +1360,8 @@ func TestContext2Refresh_vars(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: MustShimLegacyState(&State{ State: MustShimLegacyState(&State{
@ -1522,8 +1522,8 @@ func TestContext2Refresh_orphanModule(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,
@ -1567,8 +1567,8 @@ func TestContext2Validate(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1630,8 +1630,8 @@ func TestContext2Refresh_noDiffHookOnScaleOut(t *testing.T) {
Config: m, Config: m,
Hooks: []Hook{h}, Hooks: []Hook{h},
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,
@ -1678,8 +1678,8 @@ func TestContext2Refresh_updateProviderInState(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -1746,8 +1746,8 @@ func TestContext2Refresh_schemaUpgradeFlatmap(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -1829,8 +1829,8 @@ func TestContext2Refresh_schemaUpgradeJSON(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -1889,8 +1889,8 @@ data "aws_data_source" "foo" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1952,8 +1952,8 @@ func TestContext2Refresh_dataResourceDependsOn(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
State: s, State: s,
@ -2026,8 +2026,8 @@ resource "aws_instance" "foo" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,

View File

@ -30,8 +30,8 @@ func TestContext2Validate_badCount(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -59,8 +59,8 @@ func TestContext2Validate_badVar(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -90,8 +90,8 @@ func TestContext2Validate_varMapOverrideOld(t *testing.T) {
_, diags := NewContext(&ContextOpts{ _, diags := NewContext(&ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{}, Variables: InputValues{},
@ -142,9 +142,9 @@ func TestContext2Validate_computedVar(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
"test": testProviderFuncFixed(pt), addrs.NewLegacyProvider("test"): testProviderFuncFixed(pt),
}, },
), ),
}) })
@ -191,8 +191,8 @@ func TestContext2Validate_computedInFunction(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -228,8 +228,8 @@ func TestContext2Validate_countComputed(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -254,8 +254,8 @@ func TestContext2Validate_countNegative(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -282,8 +282,8 @@ func TestContext2Validate_countVariable(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -310,8 +310,8 @@ func TestContext2Validate_countVariableNoDefault(t *testing.T) {
_, diags := NewContext(&ContextOpts{ _, diags := NewContext(&ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -337,8 +337,8 @@ func TestContext2Validate_moduleBadOutput(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -365,8 +365,8 @@ func TestContext2Validate_moduleGood(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -391,8 +391,8 @@ func TestContext2Validate_moduleBadResource(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -423,8 +423,8 @@ func TestContext2Validate_moduleDepsShouldNotCycle(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -456,8 +456,8 @@ func TestContext2Validate_moduleProviderVar(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -499,8 +499,8 @@ func TestContext2Validate_moduleProviderInheritUnused(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -547,8 +547,8 @@ func TestContext2Validate_orphans(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,
@ -589,8 +589,8 @@ func TestContext2Validate_providerConfig_bad(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -627,8 +627,8 @@ func TestContext2Validate_providerConfig_badEmpty(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -662,8 +662,8 @@ func TestContext2Validate_providerConfig_good(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -692,8 +692,8 @@ func TestContext2Validate_provisionerConfig_bad(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Provisioners: map[string]ProvisionerFactory{ Provisioners: map[string]ProvisionerFactory{
@ -729,8 +729,8 @@ func TestContext2Validate_badResourceConnection(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Provisioners: map[string]ProvisionerFactory{ Provisioners: map[string]ProvisionerFactory{
@ -763,8 +763,8 @@ func TestContext2Validate_badProvisionerConnection(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Provisioners: map[string]ProvisionerFactory{ Provisioners: map[string]ProvisionerFactory{
@ -811,8 +811,8 @@ func TestContext2Validate_provisionerConfig_good(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Provisioners: map[string]ProvisionerFactory{ Provisioners: map[string]ProvisionerFactory{
@ -842,8 +842,8 @@ func TestContext2Validate_requiredVar(t *testing.T) {
_, diags := NewContext(&ContextOpts{ _, diags := NewContext(&ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -869,8 +869,8 @@ func TestContext2Validate_resourceConfig_bad(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -901,8 +901,8 @@ func TestContext2Validate_resourceConfig_good(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -946,8 +946,8 @@ func TestContext2Validate_tainted(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
State: state, State: state,
@ -989,8 +989,8 @@ func TestContext2Validate_targetedDestroy(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Provisioners: map[string]ProvisionerFactory{ Provisioners: map[string]ProvisionerFactory{
@ -1036,8 +1036,8 @@ func TestContext2Validate_varRefUnknown(t *testing.T) {
c := testContext2(t, &ContextOpts{ c := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
Variables: InputValues{ Variables: InputValues{
@ -1086,8 +1086,8 @@ func TestContext2Validate_interpolateVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"template": testProviderFuncFixed(p), addrs.NewLegacyProvider("template"): testProviderFuncFixed(p),
}, },
), ),
UIInput: input, UIInput: input,
@ -1121,8 +1121,8 @@ func TestContext2Validate_interpolateComputedModuleVarDef(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
UIInput: input, UIInput: input,
@ -1146,8 +1146,8 @@ func TestContext2Validate_interpolateMap(t *testing.T) {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"template": testProviderFuncFixed(p), addrs.NewLegacyProvider("template"): testProviderFuncFixed(p),
}, },
), ),
UIInput: input, UIInput: input,
@ -1226,8 +1226,8 @@ output "out" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1265,8 +1265,8 @@ resource "aws_instance" "foo" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1296,8 +1296,8 @@ output "out" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1329,8 +1329,8 @@ output "out" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1362,8 +1362,8 @@ output "out" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"aws": testProviderFuncFixed(p), addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1394,8 +1394,8 @@ resource "test_instance" "bar" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
}) })
@ -1429,8 +1429,8 @@ resource "test_instance" "bar" {
ctx := testContext2(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Config: m, Config: m,
ProviderResolver: providers.ResolverFixed( ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{ map[addrs.Provider]providers.Factory{
"test": testProviderFuncFixed(p), addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
}, },
), ),
}) })

View File

@ -52,8 +52,8 @@ func TestBuildingEvalContextInitProvider(t *testing.T) {
ctx.ProviderLock = &lock ctx.ProviderLock = &lock
ctx.ProviderCache = make(map[string]providers.Interface) ctx.ProviderCache = make(map[string]providers.Interface)
ctx.Components = &basicComponentFactory{ ctx.Components = &basicComponentFactory{
providers: map[string]providers.Factory{ providers: map[addrs.Provider]providers.Factory{
"test": providers.FactoryFixed(testP), addrs.NewLegacyProvider("test"): providers.FactoryFixed(testP),
}, },
} }

View File

@ -34,9 +34,9 @@ func TestPlanGraphBuilder(t *testing.T) {
}, },
} }
components := &basicComponentFactory{ components := &basicComponentFactory{
providers: map[string]providers.Factory{ providers: map[addrs.Provider]providers.Factory{
"aws": providers.FactoryFixed(awsProvider), addrs.NewLegacyProvider("aws"): providers.FactoryFixed(awsProvider),
"openstack": providers.FactoryFixed(openstackProvider), addrs.NewLegacyProvider("openstack"): providers.FactoryFixed(openstackProvider),
}, },
} }
@ -92,8 +92,8 @@ func TestPlanGraphBuilder_dynamicBlock(t *testing.T) {
}, },
} }
components := &basicComponentFactory{ components := &basicComponentFactory{
providers: map[string]providers.Factory{ providers: map[addrs.Provider]providers.Factory{
"test": providers.FactoryFixed(provider), addrs.NewLegacyProvider("test"): providers.FactoryFixed(provider),
}, },
} }
@ -171,8 +171,8 @@ func TestPlanGraphBuilder_attrAsBlocks(t *testing.T) {
}, },
} }
components := &basicComponentFactory{ components := &basicComponentFactory{
providers: map[string]providers.Factory{ providers: map[addrs.Provider]providers.Factory{
"test": providers.FactoryFixed(provider), addrs.NewLegacyProvider("test"): providers.FactoryFixed(provider),
}, },
} }
@ -258,8 +258,8 @@ func TestPlanGraphBuilder_forEach(t *testing.T) {
} }
components := &basicComponentFactory{ components := &basicComponentFactory{
providers: map[string]providers.Factory{ providers: map[addrs.Provider]providers.Factory{
"aws": providers.FactoryFixed(awsProvider), addrs.NewLegacyProvider("aws"): providers.FactoryFixed(awsProvider),
}, },
} }

View File

@ -3,6 +3,7 @@ package terraform
import ( import (
"fmt" "fmt"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/tfdiags" "github.com/hashicorp/terraform/tfdiags"
"github.com/hashicorp/terraform/plugin/discovery" "github.com/hashicorp/terraform/plugin/discovery"
@ -209,18 +210,18 @@ type ResourceProviderResolver interface {
// Given a constraint map, return a ResourceProviderFactory for each // Given a constraint map, return a ResourceProviderFactory for each
// requested provider. If some or all of the constraints cannot be // requested provider. If some or all of the constraints cannot be
// satisfied, return a non-nil slice of errors describing the problems. // 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 // ResourceProviderResolverFunc wraps a callback function and turns it into
// a ResourceProviderResolver implementation, for convenience in situations // a ResourceProviderResolver implementation, for convenience in situations
// where a function and its associated closure are sufficient as a resolver // where a function and its associated closure are sufficient as a resolver
// implementation. // 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 // ResolveProviders implements ResourceProviderResolver by calling the
// wrapped function. // 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) 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 // This function is primarily used in tests, to provide mock providers or
// in-process providers under test. // in-process providers under test.
func ResourceProviderResolverFixed(factories map[string]ResourceProviderFactory) ResourceProviderResolver { func ResourceProviderResolverFixed(factories map[addrs.Provider]ResourceProviderFactory) ResourceProviderResolver {
return ResourceProviderResolverFunc(func(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) { return ResourceProviderResolverFunc(func(reqd discovery.PluginRequirements) (map[addrs.Provider]ResourceProviderFactory, []error) {
ret := make(map[string]ResourceProviderFactory, len(reqd)) ret := make(map[addrs.Provider]ResourceProviderFactory, len(reqd))
var errs []error var errs []error
for name := range reqd { for name := range reqd {
if factory, exists := factories[name]; exists { // Provider Source Readiness!
ret[name] = factory fqn := addrs.NewLegacyProvider(name)
if factory, exists := factories[fqn]; exists {
ret[fqn] = factory
} else { } else {
errs = append(errs, fmt.Errorf("provider %q is not available", name)) 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 // This should be called only with configurations that have passed calls
// to config.Validate(), which ensures that all of the given version // to config.Validate(), which ensures that all of the given version
// constraints are valid. It will panic if any invalid constraints are present. // 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 var diags tfdiags.Diagnostics
ret, errs := resolver.ResolveProviders(reqd) ret, errs := resolver.ResolveProviders(reqd)
if errs != nil { if errs != nil {

View File

@ -3,6 +3,7 @@ package terraform
import ( import (
"testing" "testing"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers" "github.com/hashicorp/terraform/providers"
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
@ -17,8 +18,8 @@ func TestMockResourceProvider_impl(t *testing.T) {
// a single given. // a single given.
func testProviderComponentFactory(name string, provider providers.Interface) *basicComponentFactory { func testProviderComponentFactory(name string, provider providers.Interface) *basicComponentFactory {
return &basicComponentFactory{ return &basicComponentFactory{
providers: map[string]providers.Factory{ providers: map[addrs.Provider]providers.Factory{
name: providers.FactoryFixed(provider), addrs.NewLegacyProvider(name): providers.FactoryFixed(provider),
}, },
} }
} }

View File

@ -182,7 +182,7 @@ func (c *PackageCommand) Run(args []string) int {
} else { //attempt to get from the public registry if not found locally } else { //attempt to get from the public registry if not found locally
c.ui.Output(fmt.Sprintf("- Checking for provider plugin on %s...", c.ui.Output(fmt.Sprintf("- Checking for provider plugin on %s...",
releaseHost)) releaseHost))
_, _, err := installer.Get(addrs.ProviderType{Type: name}, constraint) _, _, err := installer.Get(addrs.Provider{Type: name}, constraint)
if err != nil { if err != nil {
c.ui.Error(fmt.Sprintf("- Failed to resolve %s provider %s: %s", name, constraint, err)) c.ui.Error(fmt.Sprintf("- Failed to resolve %s provider %s: %s", name, constraint, err))
return 1 return 1