Merge pull request #24346 from hashicorp/jbardin/module-expansion-another-part
Continue pushing the Path calls out of the Resource and Provider types
This commit is contained in:
commit
33464568e8
|
@ -2,6 +2,7 @@ package addrs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/tfdiags"
|
"github.com/hashicorp/terraform/tfdiags"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
|
@ -86,7 +87,7 @@ func (pc LocalProviderConfig) StringCompact() string {
|
||||||
// AbsProviderConfig is the absolute address of a provider configuration
|
// AbsProviderConfig is the absolute address of a provider configuration
|
||||||
// within a particular module instance.
|
// within a particular module instance.
|
||||||
type AbsProviderConfig struct {
|
type AbsProviderConfig struct {
|
||||||
Module ModuleInstance
|
Module Module
|
||||||
Provider Provider
|
Provider Provider
|
||||||
Alias string
|
Alias string
|
||||||
}
|
}
|
||||||
|
@ -101,7 +102,6 @@ var _ ProviderConfig = AbsProviderConfig{}
|
||||||
// provider["registry.terraform.io/hashicorp/aws"].foo
|
// provider["registry.terraform.io/hashicorp/aws"].foo
|
||||||
// module.bar.provider["registry.terraform.io/hashicorp/aws"]
|
// module.bar.provider["registry.terraform.io/hashicorp/aws"]
|
||||||
// module.bar.module.baz.provider["registry.terraform.io/hashicorp/aws"].foo
|
// module.bar.module.baz.provider["registry.terraform.io/hashicorp/aws"].foo
|
||||||
// module.foo[1].provider["registry.terraform.io/hashicorp/aws"].foo
|
|
||||||
//
|
//
|
||||||
// This type of address is used, for example, to record the relationships
|
// This type of address is used, for example, to record the relationships
|
||||||
// between resources and provider configurations in the state structure.
|
// between resources and provider configurations in the state structure.
|
||||||
|
@ -109,9 +109,23 @@ var _ ProviderConfig = AbsProviderConfig{}
|
||||||
// messages that refer to provider configurations.
|
// messages that refer to provider configurations.
|
||||||
func ParseAbsProviderConfig(traversal hcl.Traversal) (AbsProviderConfig, tfdiags.Diagnostics) {
|
func ParseAbsProviderConfig(traversal hcl.Traversal) (AbsProviderConfig, tfdiags.Diagnostics) {
|
||||||
modInst, remain, diags := parseModuleInstancePrefix(traversal)
|
modInst, remain, diags := parseModuleInstancePrefix(traversal)
|
||||||
ret := AbsProviderConfig{
|
var ret AbsProviderConfig
|
||||||
Module: modInst,
|
|
||||||
|
// Providers cannot resolve within module instances, so verify that there
|
||||||
|
// are no instance keys in the module path before converting to a Module.
|
||||||
|
for _, step := range modInst {
|
||||||
|
if step.InstanceKey != NoKey {
|
||||||
|
diags = diags.Append(&hcl.Diagnostic{
|
||||||
|
Severity: hcl.DiagError,
|
||||||
|
Summary: "Invalid provider configuration address",
|
||||||
|
Detail: "Provider address cannot contain module indexes",
|
||||||
|
Subject: remain.SourceRange().Ptr(),
|
||||||
|
})
|
||||||
|
return ret, diags
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
ret.Module = modInst.Module()
|
||||||
|
|
||||||
if len(remain) < 2 || remain.RootName() != "provider" {
|
if len(remain) < 2 || remain.RootName() != "provider" {
|
||||||
diags = diags.Append(&hcl.Diagnostic{
|
diags = diags.Append(&hcl.Diagnostic{
|
||||||
Severity: hcl.DiagError,
|
Severity: hcl.DiagError,
|
||||||
|
@ -223,16 +237,28 @@ func ParseLegacyAbsProviderConfigStr(str string) (AbsProviderConfig, tfdiags.Dia
|
||||||
// provider.aws.foo
|
// provider.aws.foo
|
||||||
// module.bar.provider.aws
|
// module.bar.provider.aws
|
||||||
// module.bar.module.baz.provider.aws.foo
|
// module.bar.module.baz.provider.aws.foo
|
||||||
// module.foo[1].provider.aws.foo
|
|
||||||
//
|
//
|
||||||
// This type of address is used in legacy state and may appear in state v4 if
|
// This type of address is used in legacy state and may appear in state v4 if
|
||||||
// the provider config addresses have not been normalized to include provider
|
// the provider config addresses have not been normalized to include provider
|
||||||
// FQN.
|
// FQN.
|
||||||
func ParseLegacyAbsProviderConfig(traversal hcl.Traversal) (AbsProviderConfig, tfdiags.Diagnostics) {
|
func ParseLegacyAbsProviderConfig(traversal hcl.Traversal) (AbsProviderConfig, tfdiags.Diagnostics) {
|
||||||
modInst, remain, diags := parseModuleInstancePrefix(traversal)
|
modInst, remain, diags := parseModuleInstancePrefix(traversal)
|
||||||
ret := AbsProviderConfig{
|
var ret AbsProviderConfig
|
||||||
Module: modInst,
|
|
||||||
|
// Providers cannot resolve within module instances, so verify that there
|
||||||
|
// are no instance keys in the module path before converting to a Module.
|
||||||
|
for _, step := range modInst {
|
||||||
|
if step.InstanceKey != NoKey {
|
||||||
|
diags = diags.Append(&hcl.Diagnostic{
|
||||||
|
Severity: hcl.DiagError,
|
||||||
|
Summary: "Invalid provider configuration address",
|
||||||
|
Detail: "Provider address cannot contain module indexes",
|
||||||
|
Subject: remain.SourceRange().Ptr(),
|
||||||
|
})
|
||||||
|
return ret, diags
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
ret.Module = modInst.Module()
|
||||||
|
|
||||||
if len(remain) < 2 || remain.RootName() != "provider" {
|
if len(remain) < 2 || remain.RootName() != "provider" {
|
||||||
diags = diags.Append(&hcl.Diagnostic{
|
diags = diags.Append(&hcl.Diagnostic{
|
||||||
|
@ -287,7 +313,7 @@ func ParseLegacyAbsProviderConfig(traversal hcl.Traversal) (AbsProviderConfig, t
|
||||||
// the given type inside the recieving module instance.
|
// the given type inside the recieving module instance.
|
||||||
func (m ModuleInstance) ProviderConfigDefault(provider Provider) AbsProviderConfig {
|
func (m ModuleInstance) ProviderConfigDefault(provider Provider) AbsProviderConfig {
|
||||||
return AbsProviderConfig{
|
return AbsProviderConfig{
|
||||||
Module: m,
|
Module: m.Module(),
|
||||||
Provider: provider,
|
Provider: provider,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,7 +322,7 @@ func (m ModuleInstance) ProviderConfigDefault(provider Provider) AbsProviderConf
|
||||||
// the given type and alias inside the recieving module instance.
|
// the given type and alias inside the recieving module instance.
|
||||||
func (m ModuleInstance) ProviderConfigAliased(provider Provider, alias string) AbsProviderConfig {
|
func (m ModuleInstance) ProviderConfigAliased(provider Provider, alias string) AbsProviderConfig {
|
||||||
return AbsProviderConfig{
|
return AbsProviderConfig{
|
||||||
Module: m,
|
Module: m.Module(),
|
||||||
Provider: provider,
|
Provider: provider,
|
||||||
Alias: alias,
|
Alias: alias,
|
||||||
}
|
}
|
||||||
|
@ -359,16 +385,16 @@ func (pc AbsProviderConfig) LegacyString() string {
|
||||||
// module.module-name.provider["example.com/namespace/name"]
|
// module.module-name.provider["example.com/namespace/name"]
|
||||||
// module.module-name.provider["example.com/namespace/name"].alias
|
// module.module-name.provider["example.com/namespace/name"].alias
|
||||||
func (pc AbsProviderConfig) String() string {
|
func (pc AbsProviderConfig) String() string {
|
||||||
if pc.Alias != "" {
|
var parts []string
|
||||||
if len(pc.Module) == 0 {
|
if len(pc.Module) > 0 {
|
||||||
return fmt.Sprintf("%s[%q].%s", "provider", pc.Provider.String(), pc.Alias)
|
parts = append(parts, pc.Module.String())
|
||||||
} else {
|
|
||||||
return fmt.Sprintf("%s.%s[%q].%s", pc.Module.String(), "provider", pc.Provider.String(), pc.Alias)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(pc.Module) == 0 {
|
|
||||||
return fmt.Sprintf("%s[%q]", "provider", pc.Provider.String())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%s.%s[%q]", pc.Module.String(), "provider", pc.Provider.String())
|
parts = append(parts, fmt.Sprintf("provider[%q]", pc.Provider))
|
||||||
|
|
||||||
|
if pc.Alias != "" {
|
||||||
|
parts = append(parts, pc.Alias)
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(parts, ".")
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
{
|
{
|
||||||
`provider["registry.terraform.io/hashicorp/aws"]`,
|
`provider["registry.terraform.io/hashicorp/aws"]`,
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance,
|
Module: RootModule,
|
||||||
Provider: Provider{
|
Provider: Provider{
|
||||||
Type: "aws",
|
Type: "aws",
|
||||||
Namespace: "hashicorp",
|
Namespace: "hashicorp",
|
||||||
|
@ -30,7 +30,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
{
|
{
|
||||||
`provider["registry.terraform.io/hashicorp/aws"].foo`,
|
`provider["registry.terraform.io/hashicorp/aws"].foo`,
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance,
|
Module: RootModule,
|
||||||
Provider: Provider{
|
Provider: Provider{
|
||||||
Type: "aws",
|
Type: "aws",
|
||||||
Namespace: "hashicorp",
|
Namespace: "hashicorp",
|
||||||
|
@ -43,11 +43,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
{
|
{
|
||||||
`module.baz.provider["registry.terraform.io/hashicorp/aws"]`,
|
`module.baz.provider["registry.terraform.io/hashicorp/aws"]`,
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: ModuleInstance{
|
Module: Module{"baz"},
|
||||||
{
|
|
||||||
Name: "baz",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Provider: Provider{
|
Provider: Provider{
|
||||||
Type: "aws",
|
Type: "aws",
|
||||||
Namespace: "hashicorp",
|
Namespace: "hashicorp",
|
||||||
|
@ -59,11 +55,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
{
|
{
|
||||||
`module.baz.provider["registry.terraform.io/hashicorp/aws"].foo`,
|
`module.baz.provider["registry.terraform.io/hashicorp/aws"].foo`,
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: ModuleInstance{
|
Module: Module{"baz"},
|
||||||
{
|
|
||||||
Name: "baz",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Provider: Provider{
|
Provider: Provider{
|
||||||
Type: "aws",
|
Type: "aws",
|
||||||
Namespace: "hashicorp",
|
Namespace: "hashicorp",
|
||||||
|
@ -75,57 +67,18 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`module.baz["foo"].provider["registry.terraform.io/hashicorp/aws"]`,
|
`module.baz["foo"].provider["registry.terraform.io/hashicorp/aws"]`,
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{},
|
||||||
Module: ModuleInstance{
|
`Provider address cannot contain module indexes`,
|
||||||
{
|
|
||||||
Name: "baz",
|
|
||||||
InstanceKey: StringKey("foo"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Provider: Provider{
|
|
||||||
Type: "aws",
|
|
||||||
Namespace: "hashicorp",
|
|
||||||
Hostname: "registry.terraform.io",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
``,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`module.baz[1].provider["registry.terraform.io/hashicorp/aws"]`,
|
`module.baz[1].provider["registry.terraform.io/hashicorp/aws"]`,
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{},
|
||||||
Module: ModuleInstance{
|
`Provider address cannot contain module indexes`,
|
||||||
{
|
|
||||||
Name: "baz",
|
|
||||||
InstanceKey: IntKey(1),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Provider: Provider{
|
|
||||||
Type: "aws",
|
|
||||||
Namespace: "hashicorp",
|
|
||||||
Hostname: "registry.terraform.io",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
``,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`module.baz[1].module.bar.provider["registry.terraform.io/hashicorp/aws"]`,
|
`module.baz[1].module.bar.provider["registry.terraform.io/hashicorp/aws"]`,
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{},
|
||||||
Module: ModuleInstance{
|
`Provider address cannot contain module indexes`,
|
||||||
{
|
|
||||||
Name: "baz",
|
|
||||||
InstanceKey: IntKey(1),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "bar",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Provider: Provider{
|
|
||||||
Type: "aws",
|
|
||||||
Namespace: "hashicorp",
|
|
||||||
Hostname: "registry.terraform.io",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
``,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`aws`,
|
`aws`,
|
||||||
|
@ -206,21 +159,21 @@ func TestAbsProviderConfigString(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance,
|
Module: RootModule,
|
||||||
Provider: NewLegacyProvider("foo"),
|
Provider: NewLegacyProvider("foo"),
|
||||||
},
|
},
|
||||||
`provider["registry.terraform.io/-/foo"]`,
|
`provider["registry.terraform.io/-/foo"]`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance.Child("child_module", NoKey),
|
Module: RootModule.Child("child_module"),
|
||||||
Provider: NewLegacyProvider("foo"),
|
Provider: NewLegacyProvider("foo"),
|
||||||
},
|
},
|
||||||
`module.child_module.provider["registry.terraform.io/-/foo"]`,
|
`module.child_module.provider["registry.terraform.io/-/foo"]`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance,
|
Module: RootModule,
|
||||||
Alias: "bar",
|
Alias: "bar",
|
||||||
Provider: NewLegacyProvider("foo"),
|
Provider: NewLegacyProvider("foo"),
|
||||||
},
|
},
|
||||||
|
@ -228,7 +181,7 @@ func TestAbsProviderConfigString(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance.Child("child_module", NoKey),
|
Module: RootModule.Child("child_module"),
|
||||||
Alias: "bar",
|
Alias: "bar",
|
||||||
Provider: NewLegacyProvider("foo"),
|
Provider: NewLegacyProvider("foo"),
|
||||||
},
|
},
|
||||||
|
@ -251,21 +204,21 @@ func TestAbsProviderConfigLegacyString(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance,
|
Module: RootModule,
|
||||||
Provider: NewLegacyProvider("foo"),
|
Provider: NewLegacyProvider("foo"),
|
||||||
},
|
},
|
||||||
`provider.foo`,
|
`provider.foo`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance.Child("child_module", NoKey),
|
Module: RootModule.Child("child_module"),
|
||||||
Provider: NewLegacyProvider("foo"),
|
Provider: NewLegacyProvider("foo"),
|
||||||
},
|
},
|
||||||
`module.child_module.provider.foo`,
|
`module.child_module.provider.foo`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance,
|
Module: RootModule,
|
||||||
Alias: "bar",
|
Alias: "bar",
|
||||||
Provider: NewLegacyProvider("foo"),
|
Provider: NewLegacyProvider("foo"),
|
||||||
},
|
},
|
||||||
|
@ -273,7 +226,7 @@ func TestAbsProviderConfigLegacyString(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance.Child("child_module", NoKey),
|
Module: RootModule.Child("child_module"),
|
||||||
Alias: "bar",
|
Alias: "bar",
|
||||||
Provider: NewLegacyProvider("foo"),
|
Provider: NewLegacyProvider("foo"),
|
||||||
},
|
},
|
||||||
|
|
|
@ -217,7 +217,7 @@ func TestLocal_planDeposedOnly(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
|
@ -661,7 +661,7 @@ func testPlanState() *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -688,7 +688,7 @@ func testPlanState_withDataSource() *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
rootModule.SetResourceInstanceCurrent(
|
rootModule.SetResourceInstanceCurrent(
|
||||||
|
@ -705,7 +705,7 @@ func testPlanState_withDataSource() *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -732,7 +732,7 @@ func testPlanState_tainted() *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
|
|
@ -152,7 +152,7 @@ func TestBackendStates(t *testing.T, b Backend) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ func TestApply_destroy(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -127,7 +127,7 @@ func TestApply_destroyLockedState(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -202,7 +202,7 @@ func TestApply_destroyTargeted(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -218,7 +218,7 @@ func TestApply_destroyTargeted(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -835,7 +835,7 @@ func TestApply_refresh(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -992,7 +992,7 @@ func TestApply_state(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1359,7 +1359,7 @@ func TestApply_backup(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1663,7 +1663,7 @@ func applyFixturePlanFile(t *testing.T) string {
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.Create,
|
Action: plans.Create,
|
||||||
|
|
|
@ -273,7 +273,7 @@ func testState() *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
// DeepCopy is used here to ensure our synthetic state matches exactly
|
// DeepCopy is used here to ensure our synthetic state matches exactly
|
||||||
|
|
|
@ -3159,7 +3159,7 @@ func runTestCases(t *testing.T, testCases map[string]testCase) {
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: tc.Action,
|
Action: tc.Action,
|
||||||
|
|
|
@ -245,7 +245,7 @@ func basicState(t *testing.T) *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
rootModule.SetResourceInstanceCurrent(
|
rootModule.SetResourceInstanceCurrent(
|
||||||
|
@ -261,7 +261,7 @@ func basicState(t *testing.T) *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -297,7 +297,7 @@ func stateWithMoreOutputs(t *testing.T) *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -324,7 +324,7 @@ func nestedState(t *testing.T) *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -347,7 +347,7 @@ func deposedState(t *testing.T) *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -376,7 +376,7 @@ func onlyDeposedState(t *testing.T) *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
rootModule.SetResourceInstanceDeposed(
|
rootModule.SetResourceInstanceDeposed(
|
||||||
|
@ -393,7 +393,7 @@ func onlyDeposedState(t *testing.T) *states.State {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
|
|
@ -127,7 +127,7 @@ func TestGraph_plan(t *testing.T) {
|
||||||
},
|
},
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
emptyConfig, err := plans.NewDynamicValue(cty.EmptyObjectVal, cty.EmptyObject)
|
emptyConfig, err := plans.NewDynamicValue(cty.EmptyObjectVal, cty.EmptyObject)
|
||||||
|
|
|
@ -260,7 +260,7 @@ func TestMarshalPlanResources(t *testing.T) {
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: test.Action,
|
Action: test.Action,
|
||||||
|
|
|
@ -203,7 +203,7 @@ func TestMarshalResources(t *testing.T) {
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.AbsProviderConfig{
|
ProviderConfig: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -245,7 +245,7 @@ func TestMarshalResources(t *testing.T) {
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.AbsProviderConfig{
|
ProviderConfig: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -287,7 +287,7 @@ func TestMarshalResources(t *testing.T) {
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.AbsProviderConfig{
|
ProviderConfig: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -331,7 +331,7 @@ func TestMarshalResources(t *testing.T) {
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.AbsProviderConfig{
|
ProviderConfig: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -380,7 +380,7 @@ func TestMarshalResources(t *testing.T) {
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.AbsProviderConfig{
|
ProviderConfig: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -452,7 +452,7 @@ func TestMarshalModules_basic(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -467,7 +467,7 @@ func TestMarshalModules_basic(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: childModule,
|
Module: childModule.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -482,7 +482,7 @@ func TestMarshalModules_basic(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: subModule,
|
Module: subModule.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -521,7 +521,7 @@ func TestMarshalModules_nested(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -536,7 +536,7 @@ func TestMarshalModules_nested(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: childModule,
|
Module: childModule.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -551,7 +551,7 @@ func TestMarshalModules_nested(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: subModule,
|
Module: subModule.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -126,7 +126,7 @@ func TestPlan_destroy(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -245,7 +245,7 @@ func TestPlan_outPathNoChange(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -487,7 +487,7 @@ func showFixturePlanFile(t *testing.T, action plans.Action) string {
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: action,
|
Action: action,
|
||||||
|
|
|
@ -29,7 +29,7 @@ func TestStateMv(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -45,7 +45,7 @@ func TestStateMv(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -160,7 +160,7 @@ func TestStateMv_resourceToInstance(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -176,7 +176,7 @@ func TestStateMv_resourceToInstance(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceMeta(
|
s.SetResourceMeta(
|
||||||
|
@ -188,7 +188,7 @@ func TestStateMv_resourceToInstance(t *testing.T) {
|
||||||
states.EachList,
|
states.EachList,
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -250,7 +250,7 @@ func TestStateMv_instanceToResource(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -265,7 +265,7 @@ func TestStateMv_instanceToResource(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -338,7 +338,7 @@ func TestStateMv_instanceToNewResource(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -409,7 +409,7 @@ func TestStateMv_differentResourceTypes(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -462,7 +462,7 @@ func TestStateMv_explicitWithBackend(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -477,7 +477,7 @@ func TestStateMv_explicitWithBackend(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -537,7 +537,7 @@ func TestStateMv_backupExplicit(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -553,7 +553,7 @@ func TestStateMv_backupExplicit(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -602,7 +602,7 @@ func TestStateMv_stateOutNew(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -656,7 +656,7 @@ func TestStateMv_stateOutExisting(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -675,7 +675,7 @@ func TestStateMv_stateOutExisting(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -755,7 +755,7 @@ func TestStateMv_stateOutNew_count(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -770,7 +770,7 @@ func TestStateMv_stateOutNew_count(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -785,7 +785,7 @@ func TestStateMv_stateOutNew_count(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -843,7 +843,7 @@ func TestStateMv_stateOutNew_largeCount(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -859,7 +859,7 @@ func TestStateMv_stateOutNew_largeCount(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -913,7 +913,7 @@ func TestStateMv_stateOutNew_nestedModule(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -928,7 +928,7 @@ func TestStateMv_stateOutNew_nestedModule(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -983,7 +983,7 @@ func TestStateMv_toNewModule(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1056,7 +1056,7 @@ func TestStateMv_withinBackend(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -1072,7 +1072,7 @@ func TestStateMv_withinBackend(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -27,7 +27,7 @@ func TestStateRm(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -42,7 +42,7 @@ func TestStateRm(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -92,7 +92,7 @@ func TestStateRmNotChildModule(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
// This second instance has the same local address as the first but
|
// This second instance has the same local address as the first but
|
||||||
|
@ -110,7 +110,7 @@ func TestStateRmNotChildModule(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -181,7 +181,7 @@ func TestStateRmNoArgs(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -196,7 +196,7 @@ func TestStateRmNoArgs(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -240,7 +240,7 @@ func TestStateRmNonExist(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -255,7 +255,7 @@ func TestStateRmNonExist(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -300,7 +300,7 @@ func TestStateRm_backupExplicit(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -315,7 +315,7 @@ func TestStateRm_backupExplicit(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -416,7 +416,7 @@ func TestStateRm_backendState(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -431,7 +431,7 @@ func TestStateRm_backendState(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -120,7 +120,7 @@ func (c *StateShowCommand) Run(args []string) int {
|
||||||
absPc := addrs.AbsProviderConfig{
|
absPc := addrs.AbsProviderConfig{
|
||||||
Provider: rs.ProviderConfig.Provider,
|
Provider: rs.ProviderConfig.Provider,
|
||||||
Alias: rs.ProviderConfig.Alias,
|
Alias: rs.ProviderConfig.Alias,
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
}
|
}
|
||||||
singleInstance := states.NewState()
|
singleInstance := states.NewState()
|
||||||
singleInstance.EnsureModule(addr.Module).SetResourceInstanceCurrent(
|
singleInstance.EnsureModule(addr.Module).SetResourceInstanceCurrent(
|
||||||
|
|
|
@ -27,7 +27,7 @@ func TestStateShow(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -85,7 +85,7 @@ func TestStateShow_multi(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -100,7 +100,7 @@ func TestStateShow_multi(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: submod,
|
Module: submod.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -206,7 +206,7 @@ func TestStateShow_configured_provider(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test-beta"),
|
Provider: addrs.NewLegacyProvider("test-beta"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -26,7 +26,7 @@ func TestTaint(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -64,7 +64,7 @@ func TestTaint_lockedState(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -253,7 +253,7 @@ func TestTaint_missing(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -289,7 +289,7 @@ func TestTaint_missingAllow(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -368,7 +368,7 @@ func TestTaint_module(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -383,7 +383,7 @@ func TestTaint_module(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -25,7 +25,7 @@ func TestUntaint(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -68,7 +68,7 @@ func TestUntaint_lockedState(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -279,7 +279,7 @@ func TestUntaint_missing(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -315,7 +315,7 @@ func TestUntaint_missingAllow(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -403,7 +403,7 @@ func TestUntaint_module(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -418,7 +418,7 @@ func TestUntaint_module(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -243,7 +243,7 @@ func TestWorkspace_createWithState(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -222,7 +222,7 @@ func (c *Config) gatherProviderTypes(m map[addrs.Provider]struct{}) {
|
||||||
// The module address to resolve local addresses in must be given in the second
|
// The module address to resolve local addresses in must be given in the second
|
||||||
// argument, and must refer to a module that exists under the receiver or
|
// argument, and must refer to a module that exists under the receiver or
|
||||||
// else this method will panic.
|
// else this method will panic.
|
||||||
func (c *Config) ResolveAbsProviderAddr(addr addrs.ProviderConfig, inModule addrs.ModuleInstance) addrs.AbsProviderConfig {
|
func (c *Config) ResolveAbsProviderAddr(addr addrs.ProviderConfig, inModule addrs.Module) addrs.AbsProviderConfig {
|
||||||
switch addr := addr.(type) {
|
switch addr := addr.(type) {
|
||||||
|
|
||||||
case addrs.AbsProviderConfig:
|
case addrs.AbsProviderConfig:
|
||||||
|
@ -231,7 +231,7 @@ func (c *Config) ResolveAbsProviderAddr(addr addrs.ProviderConfig, inModule addr
|
||||||
case addrs.LocalProviderConfig:
|
case addrs.LocalProviderConfig:
|
||||||
// Find the descendent Config that contains the module that this
|
// Find the descendent Config that contains the module that this
|
||||||
// local config belongs to.
|
// local config belongs to.
|
||||||
mc := c.DescendentForInstance(inModule)
|
mc := c.Descendent(inModule)
|
||||||
if mc == nil {
|
if mc == nil {
|
||||||
panic(fmt.Sprintf("ResolveAbsProviderAddr with non-existent module %s", inModule.String()))
|
panic(fmt.Sprintf("ResolveAbsProviderAddr with non-existent module %s", inModule.String()))
|
||||||
}
|
}
|
||||||
|
@ -265,5 +265,5 @@ func (c *Config) ProviderForConfigAddr(addr addrs.LocalProviderConfig) addrs.Pro
|
||||||
if provider, exists := c.Module.ProviderRequirements[addr.LocalName]; exists {
|
if provider, exists := c.Module.ProviderRequirements[addr.LocalName]; exists {
|
||||||
return provider.Type
|
return provider.Type
|
||||||
}
|
}
|
||||||
return c.ResolveAbsProviderAddr(addr, addrs.RootModuleInstance).Provider
|
return c.ResolveAbsProviderAddr(addr, addrs.RootModule).Provider
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,11 +43,11 @@ func TestConfigResolveAbsProviderAddr(t *testing.T) {
|
||||||
|
|
||||||
t.Run("already absolute", func(t *testing.T) {
|
t.Run("already absolute", func(t *testing.T) {
|
||||||
addr := addrs.AbsProviderConfig{
|
addr := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Alias: "boop",
|
Alias: "boop",
|
||||||
}
|
}
|
||||||
got := cfg.ResolveAbsProviderAddr(addr, addrs.RootModuleInstance)
|
got := cfg.ResolveAbsProviderAddr(addr, addrs.RootModule)
|
||||||
if got, want := got.String(), addr.String(); got != want {
|
if got, want := got.String(), addr.String(); got != want {
|
||||||
t.Errorf("wrong result\ngot: %s\nwant: %s", got, want)
|
t.Errorf("wrong result\ngot: %s\nwant: %s", got, want)
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,9 @@ func TestConfigResolveAbsProviderAddr(t *testing.T) {
|
||||||
LocalName: "implied",
|
LocalName: "implied",
|
||||||
Alias: "boop",
|
Alias: "boop",
|
||||||
}
|
}
|
||||||
got := cfg.ResolveAbsProviderAddr(addr, addrs.RootModuleInstance)
|
got := cfg.ResolveAbsProviderAddr(addr, addrs.RootModule)
|
||||||
want := addrs.AbsProviderConfig{
|
want := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
// FIXME: At the time of writing we still have LocalProviderConfig
|
// FIXME: At the time of writing we still have LocalProviderConfig
|
||||||
// nested inside AbsProviderConfig, but a future change will
|
// nested inside AbsProviderConfig, but a future change will
|
||||||
// stop tis embedding and just have an addrs.Provider and an alias
|
// stop tis embedding and just have an addrs.Provider and an alias
|
||||||
|
@ -78,9 +78,9 @@ func TestConfigResolveAbsProviderAddr(t *testing.T) {
|
||||||
LocalName: "foo-test", // this is explicitly set in the config
|
LocalName: "foo-test", // this is explicitly set in the config
|
||||||
Alias: "boop",
|
Alias: "boop",
|
||||||
}
|
}
|
||||||
got := cfg.ResolveAbsProviderAddr(addr, addrs.RootModuleInstance)
|
got := cfg.ResolveAbsProviderAddr(addr, addrs.RootModule)
|
||||||
want := addrs.AbsProviderConfig{
|
want := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test"),
|
Provider: addrs.NewProvider(addrs.DefaultRegistryHost, "foo", "test"),
|
||||||
Alias: "boop",
|
Alias: "boop",
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
rootModule.SetResourceInstanceCurrent(
|
rootModule.SetResourceInstanceCurrent(
|
||||||
|
@ -59,7 +59,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: childInstance,
|
Module: childInstance.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
childModule.SetResourceInstanceCurrent(
|
childModule.SetResourceInstanceCurrent(
|
||||||
|
@ -102,7 +102,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: childInstance,
|
Module: childInstance.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: childInstance,
|
Module: childInstance.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: childInstance,
|
Module: childInstance.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
childModule.SetResourceInstanceCurrent(
|
childModule.SetResourceInstanceCurrent(
|
||||||
|
@ -161,7 +161,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: childInstance,
|
Module: childInstance.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: childInstance,
|
Module: childInstance.Module(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -729,7 +729,7 @@ func testIDOnlyRefresh(c TestCase, opts terraform.ContextOpts, step TestStep, r
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewDefaultProvider("placeholder"),
|
Provider: addrs.NewDefaultProvider("placeholder"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ func TestProviderAddrs(t *testing.T) {
|
||||||
Name: "woot",
|
Name: "woot",
|
||||||
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -33,7 +33,7 @@ func TestProviderAddrs(t *testing.T) {
|
||||||
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
||||||
DeposedKey: "foodface",
|
DeposedKey: "foodface",
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -44,7 +44,7 @@ func TestProviderAddrs(t *testing.T) {
|
||||||
Name: "what",
|
Name: "what",
|
||||||
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance.Child("foo", addrs.NoKey),
|
Module: addrs.RootModule.Child("foo"),
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -55,11 +55,11 @@ func TestProviderAddrs(t *testing.T) {
|
||||||
got := plan.ProviderAddrs()
|
got := plan.ProviderAddrs()
|
||||||
want := []addrs.AbsProviderConfig{
|
want := []addrs.AbsProviderConfig{
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance.Child("foo", addrs.NoKey),
|
Module: addrs.RootModule.Child("foo"),
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ func TestTFPlanRoundTrip(t *testing.T) {
|
||||||
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewDefaultProvider("test"),
|
Provider: addrs.NewDefaultProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.DeleteThenCreate,
|
Action: plans.DeleteThenCreate,
|
||||||
|
@ -79,7 +79,7 @@ func TestTFPlanRoundTrip(t *testing.T) {
|
||||||
DeposedKey: "foodface",
|
DeposedKey: "foodface",
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewDefaultProvider("test"),
|
Provider: addrs.NewDefaultProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.Delete,
|
Action: plans.Delete,
|
||||||
|
@ -198,7 +198,7 @@ func TestTFPlanRoundTripDestroy(t *testing.T) {
|
||||||
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewDefaultProvider("test"),
|
Provider: addrs.NewDefaultProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.Delete,
|
Action: plans.Delete,
|
||||||
|
|
|
@ -11,24 +11,24 @@ import (
|
||||||
func TestAddressedTypesAbs(t *testing.T) {
|
func TestAddressedTypesAbs(t *testing.T) {
|
||||||
providerAddrs := []addrs.AbsProviderConfig{
|
providerAddrs := []addrs.AbsProviderConfig{
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Alias: "foo",
|
Alias: "foo",
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("azure"),
|
Provider: addrs.NewLegacyProvider("azure"),
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("null"),
|
Provider: addrs.NewLegacyProvider("null"),
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("null"),
|
Provider: addrs.NewLegacyProvider("null"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ func TestSession_basicState(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -62,7 +62,7 @@ func TestSession_basicState(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -37,7 +37,7 @@ func TestState(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewDefaultProvider("test"),
|
Provider: addrs.NewDefaultProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ func TestState(t *testing.T) {
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.AbsProviderConfig{
|
ProviderConfig: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewDefaultProvider("test"),
|
Provider: addrs.NewDefaultProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -144,7 +144,7 @@ func TestStateDeepCopy(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewDefaultProvider("test"),
|
Provider: addrs.NewDefaultProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
rootModule.SetResourceInstanceCurrent(
|
rootModule.SetResourceInstanceCurrent(
|
||||||
|
@ -171,7 +171,7 @@ func TestStateDeepCopy(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewDefaultProvider("test"),
|
Provider: addrs.NewDefaultProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -136,13 +136,13 @@ func upgradeStateV3ToV4(old *stateV3) (*stateV4, error) {
|
||||||
return nil, fmt.Errorf("invalid legacy provider config reference %q for %s: %s", oldProviderAddr, instAddr, diags.Err())
|
return nil, fmt.Errorf("invalid legacy provider config reference %q for %s: %s", oldProviderAddr, instAddr, diags.Err())
|
||||||
}
|
}
|
||||||
providerAddr = addrs.AbsProviderConfig{
|
providerAddr = addrs.AbsProviderConfig{
|
||||||
Module: moduleAddr,
|
Module: moduleAddr.Module(),
|
||||||
Provider: addrs.NewLegacyProvider(localAddr.LocalName),
|
Provider: addrs.NewLegacyProvider(localAddr.LocalName),
|
||||||
Alias: localAddr.Alias,
|
Alias: localAddr.Alias,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
providerAddr = addrs.AbsProviderConfig{
|
providerAddr = addrs.AbsProviderConfig{
|
||||||
Module: moduleAddr,
|
Module: moduleAddr.Module(),
|
||||||
Provider: resAddr.DefaultProvider(),
|
Provider: resAddr.DefaultProvider(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ func TestFullInitialState() *states.State {
|
||||||
}
|
}
|
||||||
providerAddr := addrs.AbsProviderConfig{
|
providerAddr := addrs.AbsProviderConfig{
|
||||||
Provider: rAddr.DefaultProvider(),
|
Provider: rAddr.DefaultProvider(),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
}
|
}
|
||||||
childMod.SetResourceMeta(rAddr, states.EachList, providerAddr)
|
childMod.SetResourceMeta(rAddr, states.EachList, providerAddr)
|
||||||
return state
|
return state
|
||||||
|
|
|
@ -1333,7 +1333,7 @@ func TestContext2Apply_destroyDependsOnStateOnly(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -1358,7 +1358,7 @@ func TestContext2Apply_destroyDependsOnStateOnly(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1431,7 +1431,7 @@ func TestContext2Apply_destroyDependsOnStateOnlyModule(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
child.SetResourceInstanceCurrent(
|
child.SetResourceInstanceCurrent(
|
||||||
|
@ -1456,7 +1456,7 @@ func TestContext2Apply_destroyDependsOnStateOnlyModule(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2828,7 +2828,7 @@ func TestContext2Apply_orphanResource(t *testing.T) {
|
||||||
want := states.BuildState(func(s *states.SyncState) {
|
want := states.BuildState(func(s *states.SyncState) {
|
||||||
providerAddr := addrs.AbsProviderConfig{
|
providerAddr := addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
}
|
}
|
||||||
zeroAddr := addrs.Resource{
|
zeroAddr := addrs.Resource{
|
||||||
Mode: addrs.ManagedResourceMode,
|
Mode: addrs.ManagedResourceMode,
|
||||||
|
@ -7051,7 +7051,7 @@ func TestContext2Apply_errorDestroy(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
@ -7191,7 +7191,7 @@ func TestContext2Apply_errorUpdateNullNew(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
@ -8618,7 +8618,7 @@ func TestContext2Apply_createBefore_depends(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8644,7 +8644,7 @@ func TestContext2Apply_createBefore_depends(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8751,7 +8751,7 @@ func TestContext2Apply_singleDestroy(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8777,7 +8777,7 @@ func TestContext2Apply_singleDestroy(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -9684,7 +9684,7 @@ func TestContext2Apply_destroyWithProviders(t *testing.T) {
|
||||||
state.Modules["module.mod.module.removed"].Resources["aws_instance.child"].ProviderConfig = addrs.AbsProviderConfig{
|
state.Modules["module.mod.module.removed"].Resources["aws_instance.child"].ProviderConfig = addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Alias: "bar",
|
Alias: "bar",
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, diags := ctx.Plan(); diags.HasErrors() {
|
if _, diags := ctx.Plan(); diags.HasErrors() {
|
||||||
|
@ -10108,7 +10108,7 @@ func TestContext2Apply_issue19908(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
@ -10236,7 +10236,7 @@ func TestContext2Apply_moduleReplaceCycle(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10253,7 +10253,7 @@ func TestContext2Apply_moduleReplaceCycle(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10296,7 +10296,7 @@ func TestContext2Apply_moduleReplaceCycle(t *testing.T) {
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance.Child("a", addrs.NoKey)),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance.Child("a", addrs.NoKey)),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: aAction,
|
Action: aAction,
|
||||||
|
@ -10312,7 +10312,7 @@ func TestContext2Apply_moduleReplaceCycle(t *testing.T) {
|
||||||
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance.Child("b", addrs.NoKey)),
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance.Child("b", addrs.NoKey)),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.DeleteThenCreate,
|
Action: plans.DeleteThenCreate,
|
||||||
|
@ -10363,7 +10363,7 @@ func TestContext2Apply_destroyDataCycle(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("null"),
|
Provider: addrs.NewLegacyProvider("null"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -10378,7 +10378,7 @@ func TestContext2Apply_destroyDataCycle(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("null"),
|
Provider: addrs.NewLegacyProvider("null"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10453,7 +10453,7 @@ func TestContext2Apply_taintedDestroyFailure(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -10468,7 +10468,7 @@ func TestContext2Apply_taintedDestroyFailure(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -10483,7 +10483,7 @@ func TestContext2Apply_taintedDestroyFailure(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10660,7 +10660,7 @@ func TestContext2Apply_cbdCycle(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -10685,7 +10685,7 @@ func TestContext2Apply_cbdCycle(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -10700,7 +10700,7 @@ func TestContext2Apply_cbdCycle(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ func TestContextImport_collision(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
@ -606,7 +606,7 @@ func TestContextImport_moduleDiff(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
@ -667,7 +667,7 @@ func TestContextImport_moduleExisting(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -160,7 +160,7 @@ func (c *Context) Input(mode InputMode) tfdiags.Diagnostics {
|
||||||
absConfigAddr := addrs.AbsProviderConfig{
|
absConfigAddr := addrs.AbsProviderConfig{
|
||||||
Provider: providerFqn,
|
Provider: providerFqn,
|
||||||
Alias: pa.Alias,
|
Alias: pa.Alias,
|
||||||
Module: c.Config().Path.UnkeyedInstanceShim(),
|
Module: c.Config().Path,
|
||||||
}
|
}
|
||||||
c.providerInputConfig[absConfigAddr.String()] = vals
|
c.providerInputConfig[absConfigAddr.String()] = vals
|
||||||
|
|
||||||
|
|
|
@ -480,7 +480,7 @@ func TestContext2Input_dataSourceRequiresRefresh(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("null"),
|
Provider: addrs.NewLegacyProvider("null"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -5052,7 +5052,7 @@ func TestContext2Plan_ignoreChangesInMap(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -105,7 +105,7 @@ func TestContext2Refresh_dynamicAttr(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1742,7 +1742,7 @@ func TestContext2Refresh_schemaUpgradeFlatmap(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1828,7 +1828,7 @@ func TestContext2Refresh_schemaUpgradeJSON(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1999,7 +1999,7 @@ func TestRefresh_updateDependencies(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -2014,7 +2014,7 @@ func TestRefresh_updateDependencies(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ func (ctx *BuiltinEvalContext) Input() UIInput {
|
||||||
func (ctx *BuiltinEvalContext) InitProvider(addr addrs.AbsProviderConfig) (providers.Interface, error) {
|
func (ctx *BuiltinEvalContext) InitProvider(addr addrs.AbsProviderConfig) (providers.Interface, error) {
|
||||||
ctx.once.Do(ctx.init)
|
ctx.once.Do(ctx.init)
|
||||||
absAddr := addr
|
absAddr := addr
|
||||||
if !absAddr.Module.Equal(ctx.Path()) {
|
if !absAddr.Module.Equal(ctx.Path().Module()) {
|
||||||
// This indicates incorrect use of InitProvider: it should be used
|
// This indicates incorrect use of InitProvider: it should be used
|
||||||
// only from the module that the provider configuration belongs to.
|
// only from the module that the provider configuration belongs to.
|
||||||
panic(fmt.Sprintf("%s initialized by wrong module %s", absAddr, ctx.Path()))
|
panic(fmt.Sprintf("%s initialized by wrong module %s", absAddr, ctx.Path()))
|
||||||
|
@ -153,7 +153,7 @@ func (ctx *BuiltinEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) *Pro
|
||||||
|
|
||||||
func (ctx *BuiltinEvalContext) CloseProvider(addr addrs.AbsProviderConfig) error {
|
func (ctx *BuiltinEvalContext) CloseProvider(addr addrs.AbsProviderConfig) error {
|
||||||
ctx.once.Do(ctx.init)
|
ctx.once.Do(ctx.init)
|
||||||
if !addr.Module.Equal(ctx.Path()) {
|
if !addr.Module.Equal(ctx.Path().Module()) {
|
||||||
// This indicates incorrect use of CloseProvider: it should be used
|
// This indicates incorrect use of CloseProvider: it should be used
|
||||||
// only from the module that the provider configuration belongs to.
|
// only from the module that the provider configuration belongs to.
|
||||||
panic(fmt.Sprintf("%s closed by wrong module %s", addr, ctx.Path()))
|
panic(fmt.Sprintf("%s closed by wrong module %s", addr, ctx.Path()))
|
||||||
|
@ -175,7 +175,7 @@ func (ctx *BuiltinEvalContext) CloseProvider(addr addrs.AbsProviderConfig) error
|
||||||
func (ctx *BuiltinEvalContext) ConfigureProvider(addr addrs.AbsProviderConfig, cfg cty.Value) tfdiags.Diagnostics {
|
func (ctx *BuiltinEvalContext) ConfigureProvider(addr addrs.AbsProviderConfig, cfg cty.Value) tfdiags.Diagnostics {
|
||||||
var diags tfdiags.Diagnostics
|
var diags tfdiags.Diagnostics
|
||||||
absAddr := addr
|
absAddr := addr
|
||||||
if !absAddr.Module.Equal(ctx.Path()) {
|
if !absAddr.Module.Equal(ctx.Path().Module()) {
|
||||||
// This indicates incorrect use of ConfigureProvider: it should be used
|
// This indicates incorrect use of ConfigureProvider: it should be used
|
||||||
// only from the module that the provider configuration belongs to.
|
// only from the module that the provider configuration belongs to.
|
||||||
panic(fmt.Sprintf("%s configured by wrong module %s", absAddr, ctx.Path()))
|
panic(fmt.Sprintf("%s configured by wrong module %s", absAddr, ctx.Path()))
|
||||||
|
@ -206,7 +206,7 @@ func (ctx *BuiltinEvalContext) ProviderInput(pc addrs.AbsProviderConfig) map[str
|
||||||
ctx.ProviderLock.Lock()
|
ctx.ProviderLock.Lock()
|
||||||
defer ctx.ProviderLock.Unlock()
|
defer ctx.ProviderLock.Unlock()
|
||||||
|
|
||||||
if !pc.Module.Equal(ctx.Path()) {
|
if !pc.Module.Equal(ctx.Path().Module()) {
|
||||||
// This indicates incorrect use of InitProvider: it should be used
|
// This indicates incorrect use of InitProvider: it should be used
|
||||||
// only from the module that the provider configuration belongs to.
|
// only from the module that the provider configuration belongs to.
|
||||||
panic(fmt.Sprintf("%s initialized by wrong module %s", pc, ctx.Path()))
|
panic(fmt.Sprintf("%s initialized by wrong module %s", pc, ctx.Path()))
|
||||||
|
@ -222,7 +222,7 @@ func (ctx *BuiltinEvalContext) ProviderInput(pc addrs.AbsProviderConfig) map[str
|
||||||
|
|
||||||
func (ctx *BuiltinEvalContext) SetProviderInput(pc addrs.AbsProviderConfig, c map[string]cty.Value) {
|
func (ctx *BuiltinEvalContext) SetProviderInput(pc addrs.AbsProviderConfig, c map[string]cty.Value) {
|
||||||
absProvider := pc
|
absProvider := pc
|
||||||
if !absProvider.Module.Equal(ctx.Path()) {
|
if !absProvider.Module.Equal(ctx.Path().Module()) {
|
||||||
// This indicates incorrect use of InitProvider: it should be used
|
// This indicates incorrect use of InitProvider: it should be used
|
||||||
// only from the module that the provider configuration belongs to.
|
// only from the module that the provider configuration belongs to.
|
||||||
panic(fmt.Sprintf("%s initialized by wrong module %s", absProvider, ctx.Path()))
|
panic(fmt.Sprintf("%s initialized by wrong module %s", absProvider, ctx.Path()))
|
||||||
|
|
|
@ -25,11 +25,11 @@ func TestBuiltinEvalContextProviderInput(t *testing.T) {
|
||||||
ctx2.ProviderLock = &lock
|
ctx2.ProviderLock = &lock
|
||||||
|
|
||||||
providerAddr1 := addrs.AbsProviderConfig{
|
providerAddr1 := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("foo"),
|
Provider: addrs.NewLegacyProvider("foo"),
|
||||||
}
|
}
|
||||||
providerAddr2 := addrs.AbsProviderConfig{
|
providerAddr2 := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance.Child("child", addrs.NoKey),
|
Module: addrs.RootModule.Child("child"),
|
||||||
Provider: addrs.NewLegacyProvider("foo"),
|
Provider: addrs.NewLegacyProvider("foo"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ func TestBuildingEvalContextInitProvider(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
providerAddrDefault := addrs.AbsProviderConfig{
|
providerAddrDefault := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
}
|
}
|
||||||
providerAddrAlias := addrs.AbsProviderConfig{
|
providerAddrAlias := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Alias: "foo",
|
Alias: "foo",
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ func TestBuildProviderConfig(t *testing.T) {
|
||||||
"set_in_config": cty.StringVal("config"),
|
"set_in_config": cty.StringVal("config"),
|
||||||
})
|
})
|
||||||
providerAddr := addrs.AbsProviderConfig{
|
providerAddr := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("foo"),
|
Provider: addrs.NewLegacyProvider("foo"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ func TestEvalConfigProvider(t *testing.T) {
|
||||||
provider := mockProviderWithConfigSchema(simpleTestSchema())
|
provider := mockProviderWithConfigSchema(simpleTestSchema())
|
||||||
rp := providers.Interface(provider)
|
rp := providers.Interface(provider)
|
||||||
providerAddr := addrs.AbsProviderConfig{
|
providerAddr := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("foo"),
|
Provider: addrs.NewLegacyProvider("foo"),
|
||||||
}
|
}
|
||||||
n := &EvalConfigProvider{
|
n := &EvalConfigProvider{
|
||||||
|
@ -103,7 +103,7 @@ func TestEvalInitProvider_impl(t *testing.T) {
|
||||||
|
|
||||||
func TestEvalInitProvider(t *testing.T) {
|
func TestEvalInitProvider(t *testing.T) {
|
||||||
providerAddr := addrs.AbsProviderConfig{
|
providerAddr := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("foo"),
|
Provider: addrs.NewLegacyProvider("foo"),
|
||||||
}
|
}
|
||||||
n := &EvalInitProvider{
|
n := &EvalInitProvider{
|
||||||
|
@ -125,7 +125,7 @@ func TestEvalInitProvider(t *testing.T) {
|
||||||
|
|
||||||
func TestEvalCloseProvider(t *testing.T) {
|
func TestEvalCloseProvider(t *testing.T) {
|
||||||
providerAddr := addrs.AbsProviderConfig{
|
providerAddr := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: addrs.NewLegacyProvider("foo"),
|
Provider: addrs.NewLegacyProvider("foo"),
|
||||||
}
|
}
|
||||||
n := &EvalCloseProvider{
|
n := &EvalCloseProvider{
|
||||||
|
|
|
@ -453,6 +453,7 @@ func (n *EvalMaybeRestoreDeposedObject) Eval(ctx EvalContext) (interface{}, erro
|
||||||
// list rather than as not set at all.
|
// list rather than as not set at all.
|
||||||
type EvalWriteResourceState struct {
|
type EvalWriteResourceState struct {
|
||||||
Addr addrs.Resource
|
Addr addrs.Resource
|
||||||
|
Module addrs.Module
|
||||||
Config *configs.Resource
|
Config *configs.Resource
|
||||||
ProviderAddr addrs.AbsProviderConfig
|
ProviderAddr addrs.AbsProviderConfig
|
||||||
}
|
}
|
||||||
|
@ -460,7 +461,6 @@ type EvalWriteResourceState struct {
|
||||||
// TODO: test
|
// TODO: test
|
||||||
func (n *EvalWriteResourceState) Eval(ctx EvalContext) (interface{}, error) {
|
func (n *EvalWriteResourceState) Eval(ctx EvalContext) (interface{}, error) {
|
||||||
var diags tfdiags.Diagnostics
|
var diags tfdiags.Diagnostics
|
||||||
absAddr := n.Addr.Absolute(ctx.Path())
|
|
||||||
state := ctx.State()
|
state := ctx.State()
|
||||||
|
|
||||||
count, countDiags := evaluateResourceCountExpression(n.Config.Count, ctx)
|
count, countDiags := evaluateResourceCountExpression(n.Config.Count, ctx)
|
||||||
|
@ -484,16 +484,16 @@ func (n *EvalWriteResourceState) Eval(ctx EvalContext) (interface{}, error) {
|
||||||
eachMode = states.EachMap
|
eachMode = states.EachMap
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method takes care of all of the business logic of updating this
|
|
||||||
// while ensuring that any existing instances are preserved, etc.
|
|
||||||
state.SetResourceMeta(absAddr, eachMode, n.ProviderAddr)
|
|
||||||
|
|
||||||
// We'll record our expansion decision in the shared "expander" object
|
// We'll record our expansion decision in the shared "expander" object
|
||||||
// so that later operations (i.e. DynamicExpand and expression evaluation)
|
// so that later operations (i.e. DynamicExpand and expression evaluation)
|
||||||
// can refer to it. Since this node represents the abstract module, we need
|
// can refer to it. Since this node represents the abstract module, we need
|
||||||
// to expand the module here to create all resources.
|
// to expand the module here to create all resources.
|
||||||
expander := ctx.InstanceExpander()
|
expander := ctx.InstanceExpander()
|
||||||
for _, module := range expander.ExpandModule(ctx.Path().Module()) {
|
for _, module := range expander.ExpandModule(n.Module) {
|
||||||
|
// This method takes care of all of the business logic of updating this
|
||||||
|
// while ensuring that any existing instances are preserved, etc.
|
||||||
|
state.SetResourceMeta(n.Addr.Absolute(module), eachMode, n.ProviderAddr)
|
||||||
|
|
||||||
switch eachMode {
|
switch eachMode {
|
||||||
case states.EachList:
|
case states.EachList:
|
||||||
expander.SetResourceCount(module, n.Addr, count)
|
expander.SetResourceCount(module, n.Addr, count)
|
||||||
|
|
|
@ -554,7 +554,7 @@ func TestApplyGraphBuilder_updateFromOrphan(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -579,7 +579,7 @@ func TestApplyGraphBuilder_updateFromOrphan(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("test"),
|
Provider: addrs.NewLegacyProvider("test"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package terraform
|
package terraform
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/hashicorp/terraform/addrs"
|
||||||
"github.com/hashicorp/terraform/dag"
|
"github.com/hashicorp/terraform/dag"
|
||||||
"github.com/hashicorp/terraform/plans"
|
"github.com/hashicorp/terraform/plans"
|
||||||
"github.com/hashicorp/terraform/providers"
|
"github.com/hashicorp/terraform/providers"
|
||||||
|
@ -15,7 +16,6 @@ type NodeRefreshableDataResource struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ GraphNodeModuleInstance = (*NodeRefreshableDataResource)(nil)
|
|
||||||
_ GraphNodeDynamicExpandable = (*NodeRefreshableDataResource)(nil)
|
_ GraphNodeDynamicExpandable = (*NodeRefreshableDataResource)(nil)
|
||||||
_ GraphNodeReferenceable = (*NodeRefreshableDataResource)(nil)
|
_ GraphNodeReferenceable = (*NodeRefreshableDataResource)(nil)
|
||||||
_ GraphNodeReferencer = (*NodeRefreshableDataResource)(nil)
|
_ GraphNodeReferencer = (*NodeRefreshableDataResource)(nil)
|
||||||
|
@ -54,18 +54,22 @@ func (n *NodeRefreshableDataResource) DynamicExpand(ctx EvalContext) (*Graph, er
|
||||||
// if we're transitioning whether "count" is set at all.
|
// if we're transitioning whether "count" is set at all.
|
||||||
fixResourceCountSetTransition(ctx, n.ResourceAddr(), count != -1)
|
fixResourceCountSetTransition(ctx, n.ResourceAddr(), count != -1)
|
||||||
|
|
||||||
|
var instanceAddrs []addrs.AbsResourceInstance
|
||||||
|
|
||||||
// Inform our instance expander about our expansion results above,
|
// Inform our instance expander about our expansion results above,
|
||||||
// and then use it to calculate the instance addresses we'll expand for.
|
// and then use it to calculate the instance addresses we'll expand for.
|
||||||
expander := ctx.InstanceExpander()
|
expander := ctx.InstanceExpander()
|
||||||
|
for _, path := range expander.ExpandModule(n.Module) {
|
||||||
switch {
|
switch {
|
||||||
case count >= 0:
|
case count >= 0:
|
||||||
expander.SetResourceCount(ctx.Path(), n.ResourceAddr().Resource, count)
|
expander.SetResourceCount(path, n.ResourceAddr().Resource, count)
|
||||||
case forEachMap != nil:
|
case forEachMap != nil:
|
||||||
expander.SetResourceForEach(ctx.Path(), n.ResourceAddr().Resource, forEachMap)
|
expander.SetResourceForEach(path, n.ResourceAddr().Resource, forEachMap)
|
||||||
default:
|
default:
|
||||||
expander.SetResourceSingle(ctx.Path(), n.ResourceAddr().Resource)
|
expander.SetResourceSingle(path, n.ResourceAddr().Resource)
|
||||||
|
}
|
||||||
|
instanceAddrs = append(instanceAddrs, expander.ExpandResource(path.Module(), n.ResourceAddr().Resource)...)
|
||||||
}
|
}
|
||||||
instanceAddrs := expander.ExpandResource(ctx.Path().Module(), n.ResourceAddr().Resource)
|
|
||||||
|
|
||||||
// Our graph transformers require access to the full state, so we'll
|
// Our graph transformers require access to the full state, so we'll
|
||||||
// temporarily lock it while we work on this.
|
// temporarily lock it while we work on this.
|
||||||
|
@ -135,7 +139,7 @@ func (n *NodeRefreshableDataResource) DynamicExpand(ctx EvalContext) (*Graph, er
|
||||||
Name: "NodeRefreshableDataResource",
|
Name: "NodeRefreshableDataResource",
|
||||||
}
|
}
|
||||||
|
|
||||||
graph, diags := b.Build(ctx.Path())
|
graph, diags := b.Build(nil)
|
||||||
return graph, diags.ErrWithWarnings()
|
return graph, diags.ErrWithWarnings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ func TestNodeRefreshableDataResourceDynamicExpand_scaleIn(t *testing.T) {
|
||||||
Config: m.Module.DataResources["data.aws_instance.foo"],
|
Config: m.Module.DataResources["data.aws_instance.foo"],
|
||||||
ResolvedProvider: addrs.AbsProviderConfig{
|
ResolvedProvider: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ type NodeAbstractProvider struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ GraphNodeModuleInstance = (*NodeAbstractProvider)(nil)
|
_ GraphNodeModulePath = (*NodeAbstractProvider)(nil)
|
||||||
_ RemovableIfNotTargeted = (*NodeAbstractProvider)(nil)
|
_ RemovableIfNotTargeted = (*NodeAbstractProvider)(nil)
|
||||||
_ GraphNodeReferencer = (*NodeAbstractProvider)(nil)
|
_ GraphNodeReferencer = (*NodeAbstractProvider)(nil)
|
||||||
_ GraphNodeProvider = (*NodeAbstractProvider)(nil)
|
_ GraphNodeProvider = (*NodeAbstractProvider)(nil)
|
||||||
|
@ -41,12 +41,12 @@ func (n *NodeAbstractProvider) Name() string {
|
||||||
|
|
||||||
// GraphNodeModuleInstance
|
// GraphNodeModuleInstance
|
||||||
func (n *NodeAbstractProvider) Path() addrs.ModuleInstance {
|
func (n *NodeAbstractProvider) Path() addrs.ModuleInstance {
|
||||||
return n.Addr.Module
|
return n.Addr.Module.UnkeyedInstanceShim()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeModulePath
|
// GraphNodeModulePath
|
||||||
func (n *NodeAbstractProvider) ModulePath() addrs.Module {
|
func (n *NodeAbstractProvider) ModulePath() addrs.Module {
|
||||||
return n.Addr.Module.Module()
|
return n.Addr.Module
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemovableIfNotTargeted
|
// RemovableIfNotTargeted
|
||||||
|
|
|
@ -99,6 +99,7 @@ func NewNodeAbstractResource(addr addrs.AbsResource) *NodeAbstractResource {
|
||||||
// the "count" or "for_each" arguments.
|
// the "count" or "for_each" arguments.
|
||||||
type NodeAbstractResourceInstance struct {
|
type NodeAbstractResourceInstance struct {
|
||||||
NodeAbstractResource
|
NodeAbstractResource
|
||||||
|
ModuleInstance addrs.ModuleInstance
|
||||||
InstanceKey addrs.InstanceKey
|
InstanceKey addrs.InstanceKey
|
||||||
|
|
||||||
// The fields below will be automatically set using the Attach
|
// The fields below will be automatically set using the Attach
|
||||||
|
@ -138,6 +139,7 @@ func NewNodeAbstractResourceInstance(addr addrs.AbsResourceInstance) *NodeAbstra
|
||||||
Addr: addr.Resource.Resource,
|
Addr: addr.Resource.Resource,
|
||||||
Module: addr.Module.Module(),
|
Module: addr.Module.Module(),
|
||||||
},
|
},
|
||||||
|
ModuleInstance: addr.Module,
|
||||||
InstanceKey: addr.Resource.Key,
|
InstanceKey: addr.Resource.Key,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,6 +157,10 @@ func (n *NodeAbstractResource) Path() addrs.ModuleInstance {
|
||||||
return n.Module.UnkeyedInstanceShim()
|
return n.Module.UnkeyedInstanceShim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *NodeAbstractResourceInstance) Path() addrs.ModuleInstance {
|
||||||
|
return n.ModuleInstance
|
||||||
|
}
|
||||||
|
|
||||||
// GraphNodeModulePath
|
// GraphNodeModulePath
|
||||||
func (n *NodeAbstractResource) ModulePath() addrs.Module {
|
func (n *NodeAbstractResource) ModulePath() addrs.Module {
|
||||||
return n.Module
|
return n.Module
|
||||||
|
|
|
@ -53,19 +53,16 @@ func (n *NodeApplyableResource) References() []*addrs.Reference {
|
||||||
|
|
||||||
// GraphNodeEvalable
|
// GraphNodeEvalable
|
||||||
func (n *NodeApplyableResource) EvalTree() EvalNode {
|
func (n *NodeApplyableResource) EvalTree() EvalNode {
|
||||||
addr := n.ResourceAddr()
|
if n.Config == nil {
|
||||||
config := n.Config
|
|
||||||
providerAddr := n.ResolvedProvider
|
|
||||||
|
|
||||||
if config == nil {
|
|
||||||
// Nothing to do, then.
|
// Nothing to do, then.
|
||||||
log.Printf("[TRACE] NodeApplyableResource: no configuration present for %s", addr)
|
log.Printf("[TRACE] NodeApplyableResource: no configuration present for %s", n.Name())
|
||||||
return &EvalNoop{}
|
return &EvalNoop{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &EvalWriteResourceState{
|
return &EvalWriteResourceState{
|
||||||
Addr: addr.Resource,
|
Addr: n.Addr,
|
||||||
Config: config,
|
Module: n.Module,
|
||||||
ProviderAddr: providerAddr,
|
Config: n.Config,
|
||||||
|
ProviderAddr: n.ResolvedProvider,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,6 +288,7 @@ func (n *NodeDestroyResourceInstance) EvalTree() EvalNode {
|
||||||
// all been destroyed.
|
// all been destroyed.
|
||||||
type NodeDestroyResource struct {
|
type NodeDestroyResource struct {
|
||||||
*NodeAbstractResource
|
*NodeAbstractResource
|
||||||
|
Addr addrs.AbsResource
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -342,11 +343,6 @@ func (n *NodeDestroyResource) ResourceAddr() addrs.AbsResource {
|
||||||
return n.NodeAbstractResource.ResourceAddr()
|
return n.NodeAbstractResource.ResourceAddr()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeSubpath
|
|
||||||
func (n *NodeDestroyResource) Path() addrs.ModuleInstance {
|
|
||||||
return n.NodeAbstractResource.Path()
|
|
||||||
}
|
|
||||||
|
|
||||||
// GraphNodeNoProvider
|
// GraphNodeNoProvider
|
||||||
// FIXME: this should be removed once the node can be separated from the
|
// FIXME: this should be removed once the node can be separated from the
|
||||||
// Internal NodeAbstractResource behavior.
|
// Internal NodeAbstractResource behavior.
|
||||||
|
|
|
@ -19,7 +19,6 @@ type NodePlannableResource struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ GraphNodeModuleInstance = (*NodePlannableResource)(nil)
|
|
||||||
_ GraphNodeDestroyerCBD = (*NodePlannableResource)(nil)
|
_ GraphNodeDestroyerCBD = (*NodePlannableResource)(nil)
|
||||||
_ GraphNodeDynamicExpandable = (*NodePlannableResource)(nil)
|
_ GraphNodeDynamicExpandable = (*NodePlannableResource)(nil)
|
||||||
_ GraphNodeReferenceable = (*NodePlannableResource)(nil)
|
_ GraphNodeReferenceable = (*NodePlannableResource)(nil)
|
||||||
|
@ -30,19 +29,17 @@ var (
|
||||||
|
|
||||||
// GraphNodeEvalable
|
// GraphNodeEvalable
|
||||||
func (n *NodePlannableResource) EvalTree() EvalNode {
|
func (n *NodePlannableResource) EvalTree() EvalNode {
|
||||||
addr := n.ResourceAddr()
|
if n.Config == nil {
|
||||||
config := n.Config
|
|
||||||
|
|
||||||
if config == nil {
|
|
||||||
// Nothing to do, then.
|
// Nothing to do, then.
|
||||||
log.Printf("[TRACE] NodeApplyableResource: no configuration present for %s", addr)
|
log.Printf("[TRACE] NodeApplyableResource: no configuration present for %s", n.Name())
|
||||||
return &EvalNoop{}
|
return &EvalNoop{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this ensures we can reference the resource even if the count is 0
|
// this ensures we can reference the resource even if the count is 0
|
||||||
return &EvalWriteResourceState{
|
return &EvalWriteResourceState{
|
||||||
Addr: addr.Resource,
|
Addr: n.Addr,
|
||||||
Config: config,
|
Module: n.Module,
|
||||||
|
Config: n.Config,
|
||||||
ProviderAddr: n.ResolvedProvider,
|
ProviderAddr: n.ResolvedProvider,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ type NodeRefreshableManagedResource struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ GraphNodeModuleInstance = (*NodeRefreshableManagedResource)(nil)
|
|
||||||
_ GraphNodeDynamicExpandable = (*NodeRefreshableManagedResource)(nil)
|
_ GraphNodeDynamicExpandable = (*NodeRefreshableManagedResource)(nil)
|
||||||
_ GraphNodeReferenceable = (*NodeRefreshableManagedResource)(nil)
|
_ GraphNodeReferenceable = (*NodeRefreshableManagedResource)(nil)
|
||||||
_ GraphNodeReferencer = (*NodeRefreshableManagedResource)(nil)
|
_ GraphNodeReferencer = (*NodeRefreshableManagedResource)(nil)
|
||||||
|
@ -61,8 +60,7 @@ func (n *NodeRefreshableManagedResource) DynamicExpand(ctx EvalContext) (*Graph,
|
||||||
// Inform our instance expander about our expansion results above,
|
// Inform our instance expander about our expansion results above,
|
||||||
// and then use it to calculate the instance addresses we'll expand for.
|
// and then use it to calculate the instance addresses we'll expand for.
|
||||||
expander := ctx.InstanceExpander()
|
expander := ctx.InstanceExpander()
|
||||||
|
for _, module := range expander.ExpandModule(n.Module) {
|
||||||
for _, module := range expander.ExpandModule(ctx.Path().Module()) {
|
|
||||||
switch {
|
switch {
|
||||||
case count >= 0:
|
case count >= 0:
|
||||||
expander.SetResourceCount(module, n.ResourceAddr().Resource, count)
|
expander.SetResourceCount(module, n.ResourceAddr().Resource, count)
|
||||||
|
@ -72,7 +70,7 @@ func (n *NodeRefreshableManagedResource) DynamicExpand(ctx EvalContext) (*Graph,
|
||||||
expander.SetResourceSingle(module, n.ResourceAddr().Resource)
|
expander.SetResourceSingle(module, n.ResourceAddr().Resource)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
instanceAddrs := expander.ExpandResource(ctx.Path().Module(), n.ResourceAddr().Resource)
|
instanceAddrs := expander.ExpandResource(n.Module, n.ResourceAddr().Resource)
|
||||||
|
|
||||||
// Our graph transformers require access to the full state, so we'll
|
// Our graph transformers require access to the full state, so we'll
|
||||||
// temporarily lock it while we work on this.
|
// temporarily lock it while we work on this.
|
||||||
|
@ -131,7 +129,7 @@ func (n *NodeRefreshableManagedResource) DynamicExpand(ctx EvalContext) (*Graph,
|
||||||
Name: "NodeRefreshableManagedResource",
|
Name: "NodeRefreshableManagedResource",
|
||||||
}
|
}
|
||||||
|
|
||||||
graph, diags := b.Build(ctx.Path())
|
graph, diags := b.Build(nil)
|
||||||
return graph, diags.ErrWithWarnings()
|
return graph, diags.ErrWithWarnings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ type NodeValidatableResource struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ GraphNodeModuleInstance = (*NodeValidatableResource)(nil)
|
|
||||||
_ GraphNodeEvalable = (*NodeValidatableResource)(nil)
|
_ GraphNodeEvalable = (*NodeValidatableResource)(nil)
|
||||||
_ GraphNodeReferenceable = (*NodeValidatableResource)(nil)
|
_ GraphNodeReferenceable = (*NodeValidatableResource)(nil)
|
||||||
_ GraphNodeReferencer = (*NodeValidatableResource)(nil)
|
_ GraphNodeReferencer = (*NodeValidatableResource)(nil)
|
||||||
|
|
|
@ -69,7 +69,7 @@ func (t *AttachSchemaTransformer) Transform(g *Graph) error {
|
||||||
if t.Config == nil {
|
if t.Config == nil {
|
||||||
providerFqn = addrs.NewLegacyProvider(p.LocalName)
|
providerFqn = addrs.NewLegacyProvider(p.LocalName)
|
||||||
} else {
|
} else {
|
||||||
modConfig := t.Config.DescendentForInstance(tv.Path())
|
modConfig := t.Config.Descendent(tv.ModulePath())
|
||||||
if modConfig == nil {
|
if modConfig == nil {
|
||||||
providerFqn = addrs.NewLegacyProvider(p.LocalName)
|
providerFqn = addrs.NewLegacyProvider(p.LocalName)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -45,7 +45,7 @@ func TestDiffTransformer(t *testing.T) {
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.AbsProviderConfig{
|
ProviderAddr: addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.Update,
|
Action: plans.Update,
|
||||||
|
|
|
@ -24,7 +24,7 @@ func (t *ImportStateTransformer) Transform(g *Graph) error {
|
||||||
defaultFQN := target.Addr.Resource.Resource.DefaultProvider()
|
defaultFQN := target.Addr.Resource.Resource.DefaultProvider()
|
||||||
providerAddr = addrs.AbsProviderConfig{
|
providerAddr = addrs.AbsProviderConfig{
|
||||||
Provider: defaultFQN,
|
Provider: defaultFQN,
|
||||||
Module: target.Addr.Module,
|
Module: target.Addr.Module.Module(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ type graphNodeImportState struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ GraphNodeModuleInstance = (*graphNodeImportState)(nil)
|
_ GraphNodeModulePath = (*graphNodeImportState)(nil)
|
||||||
_ GraphNodeEvalable = (*graphNodeImportState)(nil)
|
_ GraphNodeEvalable = (*graphNodeImportState)(nil)
|
||||||
_ GraphNodeProviderConsumer = (*graphNodeImportState)(nil)
|
_ GraphNodeProviderConsumer = (*graphNodeImportState)(nil)
|
||||||
_ GraphNodeDynamicExpandable = (*graphNodeImportState)(nil)
|
_ GraphNodeDynamicExpandable = (*graphNodeImportState)(nil)
|
||||||
|
@ -88,6 +88,11 @@ func (n *graphNodeImportState) Path() addrs.ModuleInstance {
|
||||||
return n.Addr.Module
|
return n.Addr.Module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GraphNodeModulePath
|
||||||
|
func (n *graphNodeImportState) ModulePath() addrs.Module {
|
||||||
|
return n.Addr.Module.Module()
|
||||||
|
}
|
||||||
|
|
||||||
// GraphNodeEvalable impl.
|
// GraphNodeEvalable impl.
|
||||||
func (n *graphNodeImportState) EvalTree() EvalNode {
|
func (n *graphNodeImportState) EvalTree() EvalNode {
|
||||||
var provider providers.Interface
|
var provider providers.Interface
|
||||||
|
|
|
@ -28,7 +28,7 @@ func TestOrphanResourceInstanceTransformer(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ func TestOrphanResourceInstanceTransformer(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -96,7 +96,7 @@ func TestOrphanResourceInstanceTransformer_countGood(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -113,7 +113,7 @@ func TestOrphanResourceInstanceTransformer_countGood(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -161,7 +161,7 @@ func TestOrphanResourceInstanceTransformer_countBad(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -178,7 +178,7 @@ func TestOrphanResourceInstanceTransformer_countBad(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -226,7 +226,7 @@ func TestOrphanResourceInstanceTransformer_modules(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -243,7 +243,7 @@ func TestOrphanResourceInstanceTransformer_modules(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -44,7 +44,7 @@ func TransformProviders(providers []string, concrete ConcreteProviderNodeFunc, c
|
||||||
//
|
//
|
||||||
// Name returns the full name of the provider in the config.
|
// Name returns the full name of the provider in the config.
|
||||||
type GraphNodeProvider interface {
|
type GraphNodeProvider interface {
|
||||||
GraphNodeModuleInstance
|
GraphNodeModulePath
|
||||||
ProviderAddr() addrs.AbsProviderConfig
|
ProviderAddr() addrs.AbsProviderConfig
|
||||||
Name() string
|
Name() string
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ type GraphNodeProvider interface {
|
||||||
// provider must implement. The CloseProviderName returned is the name of
|
// provider must implement. The CloseProviderName returned is the name of
|
||||||
// the provider they satisfy.
|
// the provider they satisfy.
|
||||||
type GraphNodeCloseProvider interface {
|
type GraphNodeCloseProvider interface {
|
||||||
GraphNodeModuleInstance
|
GraphNodeModulePath
|
||||||
CloseProviderAddr() addrs.AbsProviderConfig
|
CloseProviderAddr() addrs.AbsProviderConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ type GraphNodeCloseProvider interface {
|
||||||
// or in an ancestor module, with the resulting absolute address passed to
|
// or in an ancestor module, with the resulting absolute address passed to
|
||||||
// SetProvider.
|
// SetProvider.
|
||||||
type GraphNodeProviderConsumer interface {
|
type GraphNodeProviderConsumer interface {
|
||||||
GraphNodeModuleInstance
|
GraphNodeModulePath
|
||||||
// ProvidedBy returns the address of the provider configuration the node
|
// ProvidedBy returns the address of the provider configuration the node
|
||||||
// refers to, if available. The following value types may be returned:
|
// refers to, if available. The following value types may be returned:
|
||||||
//
|
//
|
||||||
|
@ -139,7 +139,7 @@ func (t *ProviderTransformer) Transform(g *Graph) error {
|
||||||
case addrs.LocalProviderConfig:
|
case addrs.LocalProviderConfig:
|
||||||
// ProvidedBy() return a LocalProviderConfig when the resource
|
// ProvidedBy() return a LocalProviderConfig when the resource
|
||||||
// contains a `provider` attribute
|
// contains a `provider` attribute
|
||||||
modPath := pv.Path()
|
modPath := pv.ModulePath()
|
||||||
if t.Config == nil {
|
if t.Config == nil {
|
||||||
absPc.Provider = addrs.NewLegacyProvider(p.LocalName)
|
absPc.Provider = addrs.NewLegacyProvider(p.LocalName)
|
||||||
absPc.Module = modPath
|
absPc.Module = modPath
|
||||||
|
@ -147,7 +147,7 @@ func (t *ProviderTransformer) Transform(g *Graph) error {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
modConfig := t.Config.DescendentForInstance(modPath)
|
modConfig := t.Config.Descendent(modPath)
|
||||||
if modConfig == nil {
|
if modConfig == nil {
|
||||||
absPc.Provider = addrs.NewLegacyProvider(p.LocalName)
|
absPc.Provider = addrs.NewLegacyProvider(p.LocalName)
|
||||||
} else {
|
} else {
|
||||||
|
@ -159,7 +159,7 @@ func (t *ProviderTransformer) Transform(g *Graph) error {
|
||||||
case nil:
|
case nil:
|
||||||
// No provider found in config or state; fall back to implied default provider.
|
// No provider found in config or state; fall back to implied default provider.
|
||||||
absPc.Provider = pv.ImpliedProvider()
|
absPc.Provider = pv.ImpliedProvider()
|
||||||
absPc.Module = pv.Path()
|
absPc.Module = pv.ModulePath()
|
||||||
log.Printf("[TRACE] ProviderTransformer: %s is provided by %s or inherited equivalent", dag.VertexName(v), absPc)
|
log.Printf("[TRACE] ProviderTransformer: %s is provided by %s or inherited equivalent", dag.VertexName(v), absPc)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -216,7 +216,7 @@ func (t *ProviderTransformer) Transform(g *Graph) error {
|
||||||
// start up the provider and fetch its schema.
|
// start up the provider and fetch its schema.
|
||||||
if _, exists := needConfigured[key]; target == nil && !exists {
|
if _, exists := needConfigured[key]; target == nil && !exists {
|
||||||
stubAddr := addrs.AbsProviderConfig{
|
stubAddr := addrs.AbsProviderConfig{
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
Provider: p.Provider,
|
Provider: p.Provider,
|
||||||
}
|
}
|
||||||
stub := &NodeEvalableProvider{
|
stub := &NodeEvalableProvider{
|
||||||
|
@ -364,7 +364,7 @@ func (t *MissingProviderTransformer) Transform(g *Graph) error {
|
||||||
log.Println("[TRACE] MissingProviderTransformer: skipping implication of aliased config", p)
|
log.Println("[TRACE] MissingProviderTransformer: skipping implication of aliased config", p)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
modConfig := t.Config.DescendentForInstance(pv.Path())
|
modConfig := t.Config.Descendent(pv.ModulePath())
|
||||||
if modConfig == nil {
|
if modConfig == nil {
|
||||||
providerFqn = addrs.NewLegacyProvider(p.LocalName)
|
providerFqn = addrs.NewLegacyProvider(p.LocalName)
|
||||||
} else {
|
} else {
|
||||||
|
@ -427,7 +427,7 @@ func (t *ParentProviderTransformer) Transform(g *Graph) error {
|
||||||
|
|
||||||
// Also require non-empty path, since otherwise we're in the root
|
// Also require non-empty path, since otherwise we're in the root
|
||||||
// module and so cannot have a parent.
|
// module and so cannot have a parent.
|
||||||
if len(pn.Path()) <= 1 {
|
if len(pn.ModulePath()) <= 1 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,6 +513,11 @@ func (n *graphNodeCloseProvider) Name() string {
|
||||||
|
|
||||||
// GraphNodeModuleInstance impl.
|
// GraphNodeModuleInstance impl.
|
||||||
func (n *graphNodeCloseProvider) Path() addrs.ModuleInstance {
|
func (n *graphNodeCloseProvider) Path() addrs.ModuleInstance {
|
||||||
|
return n.Addr.Module.UnkeyedInstanceShim()
|
||||||
|
}
|
||||||
|
|
||||||
|
// GraphNodeModulePath
|
||||||
|
func (n *graphNodeCloseProvider) ModulePath() addrs.Module {
|
||||||
return n.Addr.Module
|
return n.Addr.Module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,6 +567,7 @@ type graphNodeProxyProvider struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
_ GraphNodeModulePath = (*graphNodeProxyProvider)(nil)
|
||||||
_ GraphNodeProvider = (*graphNodeProxyProvider)(nil)
|
_ GraphNodeProvider = (*graphNodeProxyProvider)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -570,6 +576,10 @@ func (n *graphNodeProxyProvider) ProviderAddr() addrs.AbsProviderConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *graphNodeProxyProvider) Path() addrs.ModuleInstance {
|
func (n *graphNodeProxyProvider) Path() addrs.ModuleInstance {
|
||||||
|
return n.addr.Module.UnkeyedInstanceShim()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *graphNodeProxyProvider) ModulePath() addrs.Module {
|
||||||
return n.addr.Module
|
return n.addr.Module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,19 +654,7 @@ func (t *ProviderConfigTransformer) transform(g *Graph, c *configs.Config) error
|
||||||
func (t *ProviderConfigTransformer) transformSingle(g *Graph, c *configs.Config) error {
|
func (t *ProviderConfigTransformer) transformSingle(g *Graph, c *configs.Config) error {
|
||||||
// Get the module associated with this configuration tree node
|
// Get the module associated with this configuration tree node
|
||||||
mod := c.Module
|
mod := c.Module
|
||||||
staticPath := c.Path
|
path := c.Path
|
||||||
|
|
||||||
// We actually need a dynamic module path here, but we've not yet updated
|
|
||||||
// our graph builders enough to support expansion of module calls with
|
|
||||||
// "count" and "for_each" set, so for now we'll shim this by converting to
|
|
||||||
// a dynamic path with no keys. At the time of writing this is the only
|
|
||||||
// possible kind of dynamic path anyway.
|
|
||||||
path := make(addrs.ModuleInstance, len(staticPath))
|
|
||||||
for i, name := range staticPath {
|
|
||||||
path[i] = addrs.ModuleInstanceStep{
|
|
||||||
Name: name,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add all providers from the configuration
|
// add all providers from the configuration
|
||||||
for _, p := range mod.ProviderConfigs {
|
for _, p := range mod.ProviderConfigs {
|
||||||
|
@ -720,19 +718,6 @@ func (t *ProviderConfigTransformer) addProxyProviders(g *Graph, c *configs.Confi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We currently don't support count/for_each for modules and so we must
|
|
||||||
// shim our path and parentPath into module instances here so that the
|
|
||||||
// rest of Terraform can behave as if we do. This shimming should be
|
|
||||||
// removed later as part of implementing count/for_each for modules.
|
|
||||||
instPath := make(addrs.ModuleInstance, len(path))
|
|
||||||
for i, name := range path {
|
|
||||||
instPath[i] = addrs.ModuleInstanceStep{Name: name}
|
|
||||||
}
|
|
||||||
parentInstPath := make(addrs.ModuleInstance, len(parentPath))
|
|
||||||
for i, name := range parentPath {
|
|
||||||
parentInstPath[i] = addrs.ModuleInstanceStep{Name: name}
|
|
||||||
}
|
|
||||||
|
|
||||||
if parentCfg == nil {
|
if parentCfg == nil {
|
||||||
// this can't really happen during normal execution.
|
// this can't really happen during normal execution.
|
||||||
return fmt.Errorf("parent module config not found for %s", c.Path.String())
|
return fmt.Errorf("parent module config not found for %s", c.Path.String())
|
||||||
|
@ -744,13 +729,13 @@ func (t *ProviderConfigTransformer) addProxyProviders(g *Graph, c *configs.Confi
|
||||||
fqn := c.Module.ProviderForLocalConfig(pair.InChild.Addr())
|
fqn := c.Module.ProviderForLocalConfig(pair.InChild.Addr())
|
||||||
fullAddr := addrs.AbsProviderConfig{
|
fullAddr := addrs.AbsProviderConfig{
|
||||||
Provider: fqn,
|
Provider: fqn,
|
||||||
Module: instPath,
|
Module: path,
|
||||||
Alias: pair.InChild.Addr().Alias,
|
Alias: pair.InChild.Addr().Alias,
|
||||||
}
|
}
|
||||||
|
|
||||||
fullParentAddr := addrs.AbsProviderConfig{
|
fullParentAddr := addrs.AbsProviderConfig{
|
||||||
Provider: fqn,
|
Provider: fqn,
|
||||||
Module: parentInstPath,
|
Module: parentPath,
|
||||||
Alias: pair.InParent.Addr().Alias,
|
Alias: pair.InParent.Addr().Alias,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,7 +787,7 @@ func (t *ProviderConfigTransformer) attachProviderConfigs(g *Graph) error {
|
||||||
addr := apn.ProviderAddr()
|
addr := apn.ProviderAddr()
|
||||||
|
|
||||||
// Get the configuration.
|
// Get the configuration.
|
||||||
mc := t.Config.DescendentForInstance(addr.Module)
|
mc := t.Config.Descendent(addr.Module)
|
||||||
if mc == nil {
|
if mc == nil {
|
||||||
log.Printf("[TRACE] ProviderConfigTransformer: no configuration available for %s", addr.String())
|
log.Printf("[TRACE] ProviderConfigTransformer: no configuration available for %s", addr.String())
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -72,7 +72,7 @@ func TestMissingProvisionerTransformer_module(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -89,7 +89,7 @@ func TestMissingProvisionerTransformer_module(t *testing.T) {
|
||||||
},
|
},
|
||||||
addrs.AbsProviderConfig{
|
addrs.AbsProviderConfig{
|
||||||
Provider: addrs.NewLegacyProvider("aws"),
|
Provider: addrs.NewLegacyProvider("aws"),
|
||||||
Module: addrs.RootModuleInstance,
|
Module: addrs.RootModule,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue