addrs: replace "Type string" with "Type Provider" in ProviderConfig
* huge change to weave new addrs.Provider into addrs.ProviderConfig * terraform: do not include an empty string in the returned Providers / Provisioners - Fixed a minor bug where results included an extra empty string
This commit is contained in:
parent
b2f7d80c3d
commit
e3416124cc
|
@ -1,6 +1,8 @@
|
||||||
package addrs
|
package addrs
|
||||||
|
|
||||||
import svchost "github.com/hashicorp/terraform-svchost"
|
import (
|
||||||
|
svchost "github.com/hashicorp/terraform-svchost"
|
||||||
|
)
|
||||||
|
|
||||||
// Provider encapsulates a single provider type. In the future this will be
|
// Provider encapsulates a single provider type. In the future this will be
|
||||||
// extended to include additional fields including Namespace and SourceHost
|
// extended to include additional fields including Namespace and SourceHost
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
// ProviderConfig is the address of a provider configuration.
|
// ProviderConfig is the address of a provider configuration.
|
||||||
type ProviderConfig struct {
|
type ProviderConfig struct {
|
||||||
Type string
|
Type Provider
|
||||||
|
|
||||||
// If not empty, Alias identifies which non-default (aliased) provider
|
// If not empty, Alias identifies which non-default (aliased) provider
|
||||||
// configuration this address refers to.
|
// configuration this address refers to.
|
||||||
|
@ -22,7 +22,7 @@ type ProviderConfig struct {
|
||||||
// configuration for the provider with the given type name.
|
// configuration for the provider with the given type name.
|
||||||
func NewDefaultProviderConfig(typeName string) ProviderConfig {
|
func NewDefaultProviderConfig(typeName string) ProviderConfig {
|
||||||
return ProviderConfig{
|
return ProviderConfig{
|
||||||
Type: typeName,
|
Type: NewLegacyProvider(typeName),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ func NewDefaultProviderConfig(typeName string) ProviderConfig {
|
||||||
func ParseProviderConfigCompact(traversal hcl.Traversal) (ProviderConfig, tfdiags.Diagnostics) {
|
func ParseProviderConfigCompact(traversal hcl.Traversal) (ProviderConfig, tfdiags.Diagnostics) {
|
||||||
var diags tfdiags.Diagnostics
|
var diags tfdiags.Diagnostics
|
||||||
ret := ProviderConfig{
|
ret := ProviderConfig{
|
||||||
Type: traversal.RootName(),
|
Type: NewLegacyProvider(traversal.RootName()),
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(traversal) < 2 {
|
if len(traversal) < 2 {
|
||||||
|
@ -114,25 +114,25 @@ func (pc ProviderConfig) Absolute(module ModuleInstance) AbsProviderConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pc ProviderConfig) String() string {
|
func (pc ProviderConfig) String() string {
|
||||||
if pc.Type == "" {
|
if pc.Type.LegacyString() == "" {
|
||||||
// Should never happen; always indicates a bug
|
// Should never happen; always indicates a bug
|
||||||
return "provider.<invalid>"
|
return "provider.<invalid>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if pc.Alias != "" {
|
if pc.Alias != "" {
|
||||||
return fmt.Sprintf("provider.%s.%s", pc.Type, pc.Alias)
|
return fmt.Sprintf("provider.%s.%s", pc.Type.LegacyString(), pc.Alias)
|
||||||
}
|
}
|
||||||
|
|
||||||
return "provider." + pc.Type
|
return "provider." + pc.Type.LegacyString()
|
||||||
}
|
}
|
||||||
|
|
||||||
// StringCompact is an alternative to String that returns the form that can
|
// StringCompact is an alternative to String that returns the form that can
|
||||||
// be parsed by ParseProviderConfigCompact, without the "provider." prefix.
|
// be parsed by ParseProviderConfigCompact, without the "provider." prefix.
|
||||||
func (pc ProviderConfig) StringCompact() string {
|
func (pc ProviderConfig) StringCompact() string {
|
||||||
if pc.Alias != "" {
|
if pc.Alias != "" {
|
||||||
return fmt.Sprintf("%s.%s", pc.Type, pc.Alias)
|
return fmt.Sprintf("%s.%s", pc.Type.LegacyString(), pc.Alias)
|
||||||
}
|
}
|
||||||
return pc.Type
|
return pc.Type.LegacyString()
|
||||||
}
|
}
|
||||||
|
|
||||||
// AbsProviderConfig is the absolute address of a provider configuration
|
// AbsProviderConfig is the absolute address of a provider configuration
|
||||||
|
@ -181,7 +181,7 @@ func ParseAbsProviderConfig(traversal hcl.Traversal) (AbsProviderConfig, tfdiags
|
||||||
}
|
}
|
||||||
|
|
||||||
if tt, ok := remain[1].(hcl.TraverseAttr); ok {
|
if tt, ok := remain[1].(hcl.TraverseAttr); ok {
|
||||||
ret.ProviderConfig.Type = tt.Name
|
ret.ProviderConfig.Type = NewLegacyProvider(tt.Name)
|
||||||
} else {
|
} else {
|
||||||
diags = diags.Append(&hcl.Diagnostic{
|
diags = diags.Append(&hcl.Diagnostic{
|
||||||
Severity: hcl.DiagError,
|
Severity: hcl.DiagError,
|
||||||
|
@ -244,7 +244,7 @@ func (m ModuleInstance) ProviderConfigDefault(name string) AbsProviderConfig {
|
||||||
return AbsProviderConfig{
|
return AbsProviderConfig{
|
||||||
Module: m,
|
Module: m,
|
||||||
ProviderConfig: ProviderConfig{
|
ProviderConfig: ProviderConfig{
|
||||||
Type: name,
|
Type: NewLegacyProvider(name),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ func (m ModuleInstance) ProviderConfigAliased(name, alias string) AbsProviderCon
|
||||||
return AbsProviderConfig{
|
return AbsProviderConfig{
|
||||||
Module: m,
|
Module: m,
|
||||||
ProviderConfig: ProviderConfig{
|
ProviderConfig: ProviderConfig{
|
||||||
Type: name,
|
Type: NewLegacyProvider(name),
|
||||||
Alias: alias,
|
Alias: alias,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,14 @@ func TestParseProviderConfigCompact(t *testing.T) {
|
||||||
{
|
{
|
||||||
`aws`,
|
`aws`,
|
||||||
ProviderConfig{
|
ProviderConfig{
|
||||||
Type: "aws",
|
Type: NewLegacyProvider("aws"),
|
||||||
},
|
},
|
||||||
``,
|
``,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`aws.foo`,
|
`aws.foo`,
|
||||||
ProviderConfig{
|
ProviderConfig{
|
||||||
Type: "aws",
|
Type: NewLegacyProvider("aws"),
|
||||||
Alias: "foo",
|
Alias: "foo",
|
||||||
},
|
},
|
||||||
``,
|
``,
|
||||||
|
@ -82,7 +82,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance,
|
Module: RootModuleInstance,
|
||||||
ProviderConfig: ProviderConfig{
|
ProviderConfig: ProviderConfig{
|
||||||
Type: "aws",
|
Type: NewLegacyProvider("aws"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
``,
|
``,
|
||||||
|
@ -92,7 +92,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
AbsProviderConfig{
|
AbsProviderConfig{
|
||||||
Module: RootModuleInstance,
|
Module: RootModuleInstance,
|
||||||
ProviderConfig: ProviderConfig{
|
ProviderConfig: ProviderConfig{
|
||||||
Type: "aws",
|
Type: NewLegacyProvider("aws"),
|
||||||
Alias: "foo",
|
Alias: "foo",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -107,7 +107,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ProviderConfig: ProviderConfig{
|
ProviderConfig: ProviderConfig{
|
||||||
Type: "aws",
|
Type: NewLegacyProvider("aws"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
``,
|
``,
|
||||||
|
@ -121,7 +121,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ProviderConfig: ProviderConfig{
|
ProviderConfig: ProviderConfig{
|
||||||
Type: "aws",
|
Type: NewLegacyProvider("aws"),
|
||||||
Alias: "foo",
|
Alias: "foo",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -137,7 +137,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ProviderConfig: ProviderConfig{
|
ProviderConfig: ProviderConfig{
|
||||||
Type: "aws",
|
Type: NewLegacyProvider("aws"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
``,
|
``,
|
||||||
|
@ -152,7 +152,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ProviderConfig: ProviderConfig{
|
ProviderConfig: ProviderConfig{
|
||||||
Type: "aws",
|
Type: NewLegacyProvider("aws"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
``,
|
``,
|
||||||
|
@ -170,7 +170,7 @@ func TestParseAbsProviderConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ProviderConfig: ProviderConfig{
|
ProviderConfig: ProviderConfig{
|
||||||
Type: "aws",
|
Type: NewLegacyProvider("aws"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
``,
|
``,
|
||||||
|
|
|
@ -65,8 +65,9 @@ func (r Resource) DefaultProviderConfig() ProviderConfig {
|
||||||
if under := strings.Index(typeName, "_"); under != -1 {
|
if under := strings.Index(typeName, "_"); under != -1 {
|
||||||
typeName = typeName[:under]
|
typeName = typeName[:under]
|
||||||
}
|
}
|
||||||
|
|
||||||
return ProviderConfig{
|
return ProviderConfig{
|
||||||
Type: typeName,
|
Type: NewLegacyProvider(typeName),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ func RenderPlan(plan *plans.Plan, state *states.State, schemas *terraform.Schema
|
||||||
if rcs.Action == plans.NoOp {
|
if rcs.Action == plans.NoOp {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
providerSchema := schemas.ProviderSchema(rcs.ProviderAddr.ProviderConfig.Type)
|
providerSchema := schemas.ProviderSchema(rcs.ProviderAddr.ProviderConfig.Type.LegacyString())
|
||||||
if providerSchema == nil {
|
if providerSchema == nil {
|
||||||
// Should never happen
|
// Should never happen
|
||||||
ui.Output(fmt.Sprintf("(schema missing for %s)\n", rcs.ProviderAddr))
|
ui.Output(fmt.Sprintf("(schema missing for %s)\n", rcs.ProviderAddr))
|
||||||
|
|
|
@ -216,7 +216,7 @@ func TestLocal_planDeposedOnly(t *testing.T) {
|
||||||
}`),
|
}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
|
@ -659,7 +659,7 @@ func testPlanState() *states.State {
|
||||||
}`),
|
}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -685,7 +685,7 @@ func testPlanState_withDataSource() *states.State {
|
||||||
}`),
|
}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
rootModule.SetResourceInstanceCurrent(
|
rootModule.SetResourceInstanceCurrent(
|
||||||
|
@ -701,7 +701,7 @@ func testPlanState_withDataSource() *states.State {
|
||||||
}`),
|
}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -727,7 +727,7 @@ func testPlanState_tainted() *states.State {
|
||||||
}`),
|
}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
|
|
@ -151,7 +151,7 @@ func TestBackendStates(t *testing.T, b Backend) {
|
||||||
SchemaVersion: 0,
|
SchemaVersion: 0,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ func TestApply_destroy(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, originalState)
|
statePath := testStateFile(t, originalState)
|
||||||
|
@ -122,7 +122,7 @@ func TestApply_destroyLockedState(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, originalState)
|
statePath := testStateFile(t, originalState)
|
||||||
|
@ -194,7 +194,7 @@ func TestApply_destroyTargeted(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"i-ab123"}`),
|
AttrsJSON: []byte(`{"id":"i-ab123"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -206,7 +206,7 @@ func TestApply_destroyTargeted(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"i-abc123"}`),
|
AttrsJSON: []byte(`{"id":"i-abc123"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, originalState)
|
statePath := testStateFile(t, originalState)
|
||||||
|
|
|
@ -833,7 +833,7 @@ func TestApply_refresh(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"ami":"bar"}`),
|
AttrsJSON: []byte(`{"ami":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, originalState)
|
statePath := testStateFile(t, originalState)
|
||||||
|
@ -987,7 +987,7 @@ func TestApply_state(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"ami":"foo"}`),
|
AttrsJSON: []byte(`{"ami":"foo"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, originalState)
|
statePath := testStateFile(t, originalState)
|
||||||
|
@ -1351,7 +1351,7 @@ func TestApply_backup(t *testing.T) {
|
||||||
AttrsJSON: []byte("{\n \"id\": \"bar\"\n }"),
|
AttrsJSON: []byte("{\n \"id\": \"bar\"\n }"),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, originalState)
|
statePath := testStateFile(t, originalState)
|
||||||
|
@ -1652,7 +1652,7 @@ func applyFixturePlanFile(t *testing.T) string {
|
||||||
Type: "test_instance",
|
Type: "test_instance",
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
ProviderAddr: addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.Create,
|
Action: plans.Create,
|
||||||
Before: priorValRaw,
|
Before: priorValRaw,
|
||||||
|
|
|
@ -266,7 +266,7 @@ func testState() *states.State {
|
||||||
DependsOn: []addrs.Referenceable{},
|
DependsOn: []addrs.Referenceable{},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
// DeepCopy is used here to ensure our synthetic state matches exactly
|
// DeepCopy is used here to ensure our synthetic state matches exactly
|
||||||
|
|
|
@ -3157,7 +3157,7 @@ func runTestCases(t *testing.T, testCases map[string]testCase) {
|
||||||
Type: "test_instance",
|
Type: "test_instance",
|
||||||
Name: "example",
|
Name: "example",
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
ProviderAddr: addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: tc.Action,
|
Action: tc.Action,
|
||||||
Before: before,
|
Before: before,
|
||||||
|
|
|
@ -244,7 +244,7 @@ func basicState(t *testing.T) *states.State {
|
||||||
AttrsJSON: []byte(`{"woozles":"confuzles"}`),
|
AttrsJSON: []byte(`{"woozles":"confuzles"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
rootModule.SetResourceInstanceCurrent(
|
rootModule.SetResourceInstanceCurrent(
|
||||||
|
@ -259,7 +259,7 @@ func basicState(t *testing.T) *states.State {
|
||||||
AttrsJSON: []byte(`{"compute":"sure"}`),
|
AttrsJSON: []byte(`{"compute":"sure"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -294,7 +294,7 @@ func stateWithMoreOutputs(t *testing.T) *states.State {
|
||||||
AttrsJSON: []byte(`{"woozles":"confuzles"}`),
|
AttrsJSON: []byte(`{"woozles":"confuzles"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -320,7 +320,7 @@ func nestedState(t *testing.T) *states.State {
|
||||||
AttrsJSON: []byte(`{"woozles":"confuzles","nested": [{"value": "42"}]}`),
|
AttrsJSON: []byte(`{"woozles":"confuzles","nested": [{"value": "42"}]}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -342,7 +342,7 @@ func deposedState(t *testing.T) *states.State {
|
||||||
AttrsJSON: []byte(`{"woozles":"confuzles","nested": [{"value": "42"}]}`),
|
AttrsJSON: []byte(`{"woozles":"confuzles","nested": [{"value": "42"}]}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
@ -370,7 +370,7 @@ func onlyDeposedState(t *testing.T) *states.State {
|
||||||
AttrsJSON: []byte(`{"woozles":"confuzles","nested": [{"value": "42"}]}`),
|
AttrsJSON: []byte(`{"woozles":"confuzles","nested": [{"value": "42"}]}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
rootModule.SetResourceInstanceDeposed(
|
rootModule.SetResourceInstanceDeposed(
|
||||||
|
@ -386,7 +386,7 @@ func onlyDeposedState(t *testing.T) *states.State {
|
||||||
AttrsJSON: []byte(`{"woozles":"confuzles","nested": [{"value": "42"}]}`),
|
AttrsJSON: []byte(`{"woozles":"confuzles","nested": [{"value": "42"}]}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
return state
|
return state
|
||||||
|
|
|
@ -125,7 +125,7 @@ func TestGraph_plan(t *testing.T) {
|
||||||
Before: plans.DynamicValue(`{}`),
|
Before: plans.DynamicValue(`{}`),
|
||||||
After: plans.DynamicValue(`null`),
|
After: plans.DynamicValue(`null`),
|
||||||
},
|
},
|
||||||
ProviderAddr: addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
ProviderAddr: addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
})
|
})
|
||||||
emptyConfig, err := plans.NewDynamicValue(cty.EmptyObjectVal, cty.EmptyObject)
|
emptyConfig, err := plans.NewDynamicValue(cty.EmptyObjectVal, cty.EmptyObject)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -302,7 +302,7 @@ func marshalResources(resources map[string]*configs.Resource, schemas *terraform
|
||||||
}
|
}
|
||||||
|
|
||||||
schema, schemaVer := schemas.ResourceTypeConfig(
|
schema, schemaVer := schemas.ResourceTypeConfig(
|
||||||
v.ProviderConfigAddr().Type,
|
v.ProviderConfigAddr().Type.LegacyString(),
|
||||||
v.Mode,
|
v.Mode,
|
||||||
v.Type,
|
v.Type,
|
||||||
)
|
)
|
||||||
|
|
|
@ -178,7 +178,7 @@ func (p *plan) marshalResourceChanges(changes *plans.Changes, schemas *terraform
|
||||||
}
|
}
|
||||||
|
|
||||||
schema, _ := schemas.ResourceTypeConfig(
|
schema, _ := schemas.ResourceTypeConfig(
|
||||||
rc.ProviderAddr.ProviderConfig.Type,
|
rc.ProviderAddr.ProviderConfig.Type.LegacyString(),
|
||||||
addr.Resource.Resource.Mode,
|
addr.Resource.Resource.Mode,
|
||||||
addr.Resource.Resource.Type,
|
addr.Resource.Resource.Type,
|
||||||
)
|
)
|
||||||
|
|
|
@ -181,7 +181,7 @@ func marshalPlanResources(changes *plans.Changes, ris []addrs.AbsResourceInstanc
|
||||||
}
|
}
|
||||||
|
|
||||||
schema, schemaVer := schemas.ResourceTypeConfig(
|
schema, schemaVer := schemas.ResourceTypeConfig(
|
||||||
r.ProviderAddr.ProviderConfig.Type,
|
r.ProviderAddr.ProviderConfig.Type.LegacyString(),
|
||||||
r.Addr.Resource.Resource.Mode,
|
r.Addr.Resource.Resource.Mode,
|
||||||
resource.Type,
|
resource.Type,
|
||||||
)
|
)
|
||||||
|
|
|
@ -258,7 +258,7 @@ func TestMarshalPlanResources(t *testing.T) {
|
||||||
Type: "test_thing",
|
Type: "test_thing",
|
||||||
Name: "example",
|
Name: "example",
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
ProviderAddr: addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: test.Action,
|
Action: test.Action,
|
||||||
Before: before,
|
Before: before,
|
||||||
|
|
|
@ -274,7 +274,7 @@ func marshalResources(resources map[string]*states.Resource, schemas *terraform.
|
||||||
}
|
}
|
||||||
|
|
||||||
schema, _ := schemas.ResourceTypeConfig(
|
schema, _ := schemas.ResourceTypeConfig(
|
||||||
r.ProviderConfig.ProviderConfig.Type,
|
r.ProviderConfig.ProviderConfig.Type.LegacyString(),
|
||||||
r.Addr.Mode,
|
r.Addr.Mode,
|
||||||
r.Addr.Type,
|
r.Addr.Type,
|
||||||
)
|
)
|
||||||
|
|
|
@ -202,7 +202,7 @@ func TestMarshalResources(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.ProviderConfig{
|
ProviderConfig: addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -245,7 +245,7 @@ func TestMarshalResources(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.ProviderConfig{
|
ProviderConfig: addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -293,7 +293,7 @@ func TestMarshalResources(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.ProviderConfig{
|
ProviderConfig: addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -124,7 +124,7 @@ func TestPlan_destroy(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
outPath := testTempFile(t)
|
outPath := testTempFile(t)
|
||||||
|
@ -240,7 +240,7 @@ func TestPlan_outPathNoChange(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","ami":"bar","network_interface":[{"description":"Main network interface","device_index":"0"}]}`),
|
AttrsJSON: []byte(`{"id":"bar","ami":"bar","network_interface":[{"description":"Main network interface","device_index":"0"}]}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, originalState)
|
statePath := testStateFile(t, originalState)
|
||||||
|
|
|
@ -400,7 +400,7 @@ func showFixturePlanFile(t *testing.T) string {
|
||||||
Type: "test_instance",
|
Type: "test_instance",
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
ProviderAddr: addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.Create,
|
Action: plans.Create,
|
||||||
Before: priorValRaw,
|
Before: priorValRaw,
|
||||||
|
|
|
@ -27,7 +27,7 @@ func TestStateMv(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -39,7 +39,7 @@ func TestStateMv(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -87,7 +87,7 @@ func TestStateMv_resourceToInstance(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -99,7 +99,7 @@ func TestStateMv_resourceToInstance(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceMeta(
|
s.SetResourceMeta(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -108,7 +108,7 @@ func TestStateMv_resourceToInstance(t *testing.T) {
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
states.EachList,
|
states.EachList,
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -167,7 +167,7 @@ func TestStateMv_instanceToResource(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -179,7 +179,7 @@ func TestStateMv_instanceToResource(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -317,7 +317,7 @@ func TestStateMv_differentResourceTypes(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -367,7 +367,7 @@ func TestStateMv_explicitWithBackend(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -379,7 +379,7 @@ func TestStateMv_explicitWithBackend(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -436,7 +436,7 @@ func TestStateMv_backupExplicit(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -448,7 +448,7 @@ func TestStateMv_backupExplicit(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -494,7 +494,7 @@ func TestStateMv_stateOutNew(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -545,7 +545,7 @@ func TestStateMv_stateOutExisting(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, stateSrc)
|
statePath := testStateFile(t, stateSrc)
|
||||||
|
@ -561,7 +561,7 @@ func TestStateMv_stateOutExisting(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
stateOutPath := testStateFile(t, stateDst)
|
stateOutPath := testStateFile(t, stateDst)
|
||||||
|
@ -638,7 +638,7 @@ func TestStateMv_stateOutNew_count(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -650,7 +650,7 @@ func TestStateMv_stateOutNew_count(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -662,7 +662,7 @@ func TestStateMv_stateOutNew_count(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -717,7 +717,7 @@ func TestStateMv_stateOutNew_largeCount(t *testing.T) {
|
||||||
AttrsJSON: []byte(fmt.Sprintf(`{"id":"foo%d","foo":"value","bar":"value"}`, i)),
|
AttrsJSON: []byte(fmt.Sprintf(`{"id":"foo%d","foo":"value","bar":"value"}`, i)),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -730,7 +730,7 @@ func TestStateMv_stateOutNew_largeCount(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -781,7 +781,7 @@ func TestStateMv_stateOutNew_nestedModule(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -793,7 +793,7 @@ func TestStateMv_stateOutNew_nestedModule(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -845,7 +845,7 @@ func TestStateMv_toNewModule(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ func TestStateRm(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -37,7 +37,7 @@ func TestStateRm(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -84,7 +84,7 @@ func TestStateRmNotChildModule(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
// This second instance has the same local address as the first but
|
// This second instance has the same local address as the first but
|
||||||
// is in a child module. Older versions of Terraform would incorrectly
|
// is in a child module. Older versions of Terraform would incorrectly
|
||||||
|
@ -99,7 +99,7 @@ func TestStateRmNotChildModule(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -167,7 +167,7 @@ func TestStateRmNoArgs(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -179,7 +179,7 @@ func TestStateRmNoArgs(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -220,7 +220,7 @@ func TestStateRmNonExist(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -232,7 +232,7 @@ func TestStateRmNonExist(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -274,7 +274,7 @@ func TestStateRm_backupExplicit(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -286,7 +286,7 @@ func TestStateRm_backupExplicit(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -384,7 +384,7 @@ func TestStateRm_backendState(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -396,7 +396,7 @@ func TestStateRm_backendState(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ func TestStateShow(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -79,7 +79,7 @@ func TestStateShow_multi(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -91,7 +91,7 @@ func TestStateShow_multi(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
AttrsJSON: []byte(`{"id":"foo","foo":"value","bar":"value"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(submod),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(submod),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
|
|
@ -24,7 +24,7 @@ func TestTaint(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -59,7 +59,7 @@ func TestTaint_lockedState(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -245,7 +245,7 @@ func TestTaint_missing(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -278,7 +278,7 @@ func TestTaint_missingAllow(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -354,7 +354,7 @@ func TestTaint_module(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -366,7 +366,7 @@ func TestTaint_module(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"blah"}`),
|
AttrsJSON: []byte(`{"id":"blah"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
|
|
@ -23,7 +23,7 @@ func TestUntaint(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectTainted,
|
Status: states.ObjectTainted,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -63,7 +63,7 @@ func TestUntaint_lockedState(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectTainted,
|
Status: states.ObjectTainted,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -271,7 +271,7 @@ func TestUntaint_missing(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectTainted,
|
Status: states.ObjectTainted,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -304,7 +304,7 @@ func TestUntaint_missingAllow(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectTainted,
|
Status: states.ObjectTainted,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
@ -389,7 +389,7 @@ func TestUntaint_module(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectTainted,
|
Status: states.ObjectTainted,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
addrs.Resource{
|
addrs.Resource{
|
||||||
|
@ -401,7 +401,7 @@ func TestUntaint_module(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectTainted,
|
Status: states.ObjectTainted,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
statePath := testStateFile(t, state)
|
statePath := testStateFile(t, state)
|
||||||
|
|
|
@ -241,7 +241,7 @@ func TestWorkspace_createWithState(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -191,11 +191,11 @@ func (c *Config) gatherProviderTypes(m map[string]struct{}) {
|
||||||
}
|
}
|
||||||
for _, rc := range c.Module.ManagedResources {
|
for _, rc := range c.Module.ManagedResources {
|
||||||
providerAddr := rc.ProviderConfigAddr()
|
providerAddr := rc.ProviderConfigAddr()
|
||||||
m[providerAddr.Type] = struct{}{}
|
m[providerAddr.Type.LegacyString()] = struct{}{}
|
||||||
}
|
}
|
||||||
for _, rc := range c.Module.DataResources {
|
for _, rc := range c.Module.DataResources {
|
||||||
providerAddr := rc.ProviderConfigAddr()
|
providerAddr := rc.ProviderConfigAddr()
|
||||||
m[providerAddr.Type] = struct{}{}
|
m[providerAddr.Type.LegacyString()] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must also visit our child modules, recursively.
|
// Must also visit our child modules, recursively.
|
||||||
|
|
|
@ -95,7 +95,7 @@ func decodeProviderBlock(block *hcl.Block) (*Provider, hcl.Diagnostics) {
|
||||||
// to its containing module.
|
// to its containing module.
|
||||||
func (p *Provider) Addr() addrs.ProviderConfig {
|
func (p *Provider) Addr() addrs.ProviderConfig {
|
||||||
return addrs.ProviderConfig{
|
return addrs.ProviderConfig{
|
||||||
Type: p.Name,
|
Type: addrs.NewLegacyProvider(p.Name),
|
||||||
Alias: p.Alias,
|
Alias: p.Alias,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ func (r *Resource) ProviderConfigAddr() addrs.ProviderConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
return addrs.ProviderConfig{
|
return addrs.ProviderConfig{
|
||||||
Type: r.ProviderConfigRef.Name,
|
Type: addrs.NewLegacyProvider(r.ProviderConfigRef.Name),
|
||||||
Alias: r.ProviderConfigRef.Alias,
|
Alias: r.ProviderConfigRef.Alias,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -447,7 +447,7 @@ func decodeProviderConfigRef(expr hcl.Expression, argName string) (*ProviderConf
|
||||||
// location information and keeping just the addressing information.
|
// location information and keeping just the addressing information.
|
||||||
func (r *ProviderConfigRef) Addr() addrs.ProviderConfig {
|
func (r *ProviderConfigRef) Addr() addrs.ProviderConfig {
|
||||||
return addrs.ProviderConfig{
|
return addrs.ProviderConfig{
|
||||||
Type: r.Name,
|
Type: addrs.NewLegacyProvider(r.Name),
|
||||||
Alias: r.Alias,
|
Alias: r.Alias,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ func shimNewState(newState *states.State, providers map[string]terraform.Resourc
|
||||||
resType := res.Addr.Type
|
resType := res.Addr.Type
|
||||||
providerType := res.ProviderConfig.ProviderConfig.Type
|
providerType := res.ProviderConfig.ProviderConfig.Type
|
||||||
|
|
||||||
resource := getResource(providers, providerType, res.Addr)
|
resource := getResource(providers, providerType.LegacyString(), res.Addr)
|
||||||
|
|
||||||
for key, i := range res.Instances {
|
for key, i := range res.Instances {
|
||||||
resState := &terraform.ResourceState{
|
resState := &terraform.ResourceState{
|
||||||
|
|
|
@ -42,7 +42,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
rootModule.SetResourceInstanceCurrent(
|
rootModule.SetResourceInstanceCurrent(
|
||||||
|
@ -57,7 +57,7 @@ func TestStateShim(t *testing.T) {
|
||||||
DependsOn: []addrs.Referenceable{},
|
DependsOn: []addrs.Referenceable{},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func TestStateShim(t *testing.T) {
|
||||||
DependsOn: []addrs.Referenceable{},
|
DependsOn: []addrs.Referenceable{},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(childInstance),
|
}.Absolute(childInstance),
|
||||||
)
|
)
|
||||||
childModule.SetResourceInstanceCurrent(
|
childModule.SetResourceInstanceCurrent(
|
||||||
|
@ -98,7 +98,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(childInstance),
|
}.Absolute(childInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ func TestStateShim(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(childInstance),
|
}.Absolute(childInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ func TestStateShim(t *testing.T) {
|
||||||
DependsOn: []addrs.Referenceable{},
|
DependsOn: []addrs.Referenceable{},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(childInstance),
|
}.Absolute(childInstance),
|
||||||
)
|
)
|
||||||
childModule.SetResourceInstanceCurrent(
|
childModule.SetResourceInstanceCurrent(
|
||||||
|
@ -154,7 +154,7 @@ func TestStateShim(t *testing.T) {
|
||||||
DependsOn: []addrs.Referenceable{},
|
DependsOn: []addrs.Referenceable{},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(childInstance),
|
}.Absolute(childInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ func TestStateShim(t *testing.T) {
|
||||||
DependsOn: []addrs.Referenceable{},
|
DependsOn: []addrs.Referenceable{},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(childInstance),
|
}.Absolute(childInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -727,7 +727,7 @@ func testIDOnlyRefresh(c TestCase, opts terraform.ContextOpts, step TestStep, r
|
||||||
AttrsFlat: r.Primary.Attributes,
|
AttrsFlat: r.Primary.Attributes,
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "placeholder"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("placeholder")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create the config module. We use the full config because Refresh
|
// Create the config module. We use the full config because Refresh
|
||||||
|
|
|
@ -137,7 +137,7 @@ func testStepImportState(
|
||||||
// this shouldn't happen in any reasonable case.
|
// this shouldn't happen in any reasonable case.
|
||||||
var rsrcSchema *schema.Resource
|
var rsrcSchema *schema.Resource
|
||||||
if providerAddr, diags := addrs.ParseAbsProviderConfigStr(r.Provider); !diags.HasErrors() {
|
if providerAddr, diags := addrs.ParseAbsProviderConfigStr(r.Provider); !diags.HasErrors() {
|
||||||
providerType := providerAddr.ProviderConfig.Type
|
providerType := providerAddr.ProviderConfig.Type.LegacyString()
|
||||||
if provider, ok := step.providers[providerType]; ok {
|
if provider, ok := step.providers[providerType]; ok {
|
||||||
if provider, ok := provider.(*schema.Provider); ok {
|
if provider, ok := provider.(*schema.Provider); ok {
|
||||||
rsrcSchema = provider.ResourcesMap[r.Type]
|
rsrcSchema = provider.ResourcesMap[r.Type]
|
||||||
|
|
|
@ -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.ProviderConfig{
|
ProviderAddr: addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,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.ProviderConfig{
|
ProviderAddr: addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,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.ProviderConfig{
|
ProviderAddr: addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance.Child("foo", addrs.NoKey)),
|
}.Absolute(addrs.RootModuleInstance.Child("foo", addrs.NoKey)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -52,10 +52,10 @@ func TestProviderAddrs(t *testing.T) {
|
||||||
got := plan.ProviderAddrs()
|
got := plan.ProviderAddrs()
|
||||||
want := []addrs.AbsProviderConfig{
|
want := []addrs.AbsProviderConfig{
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance.Child("foo", addrs.NoKey)),
|
}.Absolute(addrs.RootModuleInstance.Child("foo", addrs.NoKey)),
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ func TestTFPlanRoundTrip(t *testing.T) {
|
||||||
Name: "woot",
|
Name: "woot",
|
||||||
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.ProviderConfig{
|
ProviderAddr: addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.DeleteThenCreate,
|
Action: plans.DeleteThenCreate,
|
||||||
|
@ -77,7 +77,7 @@ func TestTFPlanRoundTrip(t *testing.T) {
|
||||||
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
||||||
DeposedKey: "foodface",
|
DeposedKey: "foodface",
|
||||||
ProviderAddr: addrs.ProviderConfig{
|
ProviderAddr: addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.Delete,
|
Action: plans.Delete,
|
||||||
|
@ -195,7 +195,7 @@ func TestTFPlanRoundTripDestroy(t *testing.T) {
|
||||||
Name: "woot",
|
Name: "woot",
|
||||||
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.ProviderConfig{
|
ProviderAddr: addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.Delete,
|
Action: plans.Delete,
|
||||||
|
|
|
@ -14,7 +14,7 @@ func AddressedTypes(providerAddrs []addrs.ProviderConfig) []string {
|
||||||
}
|
}
|
||||||
m := map[string]struct{}{}
|
m := map[string]struct{}{}
|
||||||
for _, addr := range providerAddrs {
|
for _, addr := range providerAddrs {
|
||||||
m[addr.Type] = struct{}{}
|
m[addr.Type.LegacyString()] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
names := make([]string, 0, len(m))
|
names := make([]string, 0, len(m))
|
||||||
|
@ -34,7 +34,7 @@ func AddressedTypesAbs(providerAddrs []addrs.AbsProviderConfig) []string {
|
||||||
}
|
}
|
||||||
m := map[string]struct{}{}
|
m := map[string]struct{}{}
|
||||||
for _, addr := range providerAddrs {
|
for _, addr := range providerAddrs {
|
||||||
m[addr.ProviderConfig.Type] = struct{}{}
|
m[addr.ProviderConfig.Type.LegacyString()] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
names := make([]string, 0, len(m))
|
names := make([]string, 0, len(m))
|
||||||
|
|
|
@ -10,11 +10,11 @@ import (
|
||||||
|
|
||||||
func TestAddressedTypes(t *testing.T) {
|
func TestAddressedTypes(t *testing.T) {
|
||||||
providerAddrs := []addrs.ProviderConfig{
|
providerAddrs := []addrs.ProviderConfig{
|
||||||
{Type: "aws"},
|
{Type: addrs.NewLegacyProvider("aws")},
|
||||||
{Type: "aws", Alias: "foo"},
|
{Type: addrs.NewLegacyProvider("aws"), Alias: "foo"},
|
||||||
{Type: "azure"},
|
{Type: addrs.NewLegacyProvider("azure")},
|
||||||
{Type: "null"},
|
{Type: addrs.NewLegacyProvider("null")},
|
||||||
{Type: "null"},
|
{Type: addrs.NewLegacyProvider("null")},
|
||||||
}
|
}
|
||||||
|
|
||||||
got := AddressedTypes(providerAddrs)
|
got := AddressedTypes(providerAddrs)
|
||||||
|
@ -30,11 +30,11 @@ func TestAddressedTypes(t *testing.T) {
|
||||||
|
|
||||||
func TestAddressedTypesAbs(t *testing.T) {
|
func TestAddressedTypesAbs(t *testing.T) {
|
||||||
providerAddrs := []addrs.AbsProviderConfig{
|
providerAddrs := []addrs.AbsProviderConfig{
|
||||||
addrs.ProviderConfig{Type: "aws"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("aws")}.Absolute(addrs.RootModuleInstance),
|
||||||
addrs.ProviderConfig{Type: "aws", Alias: "foo"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("aws"), Alias: "foo"}.Absolute(addrs.RootModuleInstance),
|
||||||
addrs.ProviderConfig{Type: "azure"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("azure")}.Absolute(addrs.RootModuleInstance),
|
||||||
addrs.ProviderConfig{Type: "null"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("null")}.Absolute(addrs.RootModuleInstance),
|
||||||
addrs.ProviderConfig{Type: "null"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("null")}.Absolute(addrs.RootModuleInstance),
|
||||||
}
|
}
|
||||||
|
|
||||||
got := AddressedTypesAbs(providerAddrs)
|
got := AddressedTypesAbs(providerAddrs)
|
||||||
|
|
|
@ -46,7 +46,7 @@ func TestSession_basicState(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -60,7 +60,7 @@ func TestSession_basicState(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar"}`),
|
AttrsJSON: []byte(`{"id":"bar"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -36,7 +36,7 @@ func TestState(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"woozles":"confuzles"}`),
|
AttrsJSON: []byte(`{"woozles":"confuzles"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ func TestState(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.ProviderConfig{
|
ProviderConfig: addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -141,7 +141,7 @@ func TestStateDeepCopy(t *testing.T) {
|
||||||
Dependencies: []addrs.AbsResource{},
|
Dependencies: []addrs.AbsResource{},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
rootModule.SetResourceInstanceCurrent(
|
rootModule.SetResourceInstanceCurrent(
|
||||||
|
@ -167,7 +167,7 @@ func TestStateDeepCopy(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1371,7 +1371,7 @@ func TestContext2Apply_destroyDependsOnStateOnly(t *testing.T) {
|
||||||
Dependencies: []addrs.AbsResource{},
|
Dependencies: []addrs.AbsResource{},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -1395,7 +1395,7 @@ func TestContext2Apply_destroyDependsOnStateOnly(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1498,7 +1498,7 @@ func TestContext2Apply_destroyDependsOnStateOnlyModule(t *testing.T) {
|
||||||
Dependencies: []addrs.AbsResource{},
|
Dependencies: []addrs.AbsResource{},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
child.SetResourceInstanceCurrent(
|
child.SetResourceInstanceCurrent(
|
||||||
|
@ -1522,7 +1522,7 @@ func TestContext2Apply_destroyDependsOnStateOnlyModule(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2145,7 +2145,7 @@ func TestContext2Apply_provisionerDestroyForEach(t *testing.T) {
|
||||||
},
|
},
|
||||||
ProviderConfig: addrs.AbsProviderConfig{
|
ProviderConfig: addrs.AbsProviderConfig{
|
||||||
Module: addrs.ModuleInstance(nil),
|
Module: addrs.ModuleInstance(nil),
|
||||||
ProviderConfig: addrs.ProviderConfig{Type: "aws", Alias: ""},
|
ProviderConfig: addrs.ProviderConfig{Type: addrs.NewLegacyProvider("aws"), Alias: ""},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -2966,7 +2966,7 @@ func TestContext2Apply_orphanResource(t *testing.T) {
|
||||||
// with the single instance associated with test_thing.one.
|
// with the single instance associated with test_thing.one.
|
||||||
want := states.BuildState(func(s *states.SyncState) {
|
want := states.BuildState(func(s *states.SyncState) {
|
||||||
providerAddr := addrs.ProviderConfig{
|
providerAddr := addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance)
|
}.Absolute(addrs.RootModuleInstance)
|
||||||
zeroAddr := addrs.Resource{
|
zeroAddr := addrs.Resource{
|
||||||
Mode: addrs.ManagedResourceMode,
|
Mode: addrs.ManagedResourceMode,
|
||||||
|
@ -7386,7 +7386,7 @@ func TestContext2Apply_errorDestroy(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"baz"}`),
|
AttrsJSON: []byte(`{"id":"baz"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
@ -7525,7 +7525,7 @@ func TestContext2Apply_errorUpdateNullNew(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"value":"old"}`),
|
AttrsJSON: []byte(`{"value":"old"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
@ -9188,7 +9188,7 @@ func TestContext2Apply_createBefore_depends(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","require_new":"ami-old"}`),
|
AttrsJSON: []byte(`{"id":"bar","require_new":"ami-old"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -9213,7 +9213,7 @@ func TestContext2Apply_createBefore_depends(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -9319,7 +9319,7 @@ func TestContext2Apply_singleDestroy(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","require_new":"ami-old"}`),
|
AttrsJSON: []byte(`{"id":"bar","require_new":"ami-old"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -9344,7 +9344,7 @@ func TestContext2Apply_singleDestroy(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10262,7 +10262,7 @@ func TestContext2Apply_destroyWithProviders(t *testing.T) {
|
||||||
|
|
||||||
// correct the state
|
// correct the state
|
||||||
s.Modules["module.mod.module.removed"].Resources["aws_instance.child"].ProviderConfig = addrs.ProviderConfig{
|
s.Modules["module.mod.module.removed"].Resources["aws_instance.child"].ProviderConfig = addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
Alias: "bar",
|
Alias: "bar",
|
||||||
}.Absolute(addrs.RootModuleInstance)
|
}.Absolute(addrs.RootModuleInstance)
|
||||||
|
|
||||||
|
@ -10687,7 +10687,7 @@ func TestContext2Apply_issue19908(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
@ -10814,7 +10814,7 @@ func TestContext2Apply_moduleReplaceCycle(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"a","require_new":"old"}`),
|
AttrsJSON: []byte(`{"id":"a","require_new":"old"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10830,7 +10830,7 @@ func TestContext2Apply_moduleReplaceCycle(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"b","require_new":"old"}`),
|
AttrsJSON: []byte(`{"id":"b","require_new":"old"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10872,7 +10872,7 @@ func TestContext2Apply_moduleReplaceCycle(t *testing.T) {
|
||||||
Name: "a",
|
Name: "a",
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance.Child("a", addrs.NoKey)),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance.Child("a", addrs.NoKey)),
|
||||||
ProviderAddr: addrs.ProviderConfig{
|
ProviderAddr: addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: aAction,
|
Action: aAction,
|
||||||
|
@ -10887,7 +10887,7 @@ func TestContext2Apply_moduleReplaceCycle(t *testing.T) {
|
||||||
Name: "b",
|
Name: "b",
|
||||||
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance.Child("b", addrs.NoKey)),
|
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance.Child("b", addrs.NoKey)),
|
||||||
ProviderAddr: addrs.ProviderConfig{
|
ProviderAddr: addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.DeleteThenCreate,
|
Action: plans.DeleteThenCreate,
|
||||||
|
@ -10937,7 +10937,7 @@ func TestContext2Apply_destroyDataCycle(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"a"}`),
|
AttrsJSON: []byte(`{"id":"a"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "null",
|
Type: addrs.NewLegacyProvider("null"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -10951,7 +10951,7 @@ func TestContext2Apply_destroyDataCycle(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"data"}`),
|
AttrsJSON: []byte(`{"id":"data"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "null",
|
Type: addrs.NewLegacyProvider("null"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11025,7 +11025,7 @@ func TestContext2Apply_taintedDestroyFailure(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"a","foo":"a"}`),
|
AttrsJSON: []byte(`{"id":"a","foo":"a"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -11039,7 +11039,7 @@ func TestContext2Apply_taintedDestroyFailure(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"b","foo":"b"}`),
|
AttrsJSON: []byte(`{"id":"b","foo":"b"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -11053,7 +11053,7 @@ func TestContext2Apply_taintedDestroyFailure(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"c","foo":"old"}`),
|
AttrsJSON: []byte(`{"id":"c","foo":"old"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11168,7 +11168,7 @@ func TestContext2Apply_cbdCycle(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -11192,7 +11192,7 @@ func TestContext2Apply_cbdCycle(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -11206,7 +11206,7 @@ func TestContext2Apply_cbdCycle(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"c","require_new":"old"}`),
|
AttrsJSON: []byte(`{"id":"c","require_new":"old"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -33,16 +33,15 @@ type basicComponentFactory struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *basicComponentFactory) ResourceProviders() []string {
|
func (c *basicComponentFactory) ResourceProviders() []string {
|
||||||
result := make([]string, len(c.providers))
|
var result []string
|
||||||
for k := range c.providers {
|
for k := range c.providers {
|
||||||
result = append(result, k.LegacyString())
|
result = append(result, k.LegacyString())
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *basicComponentFactory) ResourceProvisioners() []string {
|
func (c *basicComponentFactory) ResourceProvisioners() []string {
|
||||||
result := make([]string, len(c.provisioners))
|
var result []string
|
||||||
for k := range c.provisioners {
|
for k := range c.provisioners {
|
||||||
result = append(result, k)
|
result = append(result, k)
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ func TestContextImport_collision(t *testing.T) {
|
||||||
},
|
},
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "aws"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("aws")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
@ -601,7 +601,7 @@ func TestContextImport_moduleDiff(t *testing.T) {
|
||||||
},
|
},
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "aws"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("aws")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
@ -659,7 +659,7 @@ func TestContextImport_moduleExisting(t *testing.T) {
|
||||||
},
|
},
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "aws"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("aws")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
|
@ -96,7 +96,7 @@ func (c *Context) Input(mode InputMode) tfdiags.Diagnostics {
|
||||||
UIInput: c.uiInput,
|
UIInput: c.uiInput,
|
||||||
}
|
}
|
||||||
|
|
||||||
schema := c.schemas.ProviderConfig(pa.Type)
|
schema := c.schemas.ProviderConfig(pa.Type.LegacyString())
|
||||||
if schema == nil {
|
if schema == nil {
|
||||||
// Could either be an incorrect config or just an incomplete
|
// Could either be an incorrect config or just an incomplete
|
||||||
// mock in tests. We'll let a later pass decide, and just
|
// mock in tests. We'll let a later pass decide, and just
|
||||||
|
|
|
@ -478,7 +478,7 @@ func TestContext2Input_dataSourceRequiresRefresh(t *testing.T) {
|
||||||
},
|
},
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "null"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("null")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -4976,7 +4976,7 @@ func TestContext2Plan_ignoreChangesInMap(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"tags":{"ignored":"from state","other":"from state"}}`),
|
AttrsJSON: []byte(`{"tags":{"ignored":"from state","other":"from state"}}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -104,7 +104,7 @@ func TestContext2Refresh_dynamicAttr(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"dynamic":{"type":"string","value":"hello"}}`),
|
AttrsJSON: []byte(`{"dynamic":{"type":"string","value":"hello"}}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1739,7 +1739,7 @@ func TestContext2Refresh_schemaUpgradeFlatmap(t *testing.T) {
|
||||||
"id": "foo",
|
"id": "foo",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1822,7 +1822,7 @@ func TestContext2Refresh_schemaUpgradeJSON(t *testing.T) {
|
||||||
SchemaVersion: 3,
|
SchemaVersion: 3,
|
||||||
AttrsJSON: []byte(`{"id":"foo"}`),
|
AttrsJSON: []byte(`{"id":"foo"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{Type: "test"}.Absolute(addrs.RootModuleInstance),
|
addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1991,7 +1991,7 @@ func TestRefresh_updateDependencies(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -2005,7 +2005,7 @@ func TestRefresh_updateDependencies(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"bar","foo":"foo"}`),
|
AttrsJSON: []byte(`{"id":"bar","foo":"foo"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ func (ctx *BuiltinEvalContext) Provider(addr addrs.AbsProviderConfig) providers.
|
||||||
func (ctx *BuiltinEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) *ProviderSchema {
|
func (ctx *BuiltinEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) *ProviderSchema {
|
||||||
ctx.once.Do(ctx.init)
|
ctx.once.Do(ctx.init)
|
||||||
|
|
||||||
return ctx.Schemas.ProviderSchema(addr.ProviderConfig.Type)
|
return ctx.Schemas.ProviderSchema(addr.ProviderConfig.Type.LegacyString())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *BuiltinEvalContext) CloseProvider(addr addrs.ProviderConfig) error {
|
func (ctx *BuiltinEvalContext) CloseProvider(addr addrs.ProviderConfig) error {
|
||||||
|
|
|
@ -24,7 +24,7 @@ func TestBuiltinEvalContextProviderInput(t *testing.T) {
|
||||||
ctx2.ProviderInputConfig = cache
|
ctx2.ProviderInputConfig = cache
|
||||||
ctx2.ProviderLock = &lock
|
ctx2.ProviderLock = &lock
|
||||||
|
|
||||||
providerAddr := addrs.ProviderConfig{Type: "foo"}
|
providerAddr := addrs.ProviderConfig{Type: addrs.NewLegacyProvider("foo")}
|
||||||
|
|
||||||
expected1 := map[string]cty.Value{"value": cty.StringVal("foo")}
|
expected1 := map[string]cty.Value{"value": cty.StringVal("foo")}
|
||||||
ctx1.SetProviderInput(providerAddr, expected1)
|
ctx1.SetProviderInput(providerAddr, expected1)
|
||||||
|
@ -57,8 +57,8 @@ func TestBuildingEvalContextInitProvider(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
providerAddrDefault := addrs.ProviderConfig{Type: "test"}
|
providerAddrDefault := addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test")}
|
||||||
providerAddrAlias := addrs.ProviderConfig{Type: "test", Alias: "foo"}
|
providerAddrAlias := addrs.ProviderConfig{Type: addrs.NewLegacyProvider("test"), Alias: "foo"}
|
||||||
|
|
||||||
_, err := ctx.InitProvider("test", providerAddrDefault)
|
_, err := ctx.InitProvider("test", providerAddrDefault)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -120,7 +120,7 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
|
||||||
if providerSchema == nil {
|
if providerSchema == nil {
|
||||||
return nil, fmt.Errorf("provider schema is unavailable for %s", n.Addr)
|
return nil, fmt.Errorf("provider schema is unavailable for %s", n.Addr)
|
||||||
}
|
}
|
||||||
if n.ProviderAddr.ProviderConfig.Type == "" {
|
if n.ProviderAddr.ProviderConfig.Type.LegacyString() == "" {
|
||||||
panic(fmt.Sprintf("EvalDiff for %s does not have ProviderAddr set", n.Addr.Absolute(ctx.Path())))
|
panic(fmt.Sprintf("EvalDiff for %s does not have ProviderAddr set", n.Addr.Absolute(ctx.Path())))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ func (n *EvalDiffDestroy) Eval(ctx EvalContext) (interface{}, error) {
|
||||||
absAddr := n.Addr.Absolute(ctx.Path())
|
absAddr := n.Addr.Absolute(ctx.Path())
|
||||||
state := *n.State
|
state := *n.State
|
||||||
|
|
||||||
if n.ProviderAddr.ProviderConfig.Type == "" {
|
if n.ProviderAddr.ProviderConfig.Type.LegacyString() == "" {
|
||||||
if n.DeposedKey == "" {
|
if n.DeposedKey == "" {
|
||||||
panic(fmt.Sprintf("EvalDiffDestroy for %s does not have ProviderAddr set", absAddr))
|
panic(fmt.Sprintf("EvalDiffDestroy for %s does not have ProviderAddr set", absAddr))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -125,7 +125,7 @@ type EvalGetProvider struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *EvalGetProvider) Eval(ctx EvalContext) (interface{}, error) {
|
func (n *EvalGetProvider) Eval(ctx EvalContext) (interface{}, error) {
|
||||||
if n.Addr.ProviderConfig.Type == "" {
|
if n.Addr.ProviderConfig.Type.LegacyString() == "" {
|
||||||
// Should never happen
|
// Should never happen
|
||||||
panic("EvalGetProvider used with uninitialized provider configuration address")
|
panic("EvalGetProvider used with uninitialized provider configuration address")
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ func TestBuildProviderConfig(t *testing.T) {
|
||||||
"set_in_config": cty.StringVal("config"),
|
"set_in_config": cty.StringVal("config"),
|
||||||
})
|
})
|
||||||
providerAddr := addrs.ProviderConfig{
|
providerAddr := addrs.ProviderConfig{
|
||||||
Type: "foo",
|
Type: addrs.NewLegacyProvider("foo"),
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := &MockEvalContext{
|
ctx := &MockEvalContext{
|
||||||
|
@ -68,7 +68,7 @@ func TestEvalConfigProvider(t *testing.T) {
|
||||||
provider := mockProviderWithConfigSchema(simpleTestSchema())
|
provider := mockProviderWithConfigSchema(simpleTestSchema())
|
||||||
rp := providers.Interface(provider)
|
rp := providers.Interface(provider)
|
||||||
n := &EvalConfigProvider{
|
n := &EvalConfigProvider{
|
||||||
Addr: addrs.ProviderConfig{Type: "foo"},
|
Addr: addrs.ProviderConfig{Type: addrs.NewLegacyProvider("foo")},
|
||||||
Config: config,
|
Config: config,
|
||||||
Provider: &rp,
|
Provider: &rp,
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ func TestEvalInitProvider_impl(t *testing.T) {
|
||||||
|
|
||||||
func TestEvalInitProvider(t *testing.T) {
|
func TestEvalInitProvider(t *testing.T) {
|
||||||
n := &EvalInitProvider{
|
n := &EvalInitProvider{
|
||||||
Addr: addrs.ProviderConfig{Type: "foo"},
|
Addr: addrs.ProviderConfig{Type: addrs.NewLegacyProvider("foo")},
|
||||||
}
|
}
|
||||||
provider := &MockProvider{}
|
provider := &MockProvider{}
|
||||||
ctx := &MockEvalContext{InitProviderProvider: provider}
|
ctx := &MockEvalContext{InitProviderProvider: provider}
|
||||||
|
@ -116,7 +116,7 @@ func TestEvalInitProvider(t *testing.T) {
|
||||||
|
|
||||||
func TestEvalCloseProvider(t *testing.T) {
|
func TestEvalCloseProvider(t *testing.T) {
|
||||||
n := &EvalCloseProvider{
|
n := &EvalCloseProvider{
|
||||||
Addr: addrs.ProviderConfig{Type: "foo"},
|
Addr: addrs.ProviderConfig{Type: addrs.NewLegacyProvider("foo")},
|
||||||
}
|
}
|
||||||
provider := &MockProvider{}
|
provider := &MockProvider{}
|
||||||
ctx := &MockEvalContext{CloseProviderProvider: provider}
|
ctx := &MockEvalContext{CloseProviderProvider: provider}
|
||||||
|
|
|
@ -217,7 +217,7 @@ func (n *EvalWriteState) Eval(ctx EvalContext) (interface{}, error) {
|
||||||
absAddr := n.Addr.Absolute(ctx.Path())
|
absAddr := n.Addr.Absolute(ctx.Path())
|
||||||
state := ctx.State()
|
state := ctx.State()
|
||||||
|
|
||||||
if n.ProviderAddr.ProviderConfig.Type == "" {
|
if n.ProviderAddr.ProviderConfig.Type.LegacyString() == "" {
|
||||||
return nil, fmt.Errorf("failed to write state for %s, missing provider type", absAddr)
|
return nil, fmt.Errorf("failed to write state for %s, missing provider type", absAddr)
|
||||||
}
|
}
|
||||||
obj := *n.State
|
obj := *n.State
|
||||||
|
|
|
@ -16,7 +16,7 @@ func ProviderEvalTree(n *NodeApplyableProvider, config *configs.Provider) EvalNo
|
||||||
|
|
||||||
seq := make([]EvalNode, 0, 5)
|
seq := make([]EvalNode, 0, 5)
|
||||||
seq = append(seq, &EvalInitProvider{
|
seq = append(seq, &EvalInitProvider{
|
||||||
TypeName: relAddr.Type,
|
TypeName: relAddr.Type.LegacyString(),
|
||||||
Addr: addr.ProviderConfig,
|
Addr: addr.ProviderConfig,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -779,7 +779,7 @@ func (d *evaluationStateData) getResourceInstancesAll(addr addrs.Resource, rng t
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *evaluationStateData) getResourceSchema(addr addrs.Resource, providerAddr addrs.AbsProviderConfig) *configschema.Block {
|
func (d *evaluationStateData) getResourceSchema(addr addrs.Resource, providerAddr addrs.AbsProviderConfig) *configschema.Block {
|
||||||
providerType := providerAddr.ProviderConfig.Type
|
providerType := providerAddr.ProviderConfig.Type.LegacyString()
|
||||||
schemas := d.Evaluator.Schemas
|
schemas := d.Evaluator.Schemas
|
||||||
schema, _ := schemas.ResourceTypeConfig(providerType, addr.Mode, addr.Type)
|
schema, _ := schemas.ResourceTypeConfig(providerType, addr.Mode, addr.Type)
|
||||||
return schema
|
return schema
|
||||||
|
|
|
@ -215,7 +215,7 @@ func (d *evaluationStateData) staticValidateResourceReference(modCfg *configs.Co
|
||||||
// Normally accessing this directly is wrong because it doesn't take into
|
// Normally accessing this directly is wrong because it doesn't take into
|
||||||
// account provider inheritance, etc but it's okay here because we're only
|
// account provider inheritance, etc but it's okay here because we're only
|
||||||
// paying attention to the type anyway.
|
// paying attention to the type anyway.
|
||||||
providerType := cfg.ProviderConfigAddr().Type
|
providerType := cfg.ProviderConfigAddr().Type.LegacyString()
|
||||||
schema, _ := d.Evaluator.Schemas.ResourceTypeConfig(providerType, addr.Mode, addr.Type)
|
schema, _ := d.Evaluator.Schemas.ResourceTypeConfig(providerType, addr.Mode, addr.Type)
|
||||||
|
|
||||||
if schema == nil {
|
if schema == nil {
|
||||||
|
|
|
@ -545,7 +545,7 @@ func TestApplyGraphBuilder_updateFromOrphan(t *testing.T) {
|
||||||
AttrsJSON: []byte(`{"id":"a_id"}`),
|
AttrsJSON: []byte(`{"id":"a_id"}`),
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
root.SetResourceInstanceCurrent(
|
root.SetResourceInstanceCurrent(
|
||||||
|
@ -569,7 +569,7 @@ func TestApplyGraphBuilder_updateFromOrphan(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "test",
|
Type: addrs.NewLegacyProvider("test"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,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{
|
||||||
ProviderConfig: addrs.ProviderConfig{
|
ProviderConfig: addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -174,7 +174,7 @@ root - terraform.graphNodeRoot
|
||||||
t.Fatal("failed to find a destroyableDataResource")
|
t.Fatal("failed to find a destroyableDataResource")
|
||||||
}
|
}
|
||||||
|
|
||||||
if destroyableDataResource.ResolvedProvider.ProviderConfig.Type == "" {
|
if destroyableDataResource.ResolvedProvider.ProviderConfig.Type.LegacyString() == "" {
|
||||||
t.Fatal("NodeDestroyableDataResourceInstance missing provider config")
|
t.Fatal("NodeDestroyableDataResourceInstance missing provider config")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ func (n *NodeEvalableProvider) EvalTree() EvalNode {
|
||||||
relAddr := addr.ProviderConfig
|
relAddr := addr.ProviderConfig
|
||||||
|
|
||||||
return &EvalInitProvider{
|
return &EvalInitProvider{
|
||||||
TypeName: relAddr.Type,
|
TypeName: relAddr.Type.LegacyString(),
|
||||||
Addr: addr.ProviderConfig,
|
Addr: addr.ProviderConfig,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ func (n *NodePlanDestroyableResourceInstance) EvalTree() EvalNode {
|
||||||
var change *plans.ResourceInstanceChange
|
var change *plans.ResourceInstanceChange
|
||||||
var state *states.ResourceInstanceObject
|
var state *states.ResourceInstanceObject
|
||||||
|
|
||||||
if n.ResolvedProvider.ProviderConfig.Type == "" {
|
if n.ResolvedProvider.ProviderConfig.Type.String() == "" {
|
||||||
// Should never happen; indicates that the graph was not constructed
|
// Should never happen; indicates that the graph was not constructed
|
||||||
// correctly since we didn't get our provider attached.
|
// correctly since we didn't get our provider attached.
|
||||||
panic(fmt.Sprintf("%T %q was not assigned a resolved provider", n, dag.VertexName(n)))
|
panic(fmt.Sprintf("%T %q was not assigned a resolved provider", n, dag.VertexName(n)))
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (t *AttachSchemaTransformer) Transform(g *Graph) error {
|
||||||
mode := addr.Resource.Mode
|
mode := addr.Resource.Mode
|
||||||
typeName := addr.Resource.Type
|
typeName := addr.Resource.Type
|
||||||
providerAddr, _ := tv.ProvidedBy()
|
providerAddr, _ := tv.ProvidedBy()
|
||||||
providerType := providerAddr.ProviderConfig.Type
|
providerType := providerAddr.ProviderConfig.Type.LegacyString()
|
||||||
|
|
||||||
schema, version := t.Schemas.ResourceTypeConfig(providerType, mode, typeName)
|
schema, version := t.Schemas.ResourceTypeConfig(providerType, mode, typeName)
|
||||||
if schema == nil {
|
if schema == nil {
|
||||||
|
@ -72,7 +72,7 @@ func (t *AttachSchemaTransformer) Transform(g *Graph) error {
|
||||||
|
|
||||||
if tv, ok := v.(GraphNodeAttachProviderConfigSchema); ok {
|
if tv, ok := v.(GraphNodeAttachProviderConfigSchema); ok {
|
||||||
providerAddr := tv.ProviderAddr()
|
providerAddr := tv.ProviderAddr()
|
||||||
schema := t.Schemas.ProviderConfig(providerAddr.ProviderConfig.Type)
|
schema := t.Schemas.ProviderConfig(providerAddr.ProviderConfig.Type.LegacyString())
|
||||||
if schema == nil {
|
if schema == nil {
|
||||||
log.Printf("[ERROR] AttachSchemaTransformer: No provider config schema available for %s", providerAddr)
|
log.Printf("[ERROR] AttachSchemaTransformer: No provider config schema available for %s", providerAddr)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -44,7 +44,7 @@ func TestDiffTransformer(t *testing.T) {
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||||
ProviderAddr: addrs.ProviderConfig{
|
ProviderAddr: addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
ChangeSrc: plans.ChangeSrc{
|
ChangeSrc: plans.ChangeSrc{
|
||||||
Action: plans.Update,
|
Action: plans.Update,
|
||||||
|
|
|
@ -20,7 +20,7 @@ func (t *ImportStateTransformer) Transform(g *Graph) error {
|
||||||
// This will be populated if the targets come from the cli, but tests
|
// This will be populated if the targets come from the cli, but tests
|
||||||
// may not specify implied provider addresses.
|
// may not specify implied provider addresses.
|
||||||
providerAddr := target.ProviderAddr
|
providerAddr := target.ProviderAddr
|
||||||
if providerAddr.ProviderConfig.Type == "" {
|
if providerAddr.ProviderConfig.Type.Type == "" {
|
||||||
providerAddr = target.Addr.Resource.Resource.DefaultProviderConfig().Absolute(target.Addr.Module)
|
providerAddr = target.Addr.Resource.Resource.DefaultProviderConfig().Absolute(target.Addr.Module)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -353,7 +353,7 @@ func TestOrphanResourceCountTransformer_ForEachEdgesAdded(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ func TestOrphanResourceCountTransformer_ForEachEdgesAdded(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -27,7 +27,7 @@ func TestOrphanResourceInstanceTransformer(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ func TestOrphanResourceInstanceTransformer(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -93,7 +93,7 @@ func TestOrphanResourceInstanceTransformer_countGood(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -109,7 +109,7 @@ func TestOrphanResourceInstanceTransformer_countGood(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -156,7 +156,7 @@ func TestOrphanResourceInstanceTransformer_countBad(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -172,7 +172,7 @@ func TestOrphanResourceInstanceTransformer_countBad(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -219,7 +219,7 @@ func TestOrphanResourceInstanceTransformer_modules(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -235,7 +235,7 @@ func TestOrphanResourceInstanceTransformer_modules(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -295,7 +295,7 @@ func (t *MissingProviderTransformer) Transform(g *Graph) error {
|
||||||
// We're going to create an implicit _default_ configuration for the
|
// We're going to create an implicit _default_ configuration for the
|
||||||
// referenced provider type in the _root_ module, ignoring all other
|
// referenced provider type in the _root_ module, ignoring all other
|
||||||
// aspects of the resource's declared provider address.
|
// aspects of the resource's declared provider address.
|
||||||
defaultAddr := addrs.RootModuleInstance.ProviderConfigDefault(p.ProviderConfig.Type)
|
defaultAddr := addrs.RootModuleInstance.ProviderConfigDefault(p.ProviderConfig.Type.LegacyString())
|
||||||
key := defaultAddr.String()
|
key := defaultAddr.String()
|
||||||
provider := m[key]
|
provider := m[key]
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ func (t *ProviderConfigTransformer) attachProviderConfigs(g *Graph) error {
|
||||||
|
|
||||||
// Go through the provider configs to find the matching config
|
// Go through the provider configs to find the matching config
|
||||||
for _, p := range mc.Module.ProviderConfigs {
|
for _, p := range mc.Module.ProviderConfigs {
|
||||||
if p.Name == addr.ProviderConfig.Type && p.Alias == addr.ProviderConfig.Alias {
|
if p.Name == addr.ProviderConfig.Type.LegacyString() && p.Alias == addr.ProviderConfig.Alias {
|
||||||
log.Printf("[TRACE] ProviderConfigTransformer: attaching to %q provider configuration from %s", dag.VertexName(v), p.DeclRange)
|
log.Printf("[TRACE] ProviderConfigTransformer: attaching to %q provider configuration from %s", dag.VertexName(v), p.DeclRange)
|
||||||
apn.AttachProvider(p)
|
apn.AttachProvider(p)
|
||||||
break
|
break
|
||||||
|
|
|
@ -71,7 +71,7 @@ func TestMissingProvisionerTransformer_module(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -87,7 +87,7 @@ func TestMissingProvisionerTransformer_module(t *testing.T) {
|
||||||
Status: states.ObjectReady,
|
Status: states.ObjectReady,
|
||||||
},
|
},
|
||||||
addrs.ProviderConfig{
|
addrs.ProviderConfig{
|
||||||
Type: "aws",
|
Type: addrs.NewLegacyProvider("aws"),
|
||||||
}.Absolute(addrs.RootModuleInstance),
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue