Mildwonkey/terraform tests (targeting integration branch) (#24513)

* configs: remove `Legacy*` Provider functions, switch to default
* terraform context test updates
This commit is contained in:
Kristin Laemmert 2020-03-31 14:03:33 -04:00 committed by Martin Atkins
parent d95667f264
commit e683a6adef
22 changed files with 3085 additions and 4380 deletions

View File

@ -310,10 +310,7 @@ func (c *Config) ResolveAbsProviderAddr(addr addrs.ProviderConfig, inModule addr
if providerReq, exists := c.Module.ProviderRequirements[addr.LocalName]; exists {
provider = providerReq.Type
} else {
// FIXME: For now we're returning a _legacy_ address as fallback here,
// but once we remove legacy addresses this should actually be a
// _default_ provider address.
provider = addrs.NewLegacyProvider(addr.LocalName)
provider = addrs.NewDefaultProvider(addr.LocalName)
}
return addrs.AbsProviderConfig{
@ -330,7 +327,7 @@ func (c *Config) ResolveAbsProviderAddr(addr addrs.ProviderConfig, inModule addr
// ProviderForConfigAddr returns the FQN for a given addrs.ProviderConfig, first
// by checking for the provider in module.ProviderRequirements and falling
// back to addrs.NewLegacyProvider if it is not found.
// back to addrs.NewDefaultProvider if it is not found.
func (c *Config) ProviderForConfigAddr(addr addrs.LocalProviderConfig) addrs.Provider {
if provider, exists := c.Module.ProviderRequirements[addr.LocalName]; exists {
return provider.Type

View File

@ -25,9 +25,9 @@ func TestConfigProviderTypes(t *testing.T) {
got = cfg.ProviderTypes()
want := []addrs.Provider{
addrs.NewLegacyProvider("aws"),
addrs.NewLegacyProvider("null"),
addrs.NewLegacyProvider("template"),
addrs.NewDefaultProvider("aws"),
addrs.NewDefaultProvider("null"),
addrs.NewDefaultProvider("template"),
}
for _, problem := range deep.Equal(got, want) {
t.Error(problem)
@ -50,10 +50,9 @@ func TestConfigProviderTypes_nested(t *testing.T) {
got = cfg.ProviderTypes()
want := []addrs.Provider{
// FIXME: this will be updated to NewDefaultProvider as we remove `Legacy*`
addrs.NewLegacyProvider("test"),
addrs.NewProvider(addrs.DefaultRegistryHost, "bar", "test"),
addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test"),
addrs.NewDefaultProvider("test"),
}
for _, problem := range deep.Equal(got, want) {
@ -85,14 +84,8 @@ func TestConfigResolveAbsProviderAddr(t *testing.T) {
}
got := cfg.ResolveAbsProviderAddr(addr, addrs.RootModule)
want := addrs.AbsProviderConfig{
Module: addrs.RootModule,
// FIXME: At the time of writing we still have LocalProviderConfig
// nested inside AbsProviderConfig, but a future change will
// stop tis embedding and just have an addrs.Provider and an alias
// string here, at which point the correct result will be:
// Provider as the addrs repr of "registry.terraform.io/hashicorp/implied"
// Alias as "boop".
Provider: addrs.NewLegacyProvider("implied"),
Module: addrs.RootModule,
Provider: addrs.NewDefaultProvider("implied"),
Alias: "boop",
}
if got, want := got.String(), want.String(); got != want {
@ -128,13 +121,9 @@ func TestConfigProviderRequirements(t *testing.T) {
svchost.Hostname("tf.example.com"),
"awesomecorp", "happycloud",
)
// FIXME: these two are legacy ones for now because the config loader
// isn't using default configurations fully yet.
// Once that changes, these should be default-shaped ones like tlsProvider
// above.
nullProvider := addrs.NewLegacyProvider("null")
randomProvider := addrs.NewLegacyProvider("random")
impliedProvider := addrs.NewLegacyProvider("implied")
nullProvider := addrs.NewDefaultProvider("null")
randomProvider := addrs.NewDefaultProvider("random")
impliedProvider := addrs.NewDefaultProvider("implied")
got, diags := cfg.ProviderRequirements()
assertNoDiagnostics(t, diags)
@ -152,7 +141,7 @@ func TestConfigProviderRequirements(t *testing.T) {
}
}
func TestProviderForConfigAddr(t *testing.T) {
func TestConfigProviderForConfigAddr(t *testing.T) {
cfg, diags := testModuleConfigFromDir("testdata/valid-modules/providers-fqns")
assertNoDiagnostics(t, diags)
@ -162,9 +151,9 @@ func TestProviderForConfigAddr(t *testing.T) {
t.Errorf("wrong result\ngot: %s\nwant: %s", got, want)
}
// now check a provider that isn't in the configuration. It should return a NewLegacyProvider.
// now check a provider that isn't in the configuration. It should return a DefaultProvider.
got = cfg.ProviderForConfigAddr(addrs.NewDefaultLocalProviderConfig("bar-test"))
want = addrs.NewLegacyProvider("bar-test")
want = addrs.NewDefaultProvider("bar-test")
if !got.Equals(want) {
t.Errorf("wrong result\ngot: %s\nwant: %s", got, want)
}

View File

@ -195,7 +195,7 @@ func (m *Module) appendFile(file *File) hcl.Diagnostics {
}
diags = append(diags, hclDiags...)
} else {
fqn = addrs.NewLegacyProvider(reqd.Name)
fqn = addrs.NewDefaultProvider(reqd.Name)
}
if existing, exists := m.ProviderRequirements[reqd.Name]; exists {
if existing.Type != fqn {
@ -208,8 +208,8 @@ func (m *Module) appendFile(file *File) hcl.Diagnostics {
}
for _, pm := range file.ProviderMetas {
// TODO(paddy): pm.Provider is a string, but we need to build an addrs.Provider out of it somehow
if existing, exists := m.ProviderMetas[addrs.NewLegacyProvider(pm.Provider)]; exists {
provider := m.ProviderForLocalConfig(addrs.LocalProviderConfig{LocalName: pm.Provider})
if existing, exists := m.ProviderMetas[provider]; exists {
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Duplicate provider_meta block",
@ -217,7 +217,7 @@ func (m *Module) appendFile(file *File) hcl.Diagnostics {
Subject: &pm.DeclRange,
})
}
m.ProviderMetas[addrs.NewLegacyProvider(pm.Provider)] = pm
m.ProviderMetas[provider] = pm
}
for _, v := range file.Variables {
@ -282,20 +282,15 @@ func (m *Module) appendFile(file *File) hcl.Diagnostics {
m.ManagedResources[key] = r
// set the provider FQN for the resource
var provider addrs.Provider
if r.ProviderConfigRef != nil {
if existing, exists := m.ProviderRequirements[r.ProviderConfigAddr().LocalName]; exists {
provider = existing.Type
r.Provider = existing.Type
} else {
// FIXME: This will be a NewDefaultProvider
provider = addrs.NewLegacyProvider(r.ProviderConfigAddr().LocalName)
r.Provider = addrs.NewDefaultProvider(r.ProviderConfigAddr().LocalName)
}
r.Provider = provider
continue
}
// FIXME: this will replaced with NewDefaultProvider when provider
// source is fully implemented.
r.Provider = addrs.NewLegacyProvider(r.Addr().ImpliedProvider())
r.Provider = addrs.NewDefaultProvider(r.Addr().ImpliedProvider())
}
for _, r := range file.DataResources {
@ -312,20 +307,16 @@ func (m *Module) appendFile(file *File) hcl.Diagnostics {
m.DataResources[key] = r
// set the provider FQN for the resource
var provider addrs.Provider
if r.ProviderConfigRef != nil {
if existing, exists := m.ProviderRequirements[r.ProviderConfigAddr().LocalName]; exists {
provider = existing.Type
r.Provider = existing.Type
} else {
// FIXME: This will be a NewDefaultProvider
provider = addrs.NewLegacyProvider(r.ProviderConfigAddr().LocalName)
r.Provider = addrs.NewDefaultProvider(r.ProviderConfigAddr().LocalName)
}
r.Provider = provider
continue
}
// FIXME: this will replaced with NewDefaultProvider when provider
// source is fully implemented.
r.Provider = addrs.NewLegacyProvider(r.Addr().ImpliedProvider())
r.Provider = addrs.NewDefaultProvider(r.Addr().ImpliedProvider())
}
return diags
@ -520,5 +511,5 @@ func (m *Module) ProviderForLocalConfig(pc addrs.LocalProviderConfig) addrs.Prov
if provider, exists := m.ProviderRequirements[pc.LocalName]; exists {
return provider.Type
}
return addrs.NewLegacyProvider(pc.LocalName)
return addrs.NewDefaultProvider(pc.LocalName)
}

View File

@ -48,7 +48,7 @@ func mergeProviderVersionConstraints(recv map[string]ProviderRequirements, ovrd
// any errors parsing the source string will have already been captured.
fqn, _ = addrs.ParseProviderSourceString(reqd.Source.SourceStr)
} else {
fqn = addrs.NewLegacyProvider(reqd.Name)
fqn = addrs.NewDefaultProvider(reqd.Name)
}
recv[reqd.Name] = ProviderRequirements{Type: fqn, VersionConstraints: []VersionConstraint{reqd.Requirement}}
}
@ -218,7 +218,7 @@ func (r *Resource) merge(or *Resource, prs map[string]ProviderRequirements) hcl.
if existing, exists := prs[or.ProviderConfigRef.Name]; exists {
r.Provider = existing.Type
} else {
r.Provider = addrs.NewLegacyProvider(r.ProviderConfigRef.Name)
r.Provider = addrs.NewDefaultProvider(r.ProviderConfigRef.Name)
}
}

View File

@ -224,7 +224,7 @@ func TestModuleOverrideResourceFQNs(t *testing.T) {
// now verify that a resource with no provider config falls back to default
got = mod.ManagedResources["test_instance.default"]
wantProvider = addrs.NewLegacyProvider("test")
wantProvider = addrs.NewDefaultProvider("test")
if !got.Provider.Equals(wantProvider) {
t.Fatalf("wrong provider %s, want %s", got.Provider, wantProvider)
}
@ -267,7 +267,7 @@ func TestMergeProviderVersionConstraints(t *testing.T) {
VersionConstraints: []VersionConstraint{},
},
"null": ProviderRequirements{
Type: addrs.NewLegacyProvider("null"),
Type: addrs.NewDefaultProvider("null"),
VersionConstraints: []VersionConstraint{
VersionConstraint{
Required: version.Constraints(nil),
@ -292,7 +292,7 @@ func TestMergeProviderVersionConstraints(t *testing.T) {
},
map[string]ProviderRequirements{
"random": ProviderRequirements{
Type: addrs.NewLegacyProvider("random"),
Type: addrs.NewDefaultProvider("random"),
VersionConstraints: []VersionConstraint{vc2},
},
},

View File

@ -45,7 +45,7 @@ func TestNewModule_resource_providers(t *testing.T) {
// both the root and child module have two resources, one which should use
// the default implied provider and one explicitly using a provider set in
// required_providers
wantImplicit := addrs.NewLegacyProvider("test")
wantImplicit := addrs.NewDefaultProvider("test")
wantFoo := addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test")
wantBar := addrs.NewProvider(addrs.DefaultRegistryHost, "bar", "test")

File diff suppressed because it is too large Load Diff

View File

@ -14,9 +14,9 @@ import (
// to create a base testing scenario. This is used to represent some common
// situations used as the basis for multiple tests.
type contextTestFixture struct {
Config *configs.Config
ProviderResolver providers.Resolver
Provisioners map[string]ProvisionerFactory
Config *configs.Config
Providers map[addrs.Provider]providers.Factory
Provisioners map[string]ProvisionerFactory
}
// ContextOpts returns a ContextOps pre-populated with the elements of this
@ -24,9 +24,9 @@ type contextTestFixture struct {
// _shallow_ modifications to the options as needed.
func (f *contextTestFixture) ContextOpts() *ContextOpts {
return &ContextOpts{
Config: f.Config,
ProviderResolver: f.ProviderResolver,
Provisioners: f.Provisioners,
Config: f.Config,
Providers: f.Providers,
Provisioners: f.Provisioners,
}
}
@ -52,11 +52,9 @@ func contextFixtureApplyVars(t *testing.T) *contextTestFixture {
p.DiffFn = testDiffFn
return &contextTestFixture{
Config: c,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
}
}
@ -80,10 +78,8 @@ func contextFixtureApplyVarsEnv(t *testing.T) *contextTestFixture {
p.DiffFn = testDiffFn
return &contextTestFixture{
Config: c,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
}
}

View File

@ -17,11 +17,9 @@ func TestContextImport_basic(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
@ -57,11 +55,9 @@ func TestContextImport_basic_errpr(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
@ -92,11 +88,9 @@ func TestContextImport_countIndex(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
@ -132,11 +126,9 @@ func TestContextImport_collision(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
State: states.BuildState(func(s *states.SyncState) {
s.SetResourceInstanceCurrent(
@ -152,7 +144,7 @@ func TestContextImport_collision(t *testing.T) {
Status: states.ObjectReady,
},
addrs.AbsProviderConfig{
Provider: addrs.NewLegacyProvider("aws"),
Provider: addrs.NewDefaultProvider("aws"),
Module: addrs.RootModule,
},
)
@ -183,7 +175,7 @@ func TestContextImport_collision(t *testing.T) {
actual := strings.TrimSpace(state.String())
expected := `aws_instance.foo:
ID = bar
provider = provider["registry.terraform.io/-/aws"]`
provider = provider["registry.terraform.io/hashicorp/aws"]`
if actual != expected {
t.Fatalf("bad: \n%s", actual)
@ -202,11 +194,9 @@ func TestContextImport_missingType(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
state, diags := ctx.Import(&ImportOpts{
@ -254,11 +244,9 @@ func TestContextImport_moduleProvider(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
state, diags := ctx.Import(&ImportOpts{
@ -292,11 +280,9 @@ func TestContextImport_providerModule(t *testing.T) {
m := testModule(t, "import-module")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
@ -343,11 +329,9 @@ func TestContextImport_providerVarConfig(t *testing.T) {
m := testModule(t, "import-provider-vars")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
Variables: InputValues{
"foo": &InputValue{
Value: cty.StringVal("bar"),
@ -405,11 +389,9 @@ func TestContextImport_providerNonVarConfig(t *testing.T) {
m := testModule(t, "import-provider-non-vars")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
@ -439,11 +421,9 @@ func TestContextImport_refresh(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
@ -488,11 +468,9 @@ func TestContextImport_refreshNil(t *testing.T) {
m := testModule(t, "import-provider")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
@ -534,11 +512,9 @@ func TestContextImport_module(t *testing.T) {
m := testModule(t, "import-module")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
@ -574,11 +550,9 @@ func TestContextImport_moduleDepth2(t *testing.T) {
m := testModule(t, "import-module")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
@ -614,11 +588,9 @@ func TestContextImport_moduleDiff(t *testing.T) {
m := testModule(t, "import-module")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
p.ImportStateReturn = []*InstanceState{
@ -686,11 +658,9 @@ func TestContextImport_multiState(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
state, diags := ctx.Import(&ImportOpts{
@ -755,11 +725,9 @@ func TestContextImport_multiStateSame(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
state, diags := ctx.Import(&ImportOpts{
@ -786,13 +754,13 @@ func TestContextImport_multiStateSame(t *testing.T) {
const testImportStr = `
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testImportCountIndexStr = `
aws_instance.foo.0:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testImportModuleStr = `
@ -800,7 +768,7 @@ const testImportModuleStr = `
module.child:
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testImportModuleDepth2Str = `
@ -808,7 +776,7 @@ const testImportModuleDepth2Str = `
module.child.nested:
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testImportModuleExistingStr = `
@ -816,36 +784,36 @@ const testImportModuleExistingStr = `
module.foo:
aws_instance.bar:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testImportMultiStr = `
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance_thing.foo:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testImportMultiSameStr = `
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance_thing.foo:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance_thing.foo-1:
ID = qux
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testImportRefreshStr = `
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
`

View File

@ -42,11 +42,9 @@ func TestContext2Input_provider(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
UIInput: inp,
})
@ -113,11 +111,9 @@ func TestContext2Input_providerMulti(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
UIInput: inp,
})
@ -158,11 +154,9 @@ func TestContext2Input_providerOnce(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
})
//count := 0
@ -214,11 +208,9 @@ func TestContext2Input_providerId(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
UIInput: input,
})
@ -279,11 +271,9 @@ func TestContext2Input_providerOnly(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
Variables: InputValues{
"foo": &InputValue{
Value: cty.StringVal("us-west-2"),
@ -335,11 +325,9 @@ func TestContext2Input_providerVars(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
Variables: InputValues{
"foo": &InputValue{
Value: cty.StringVal("bar"),
@ -388,11 +376,9 @@ func TestContext2Input_providerVarsModuleInherit(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
UIInput: input,
})
@ -420,11 +406,9 @@ func TestContext2Input_submoduleTriggersInvalidCount(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
UIInput: input,
})
@ -479,7 +463,7 @@ func TestContext2Input_dataSourceRequiresRefresh(t *testing.T) {
Status: states.ObjectReady,
},
addrs.AbsProviderConfig{
Provider: addrs.NewLegacyProvider("null"),
Provider: addrs.NewDefaultProvider("null"),
Module: addrs.RootModule,
},
)
@ -487,11 +471,9 @@ func TestContext2Input_dataSourceRequiresRefresh(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("null"): testProviderFuncFixed(p),
},
State: state,
UIInput: input,
})

File diff suppressed because it is too large Load Diff

View File

@ -44,11 +44,9 @@ func TestContext2Refresh(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: startingState,
})
@ -132,11 +130,9 @@ func TestContext2Refresh_dynamicAttr(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
State: startingState,
})
@ -168,11 +164,9 @@ func TestContext2Refresh_dataComputedModuleVar(t *testing.T) {
m := testModule(t, "refresh-data-module-var")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
p.ReadResourceFn = nil
@ -259,11 +253,9 @@ func TestContext2Refresh_targeted(t *testing.T) {
m := testModule(t, "refresh-targeted")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: MustShimLegacyState(&State{
Modules: []*ModuleState{
&ModuleState{
@ -342,11 +334,9 @@ func TestContext2Refresh_targetedCount(t *testing.T) {
m := testModule(t, "refresh-targeted-count")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: MustShimLegacyState(&State{
Modules: []*ModuleState{
&ModuleState{
@ -435,11 +425,9 @@ func TestContext2Refresh_targetedCountIndex(t *testing.T) {
m := testModule(t, "refresh-targeted-count")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: MustShimLegacyState(&State{
Modules: []*ModuleState{
&ModuleState{
@ -504,11 +492,9 @@ func TestContext2Refresh_moduleComputedVar(t *testing.T) {
m := testModule(t, "refresh-module-computed-var")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
// This was failing (see GH-2188) at some point, so this test just
@ -523,11 +509,9 @@ func TestContext2Refresh_delete(t *testing.T) {
m := testModule(t, "refresh-basic")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: MustShimLegacyState(&State{
Modules: []*ModuleState{
&ModuleState{
@ -566,11 +550,9 @@ func TestContext2Refresh_ignoreUncreated(t *testing.T) {
m := testModule(t, "refresh-basic")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: nil,
})
@ -597,11 +579,9 @@ func TestContext2Refresh_hook(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
Hooks: []Hook{h},
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: MustShimLegacyState(&State{
Modules: []*ModuleState{
&ModuleState{
@ -663,11 +643,9 @@ func TestContext2Refresh_modules(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: state,
})
@ -725,11 +703,9 @@ func TestContext2Refresh_moduleInputComputedOutput(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
if _, diags := ctx.Refresh(); diags.HasErrors() {
@ -743,11 +719,9 @@ func TestContext2Refresh_moduleVarModule(t *testing.T) {
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
if _, diags := ctx.Refresh(); diags.HasErrors() {
@ -761,11 +735,9 @@ func TestContext2Refresh_noState(t *testing.T) {
m := testModule(t, "refresh-no-state")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
p.ReadResourceFn = nil
@ -803,11 +775,9 @@ func TestContext2Refresh_output(t *testing.T) {
m := testModule(t, "refresh-output")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: MustShimLegacyState(&State{
Modules: []*ModuleState{
&ModuleState{
@ -879,11 +849,9 @@ func TestContext2Refresh_outputPartial(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: MustShimLegacyState(&State{
Modules: []*ModuleState{
&ModuleState{
@ -934,11 +902,9 @@ func TestContext2Refresh_stateBasic(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: state,
})
@ -1009,11 +975,9 @@ func TestContext2Refresh_dataCount(t *testing.T) {
}
ctx := testContext2(t, &ContextOpts{
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
Config: m,
})
@ -1055,11 +1019,9 @@ func TestContext2Refresh_dataOrphan(t *testing.T) {
},
})
ctx := testContext2(t, &ContextOpts{
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
},
State: state,
})
@ -1105,11 +1067,9 @@ func TestContext2Refresh_dataState(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
},
State: state,
})
@ -1212,11 +1172,9 @@ func TestContext2Refresh_dataStateRefData(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("null"): testProviderFuncFixed(p),
},
State: state,
})
@ -1263,11 +1221,9 @@ func TestContext2Refresh_tainted(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: state,
})
p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse {
@ -1306,10 +1262,8 @@ func TestContext2Refresh_unknownProvider(t *testing.T) {
p.DiffFn = testDiffFn
_, diags := NewContext(&ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{},
),
Config: m,
Providers: map[addrs.Provider]providers.Factory{},
State: MustShimLegacyState(&State{
Modules: []*ModuleState{
&ModuleState{
@ -1360,11 +1314,9 @@ func TestContext2Refresh_vars(t *testing.T) {
m := testModule(t, "refresh-vars")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: MustShimLegacyState(&State{
Modules: []*ModuleState{
@ -1522,11 +1474,9 @@ func TestContext2Refresh_orphanModule(t *testing.T) {
})
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: state,
})
@ -1567,11 +1517,9 @@ func TestContext2Validate(t *testing.T) {
m := testModule(t, "validate-good")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -1630,11 +1578,9 @@ func TestContext2Refresh_noDiffHookOnScaleOut(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
Hooks: []Hook{h},
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: state,
})
@ -1678,11 +1624,9 @@ func TestContext2Refresh_updateProviderInState(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: s,
})
@ -1749,11 +1693,9 @@ func TestContext2Refresh_schemaUpgradeFlatmap(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
State: s,
})
@ -1835,11 +1777,9 @@ func TestContext2Refresh_schemaUpgradeJSON(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
State: s,
})
@ -1895,11 +1835,9 @@ data "aws_data_source" "foo" {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
_, diags := ctx.Refresh()
@ -1958,11 +1896,9 @@ func TestContext2Refresh_dataResourceDependsOn(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
State: s,
})
@ -2034,11 +1970,9 @@ resource "aws_instance" "foo" {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: state,
})

View File

@ -29,11 +29,9 @@ func TestContext2Validate_badCount(t *testing.T) {
m := testModule(t, "validate-bad-count")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -58,11 +56,9 @@ func TestContext2Validate_badVar(t *testing.T) {
m := testModule(t, "validate-bad-var")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -89,11 +85,9 @@ func TestContext2Validate_varMapOverrideOld(t *testing.T) {
_, diags := NewContext(&ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
Variables: InputValues{},
})
if !diags.HasErrors() {
@ -141,12 +135,10 @@ func TestContext2Validate_computedVar(t *testing.T) {
m := testModule(t, "validate-computed-var")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
addrs.NewLegacyProvider("test"): testProviderFuncFixed(pt),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
addrs.NewLegacyProvider("test"): testProviderFuncFixed(pt),
},
})
p.ValidateFn = func(c *ResourceConfig) ([]string, []error) {
@ -190,11 +182,9 @@ func TestContext2Validate_computedInFunction(t *testing.T) {
m := testModule(t, "validate-computed-in-function")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -227,11 +217,9 @@ func TestContext2Validate_countComputed(t *testing.T) {
m := testModule(t, "validate-count-computed")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -253,11 +241,9 @@ func TestContext2Validate_countNegative(t *testing.T) {
m := testModule(t, "validate-count-negative")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -281,11 +267,9 @@ func TestContext2Validate_countVariable(t *testing.T) {
m := testModule(t, "apply-count-variable")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -309,11 +293,9 @@ func TestContext2Validate_countVariableNoDefault(t *testing.T) {
_, diags := NewContext(&ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
if !diags.HasErrors() {
// Error should be: The input variable "foo" has not been assigned a value.
@ -336,11 +318,9 @@ func TestContext2Validate_moduleBadOutput(t *testing.T) {
m := testModule(t, "validate-bad-module-output")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -364,11 +344,9 @@ func TestContext2Validate_moduleGood(t *testing.T) {
m := testModule(t, "validate-good-module")
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -390,11 +368,9 @@ func TestContext2Validate_moduleBadResource(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
p.ValidateResourceTypeConfigResponse = providers.ValidateResourceTypeConfigResponse{
@ -422,11 +398,9 @@ func TestContext2Validate_moduleDepsShouldNotCycle(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := ctx.Validate()
@ -455,11 +429,9 @@ func TestContext2Validate_moduleProviderVar(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
Variables: InputValues{
"provider_var": &InputValue{
Value: cty.StringVal("bar"),
@ -498,11 +470,9 @@ func TestContext2Validate_moduleProviderInheritUnused(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
p.ValidateFn = func(c *ResourceConfig) ([]string, []error) {
@ -546,11 +516,9 @@ func TestContext2Validate_orphans(t *testing.T) {
})
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: state,
})
@ -588,11 +556,9 @@ func TestContext2Validate_providerConfig_bad(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
p.PrepareProviderConfigResponse = providers.PrepareProviderConfigResponse{
@ -626,11 +592,9 @@ func TestContext2Validate_providerConfig_badEmpty(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
p.PrepareProviderConfigResponse = providers.PrepareProviderConfigResponse{
@ -661,11 +625,9 @@ func TestContext2Validate_providerConfig_good(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -691,11 +653,9 @@ func TestContext2Validate_provisionerConfig_bad(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
Provisioners: map[string]ProvisionerFactory{
"shell": testProvisionerFuncFixed(pr),
},
@ -728,11 +688,9 @@ func TestContext2Validate_badResourceConnection(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
Provisioners: map[string]ProvisionerFactory{
"shell": testProvisionerFuncFixed(pr),
},
@ -762,11 +720,9 @@ func TestContext2Validate_badProvisionerConnection(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
Provisioners: map[string]ProvisionerFactory{
"shell": testProvisionerFuncFixed(pr),
},
@ -810,11 +766,9 @@ func TestContext2Validate_provisionerConfig_good(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
Provisioners: map[string]ProvisionerFactory{
"shell": testProvisionerFuncFixed(pr),
},
@ -841,11 +795,9 @@ func TestContext2Validate_requiredVar(t *testing.T) {
_, diags := NewContext(&ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
if !diags.HasErrors() {
// Error should be: The input variable "foo" has not been assigned a value.
@ -868,11 +820,9 @@ func TestContext2Validate_resourceConfig_bad(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
p.ValidateResourceTypeConfigResponse = providers.ValidateResourceTypeConfigResponse{
@ -900,11 +850,9 @@ func TestContext2Validate_resourceConfig_good(t *testing.T) {
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := c.Validate()
@ -945,11 +893,9 @@ func TestContext2Validate_tainted(t *testing.T) {
})
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
State: state,
})
@ -988,11 +934,9 @@ func TestContext2Validate_targetedDestroy(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
Provisioners: map[string]ProvisionerFactory{
"shell": testProvisionerFuncFixed(pr),
},
@ -1035,11 +979,9 @@ func TestContext2Validate_varRefUnknown(t *testing.T) {
}
c := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
Variables: InputValues{
"foo": &InputValue{
Value: cty.StringVal("bar"),
@ -1085,11 +1027,9 @@ func TestContext2Validate_interpolateVar(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("template"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("template"): testProviderFuncFixed(p),
},
UIInput: input,
})
@ -1120,11 +1060,9 @@ func TestContext2Validate_interpolateComputedModuleVarDef(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
UIInput: input,
})
@ -1145,11 +1083,9 @@ func TestContext2Validate_interpolateMap(t *testing.T) {
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("template"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("template"): testProviderFuncFixed(p),
},
UIInput: input,
})
@ -1225,11 +1161,9 @@ output "out" {
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := ctx.Validate()
@ -1264,11 +1198,9 @@ resource "aws_instance" "foo" {
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := ctx.Validate()
@ -1295,11 +1227,9 @@ output "out" {
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := ctx.Validate()
@ -1328,11 +1258,9 @@ output "out" {
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := ctx.Validate()
@ -1361,11 +1289,9 @@ output "out" {
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
},
})
diags := ctx.Validate()
@ -1393,11 +1319,9 @@ resource "test_instance" "bar" {
p := testProvider("test")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
})
diags := ctx.Validate()
@ -1428,11 +1352,9 @@ resource "test_instance" "bar" {
p := testProvider("test")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
})
diags := ctx.Validate()
@ -1455,11 +1377,9 @@ func TestContext2Validate_variableCustomValidationsFail(t *testing.T) {
p := testProvider("test")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
})
diags := ctx.Validate()
@ -1500,11 +1420,9 @@ variable "test" {
p := testProvider("test")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
),
Providers: map[addrs.Provider]providers.Factory{
addrs.NewLegacyProvider("test"): testProviderFuncFixed(p),
},
Variables: InputValues{
"test": &InputValue{
Value: cty.UnknownVal(cty.String),

View File

@ -155,7 +155,7 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced invalid object",
fmt.Sprintf(
"Provider %q produced an invalid value after apply for %s. The result cannot not be saved in the Terraform state.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ProviderAddr.Provider.LegacyString(), tfdiags.FormatErrorPrefixed(err, absAddr.String()),
n.ProviderAddr.Provider.String(), tfdiags.FormatErrorPrefixed(err, absAddr.String()),
),
))
}
@ -225,7 +225,7 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
// to notice in the logs if an inconsistency beyond the type system
// leads to a downstream provider failure.
var buf strings.Builder
fmt.Fprintf(&buf, "[WARN] Provider %q produced an unexpected new value for %s, but we are tolerating it because it is using the legacy plugin SDK.\n The following problems may be the cause of any confusing errors from downstream operations:", n.ProviderAddr.Provider.LegacyString(), absAddr)
fmt.Fprintf(&buf, "[WARN] Provider %q produced an unexpected new value for %s, but we are tolerating it because it is using the legacy plugin SDK.\n The following problems may be the cause of any confusing errors from downstream operations:", n.ProviderAddr.Provider.String(), absAddr)
for _, err := range errs {
fmt.Fprintf(&buf, "\n - %s", tfdiags.FormatError(err))
}
@ -245,7 +245,7 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced inconsistent result after apply",
fmt.Sprintf(
"When applying changes to %s, provider %q produced an unexpected new value for %s.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
absAddr, n.ProviderAddr.Provider.LegacyString(), tfdiags.FormatError(err),
absAddr, n.ProviderAddr.Provider.String(), tfdiags.FormatError(err),
),
))
}

View File

@ -135,7 +135,7 @@ func (ctx *BuiltinEvalContext) InitProvider(addr addrs.AbsProviderConfig) (provi
return nil, err
}
log.Printf("[TRACE] BuiltinEvalContext: Initialized %q provider for %s", addr.LegacyString(), addr)
log.Printf("[TRACE] BuiltinEvalContext: Initialized %q provider for %s", addr.String(), addr)
ctx.ProviderCache[key] = p
return p, nil

View File

@ -156,7 +156,7 @@ func (c *MockEvalContext) Input() UIInput {
func (c *MockEvalContext) InitProvider(addr addrs.AbsProviderConfig) (providers.Interface, error) {
c.InitProviderCalled = true
c.InitProviderType = addr.LegacyString()
c.InitProviderType = addr.String()
c.InitProviderAddr = addr
return c.InitProviderProvider, c.InitProviderError
}

View File

@ -65,7 +65,7 @@ func (n *EvalCheckPlannedChange) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced inconsistent final plan",
fmt.Sprintf(
"When expanding the plan for %s to include new values learned so far during apply, provider %q changed the planned action from %s to %s.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
absAddr, n.ProviderAddr.Provider.LegacyString(),
absAddr, n.ProviderAddr.Provider.String(),
plannedChange.Action, actualChange.Action,
),
))
@ -79,7 +79,7 @@ func (n *EvalCheckPlannedChange) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced inconsistent final plan",
fmt.Sprintf(
"When expanding the plan for %s to include new values learned so far during apply, provider %q produced an invalid new value for %s.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
absAddr, n.ProviderAddr.Provider.LegacyString(), tfdiags.FormatError(err),
absAddr, n.ProviderAddr.Provider.String(), tfdiags.FormatError(err),
),
))
}
@ -254,7 +254,7 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced invalid plan",
fmt.Sprintf(
"Provider %q planned an invalid value for %s.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ProviderAddr.Provider.LegacyString(), tfdiags.FormatErrorPrefixed(err, absAddr.String()),
n.ProviderAddr.Provider.String(), tfdiags.FormatErrorPrefixed(err, absAddr.String()),
),
))
}
@ -272,7 +272,7 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
var buf strings.Builder
fmt.Fprintf(&buf,
"[WARN] Provider %q produced an invalid plan for %s, but we are tolerating it because it is using the legacy plugin SDK.\n The following problems may be the cause of any confusing errors from downstream operations:",
n.ProviderAddr.Provider.LegacyString(), absAddr,
n.ProviderAddr.Provider.String(), absAddr,
)
for _, err := range errs {
fmt.Fprintf(&buf, "\n - %s", tfdiags.FormatError(err))
@ -285,7 +285,7 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced invalid plan",
fmt.Sprintf(
"Provider %q planned an invalid value for %s.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ProviderAddr.Provider.LegacyString(), tfdiags.FormatErrorPrefixed(err, absAddr.String()),
n.ProviderAddr.Provider.String(), tfdiags.FormatErrorPrefixed(err, absAddr.String()),
),
))
}
@ -328,7 +328,7 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced invalid plan",
fmt.Sprintf(
"Provider %q has indicated \"requires replacement\" on %s for a non-existent attribute path %#v.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ProviderAddr.Provider.LegacyString(), absAddr, path,
n.ProviderAddr.Provider.String(), absAddr, path,
),
))
continue
@ -425,7 +425,7 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced invalid plan",
fmt.Sprintf(
"Provider %q planned an invalid value for %s%s.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ProviderAddr.Provider.LegacyString(), absAddr, tfdiags.FormatError(err),
n.ProviderAddr.Provider.String(), absAddr, tfdiags.FormatError(err),
),
))
}

View File

@ -87,7 +87,7 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) {
schema, _ := providerSchema.SchemaForResourceAddr(n.Addr.ContainingResource())
if schema == nil {
// Should be caught during validation, so we don't bother with a pretty error here
return nil, fmt.Errorf("provider %q does not support data source %q", n.ProviderAddr.Provider.LegacyString(), n.Addr.Resource.Type)
return nil, fmt.Errorf("provider %q does not support data source %q", n.ProviderAddr.Provider.String(), n.Addr.Resource.Type)
}
// We'll always start by evaluating the configuration. What we do after
@ -248,7 +248,7 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced invalid object",
fmt.Sprintf(
"Provider %q produced an invalid value for %s.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ProviderAddr.Provider.LegacyString(), tfdiags.FormatErrorPrefixed(err, absAddr.String()),
n.ProviderAddr.Provider.String(), tfdiags.FormatErrorPrefixed(err, absAddr.String()),
),
))
}
@ -262,7 +262,7 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced null object",
fmt.Sprintf(
"Provider %q produced a null value for %s.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ProviderAddr.Provider.LegacyString(), absAddr,
n.ProviderAddr.Provider.String(), absAddr,
),
))
}
@ -272,7 +272,7 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced invalid object",
fmt.Sprintf(
"Provider %q produced a value for %s that is not wholly known.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ProviderAddr.Provider.LegacyString(), absAddr,
n.ProviderAddr.Provider.String(), absAddr,
),
))
@ -411,7 +411,7 @@ func (n *EvalReadDataApply) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced invalid object",
fmt.Sprintf(
"Provider %q planned an invalid value for %s. The result could not be saved.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ProviderAddr.Provider.LegacyString(), tfdiags.FormatErrorPrefixed(err, absAddr.String()),
n.ProviderAddr.Provider.String(), tfdiags.FormatErrorPrefixed(err, absAddr.String()),
),
))
}

View File

@ -107,7 +107,7 @@ func (n *EvalRefresh) Eval(ctx EvalContext) (interface{}, error) {
"Provider produced invalid object",
fmt.Sprintf(
"Provider %q planned an invalid value for %s during refresh: %s.\n\nThis is a bug in the provider, which should be reported in the provider's own issue tracker.",
n.ProviderAddr.Provider.LegacyString(), absAddr, tfdiags.FormatError(err),
n.ProviderAddr.Provider.String(), absAddr, tfdiags.FormatError(err),
),
))
}

View File

@ -222,7 +222,7 @@ func (d *evaluationStateData) staticValidateResourceReference(modCfg *configs.Co
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: `Invalid resource type`,
Detail: fmt.Sprintf(`A %s resource type %q is not supported by provider %q.`, modeAdjective, addr.Type, providerFqn.LegacyString()),
Detail: fmt.Sprintf(`A %s resource type %q is not supported by provider %q.`, modeAdjective, addr.Type, providerFqn.String()),
Subject: rng.ToHCL().Ptr(),
})
return diags

View File

@ -305,8 +305,7 @@ func (n *NodeAbstractResource) Provider() addrs.Provider {
if n.Config != nil {
return n.Config.Provider
}
// FIXME: this will be a default provider
return addrs.NewLegacyProvider(n.Addr.Resource.ImpliedProvider())
return addrs.NewDefaultProvider(n.Addr.Resource.ImpliedProvider())
}
// GraphNodeProviderConsumer
@ -340,8 +339,7 @@ func (n *NodeAbstractResourceInstance) Provider() addrs.Provider {
if n.Config != nil {
return n.Config.Provider
}
// FIXME: this will be a default provider
return addrs.NewLegacyProvider(n.Addr.Resource.ContainingResource().ImpliedProvider())
return addrs.NewDefaultProvider(n.Addr.Resource.ContainingResource().ImpliedProvider())
}
// GraphNodeProvisionerConsumer

View File

@ -283,13 +283,13 @@ func (h *HookRecordApplyOrder) PreApply(addr addrs.AbsResourceInstance, gen stat
const testTerraformInputProviderStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
bar = override
foo = us-east-1
type = aws_instance
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
bar = baz
num = 2
type = aws_instance
@ -298,7 +298,7 @@ aws_instance.foo:
const testTerraformInputProviderOnlyStr = `
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = us-west-2
type = aws_instance
`
@ -306,7 +306,7 @@ aws_instance.foo:
const testTerraformInputVarOnlyStr = `
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = us-east-1
type = aws_instance
`
@ -314,7 +314,7 @@ aws_instance.foo:
const testTerraformInputVarOnlyUnsetStr = `
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
bar = baz
foo = foovalue
type = aws_instance
@ -323,13 +323,13 @@ aws_instance.foo:
const testTerraformInputVarsStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
bar = override
foo = us-east-1
type = aws_instance
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
bar = baz
num = 2
type = aws_instance
@ -338,12 +338,12 @@ aws_instance.foo:
const testTerraformApplyStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
`
@ -351,13 +351,13 @@ aws_instance.foo:
const testTerraformApplyDataBasicStr = `
data.null_data_source.testing:
ID = yo
provider = provider["registry.terraform.io/-/null"]
provider = provider["registry.terraform.io/hashicorp/null"]
`
const testTerraformApplyRefCountStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = 3
type = aws_instance
@ -365,24 +365,24 @@ aws_instance.bar:
aws_instance.foo
aws_instance.foo.0:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance.foo.1:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance.foo.2:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testTerraformApplyProviderAliasStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"].bar
provider = provider["registry.terraform.io/hashicorp/aws"].bar
foo = bar
type = aws_instance
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
`
@ -390,10 +390,10 @@ aws_instance.foo:
const testTerraformApplyProviderAliasConfigStr = `
another_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/another"].two
provider = provider["registry.terraform.io/hashicorp/another"].two
another_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/another"]
provider = provider["registry.terraform.io/hashicorp/another"]
`
const testTerraformApplyEmptyModuleStr = `
@ -412,7 +412,7 @@ aws_route53_zone_id = XXXX
const testTerraformApplyDependsCreateBeforeStr = `
aws_instance.lb:
ID = baz
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
instance = foo
type = aws_instance
@ -420,7 +420,7 @@ aws_instance.lb:
aws_instance.web
aws_instance.web:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
require_new = ami-new
type = aws_instance
`
@ -428,7 +428,7 @@ aws_instance.web:
const testTerraformApplyCreateBeforeStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
require_new = xyz
type = aws_instance
`
@ -436,7 +436,7 @@ aws_instance.bar:
const testTerraformApplyCreateBeforeUpdateStr = `
aws_instance.bar:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = baz
type = aws_instance
`
@ -444,14 +444,14 @@ aws_instance.bar:
const testTerraformApplyCancelStr = `
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
value = 2
`
const testTerraformApplyComputeStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = computed_value
type = aws_instance
@ -459,7 +459,7 @@ aws_instance.bar:
aws_instance.foo
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
compute = value
compute_value = 1
num = 2
@ -470,17 +470,17 @@ aws_instance.foo:
const testTerraformApplyCountDecStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.foo.0:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
type = aws_instance
aws_instance.foo.1:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
type = aws_instance
`
@ -488,7 +488,7 @@ aws_instance.foo.1:
const testTerraformApplyCountDecToOneStr = `
aws_instance.foo:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
type = aws_instance
`
@ -496,7 +496,7 @@ aws_instance.foo:
const testTerraformApplyCountDecToOneCorruptedStr = `
aws_instance.foo:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
type = aws_instance
`
@ -514,24 +514,24 @@ STATE:
aws_instance.foo:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
type = aws_instance
aws_instance.foo.0:
ID = baz
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
type = aws_instance
`
const testTerraformApplyCountVariableStr = `
aws_instance.foo.0:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
type = aws_instance
aws_instance.foo.1:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
type = aws_instance
`
@ -539,7 +539,7 @@ aws_instance.foo.1:
const testTerraformApplyCountVariableRefStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = 2
type = aws_instance
@ -547,70 +547,70 @@ aws_instance.bar:
aws_instance.foo
aws_instance.foo.0:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance.foo.1:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testTerraformApplyForEachVariableStr = `
aws_instance.foo["b15c6d616d6143248c575900dff57325eb1de498"]:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
type = aws_instance
aws_instance.foo["c3de47d34b0a9f13918dd705c141d579dd6555fd"]:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
type = aws_instance
aws_instance.foo["e30a7edcc42a846684f2a4eea5f3cd261d33c46d"]:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
type = aws_instance
aws_instance.one["a"]:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance.one["b"]:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance.two["a"]:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
Dependencies:
aws_instance.one
aws_instance.two["b"]:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
Dependencies:
aws_instance.one`
const testTerraformApplyMinimalStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testTerraformApplyModuleStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
module.child:
aws_instance.baz:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
`
@ -618,7 +618,7 @@ module.child:
const testTerraformApplyModuleBoolStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = true
type = aws_instance
@ -636,12 +636,12 @@ const testTerraformApplyModuleDestroyOrderStr = `
const testTerraformApplyMultiProviderStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
do_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/do"]
provider = provider["registry.terraform.io/hashicorp/do"]
num = 2
type = do_instance
`
@ -651,10 +651,10 @@ const testTerraformApplyModuleOnlyProviderStr = `
module.child:
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
test_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/test"]
provider = provider["registry.terraform.io/hashicorp/test"]
`
const testTerraformApplyModuleProviderAliasStr = `
@ -662,19 +662,19 @@ const testTerraformApplyModuleProviderAliasStr = `
module.child:
aws_instance.foo:
ID = foo
provider = module.child.provider["registry.terraform.io/-/aws"].eu
provider = module.child.provider["registry.terraform.io/hashicorp/aws"].eu
`
const testTerraformApplyModuleVarRefExistingStr = `
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
module.child:
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
type = aws_instance
value = bar
@ -696,13 +696,13 @@ const testTerraformApplyOutputOrphanModuleStr = `
const testTerraformApplyProvisionerStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
Dependencies:
aws_instance.foo
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
compute = value
compute_value = 1
num = 2
@ -715,16 +715,16 @@ const testTerraformApplyProvisionerModuleStr = `
module.child:
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testTerraformApplyProvisionerFailStr = `
aws_instance.bar: (tainted)
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
`
@ -732,7 +732,7 @@ aws_instance.foo:
const testTerraformApplyProvisionerFailCreateStr = `
aws_instance.bar: (tainted)
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
`
const testTerraformApplyProvisionerFailCreateNoIdStr = `
@ -742,7 +742,7 @@ const testTerraformApplyProvisionerFailCreateNoIdStr = `
const testTerraformApplyProvisionerFailCreateBeforeDestroyStr = `
aws_instance.bar: (tainted) (1 deposed)
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
require_new = xyz
type = aws_instance
Deposed ID 1 = bar
@ -751,7 +751,7 @@ aws_instance.bar: (tainted) (1 deposed)
const testTerraformApplyProvisionerResourceRefStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
`
@ -759,7 +759,7 @@ aws_instance.bar:
const testTerraformApplyProvisionerSelfRefStr = `
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
`
@ -767,17 +767,17 @@ aws_instance.foo:
const testTerraformApplyProvisionerMultiSelfRefStr = `
aws_instance.foo.0:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = number 0
type = aws_instance
aws_instance.foo.1:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = number 1
type = aws_instance
aws_instance.foo.2:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = number 2
type = aws_instance
`
@ -785,17 +785,17 @@ aws_instance.foo.2:
const testTerraformApplyProvisionerMultiSelfRefSingleStr = `
aws_instance.foo.0:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = number 0
type = aws_instance
aws_instance.foo.1:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = number 1
type = aws_instance
aws_instance.foo.2:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = number 2
type = aws_instance
`
@ -803,7 +803,7 @@ aws_instance.foo.2:
const testTerraformApplyProvisionerDiffStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
`
@ -815,27 +815,27 @@ const testTerraformApplyDestroyStr = `
const testTerraformApplyErrorStr = `
aws_instance.bar: (tainted)
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
Dependencies:
aws_instance.foo
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
value = 2
`
const testTerraformApplyErrorCreateBeforeDestroyStr = `
aws_instance.bar:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
require_new = abc
`
const testTerraformApplyErrorDestroyCreateBeforeDestroyStr = `
aws_instance.bar: (1 deposed)
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
require_new = xyz
type = aws_instance
Deposed ID 1 = bar
@ -844,20 +844,20 @@ aws_instance.bar: (1 deposed)
const testTerraformApplyErrorPartialStr = `
aws_instance.bar:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
Dependencies:
aws_instance.foo
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
value = 2
`
const testTerraformApplyResourceDependsOnModuleStr = `
aws_instance.a:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
ami = parent
type = aws_instance
@ -867,7 +867,7 @@ aws_instance.a:
module.child:
aws_instance.child:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
ami = child
type = aws_instance
`
@ -875,7 +875,7 @@ module.child:
const testTerraformApplyResourceDependsOnModuleDeepStr = `
aws_instance.a:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
ami = parent
type = aws_instance
@ -885,7 +885,7 @@ aws_instance.a:
module.child.grandchild:
aws_instance.c:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
ami = grandchild
type = aws_instance
`
@ -895,7 +895,7 @@ const testTerraformApplyResourceDependsOnModuleInModuleStr = `
module.child:
aws_instance.b:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
ami = child
type = aws_instance
@ -904,7 +904,7 @@ module.child:
module.child.grandchild:
aws_instance.c:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
ami = grandchild
type = aws_instance
`
@ -912,7 +912,7 @@ module.child.grandchild:
const testTerraformApplyTaintStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
`
@ -920,7 +920,7 @@ aws_instance.bar:
const testTerraformApplyTaintDepStr = `
aws_instance.bar:
ID = bar
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
num = 2
type = aws_instance
@ -929,7 +929,7 @@ aws_instance.bar:
aws_instance.foo
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
`
@ -937,7 +937,7 @@ aws_instance.foo:
const testTerraformApplyTaintDepRequireNewStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo
require_new = yes
type = aws_instance
@ -946,7 +946,7 @@ aws_instance.bar:
aws_instance.foo
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
`
@ -954,12 +954,12 @@ aws_instance.foo:
const testTerraformApplyOutputStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
@ -971,12 +971,12 @@ foo_num = 2
const testTerraformApplyOutputAddStr = `
aws_instance.test.0:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo0
type = aws_instance
aws_instance.test.1:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = foo1
type = aws_instance
@ -989,22 +989,22 @@ secondOutput = foo1
const testTerraformApplyOutputListStr = `
aws_instance.bar.0:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.bar.1:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.bar.2:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
@ -1016,22 +1016,22 @@ foo_num = [bar,bar,bar]
const testTerraformApplyOutputMultiStr = `
aws_instance.bar.0:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.bar.1:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.bar.2:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
@ -1043,22 +1043,22 @@ foo_num = bar,bar,bar
const testTerraformApplyOutputMultiIndexStr = `
aws_instance.bar.0:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.bar.1:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.bar.2:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
foo = bar
type = aws_instance
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
num = 2
type = aws_instance
@ -1070,7 +1070,7 @@ foo_num = bar
const testTerraformApplyUnknownAttrStr = `
aws_instance.foo: (tainted)
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
compute = unknown
num = 2
type = aws_instance
@ -1079,13 +1079,13 @@ aws_instance.foo: (tainted)
const testTerraformApplyVarsStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
bar = override
baz = override
foo = us-east-1
aws_instance.foo:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
bar = baz
list.# = 2
list.0 = Hello
@ -1099,7 +1099,7 @@ aws_instance.foo:
const testTerraformApplyVarsEnvStr = `
aws_instance.bar:
ID = foo
provider = provider["registry.terraform.io/-/aws"]
provider = provider["registry.terraform.io/hashicorp/aws"]
list.# = 2
list.0 = Hello
list.1 = World
@ -1294,7 +1294,7 @@ STATE:
const testTerraformInputHCL = `
hcl_instance.hcltest:
ID = foo
provider = provider["registry.terraform.io/-/hcl"]
provider = provider["registry.terraform.io/hashicorp/hcl"]
bar.w = z
bar.x = y
foo.# = 2
@ -1306,10 +1306,10 @@ hcl_instance.hcltest:
const testTerraformRefreshDataRefDataStr = `
data.null_data_source.bar:
ID = foo
provider = provider["registry.terraform.io/-/null"]
provider = provider["registry.terraform.io/hashicorp/null"]
bar = yes
data.null_data_source.foo:
ID = foo
provider = provider["registry.terraform.io/-/null"]
provider = provider["registry.terraform.io/hashicorp/null"]
foo = yes
`