Merge pull request #23452 from hashicorp/jbardin/deps
Minor dependency handling fixups
This commit is contained in:
commit
e20a7dea53
|
@ -9175,33 +9175,48 @@ func TestContext2Apply_createBefore_depends(t *testing.T) {
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyFn = testApplyFn
|
p.ApplyFn = testApplyFn
|
||||||
p.DiffFn = testDiffFn
|
p.DiffFn = testDiffFn
|
||||||
state := MustShimLegacyState(&State{
|
state := states.NewState()
|
||||||
Modules: []*ModuleState{
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
&ModuleState{
|
root.SetResourceInstanceCurrent(
|
||||||
Path: rootModulePath,
|
addrs.Resource{
|
||||||
Resources: map[string]*ResourceState{
|
Mode: addrs.ManagedResourceMode,
|
||||||
"aws_instance.web": &ResourceState{
|
|
||||||
Type: "aws_instance",
|
Type: "aws_instance",
|
||||||
Primary: &InstanceState{
|
Name: "web",
|
||||||
ID: "bar",
|
}.Instance(addrs.NoKey),
|
||||||
Attributes: map[string]string{
|
&states.ResourceInstanceObjectSrc{
|
||||||
"require_new": "ami-old",
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"bar","require_new":"ami-old"}`),
|
||||||
},
|
},
|
||||||
},
|
addrs.ProviderConfig{
|
||||||
},
|
Type: "aws",
|
||||||
"aws_instance.lb": &ResourceState{
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
|
)
|
||||||
|
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
addrs.Resource{
|
||||||
|
Mode: addrs.ManagedResourceMode,
|
||||||
Type: "aws_instance",
|
Type: "aws_instance",
|
||||||
Primary: &InstanceState{
|
Name: "lb",
|
||||||
ID: "baz",
|
}.Instance(addrs.NoKey),
|
||||||
Attributes: map[string]string{
|
&states.ResourceInstanceObjectSrc{
|
||||||
"instance": "bar",
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"baz","instance":"bar"}`),
|
||||||
|
Dependencies: []addrs.AbsResource{
|
||||||
|
addrs.AbsResource{
|
||||||
|
Resource: addrs.Resource{
|
||||||
|
Mode: addrs.ManagedResourceMode,
|
||||||
|
Type: "aws_instance",
|
||||||
|
Name: "web",
|
||||||
|
},
|
||||||
|
Module: addrs.RootModuleInstance,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
addrs.ProviderConfig{
|
||||||
},
|
Type: "aws",
|
||||||
},
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
})
|
)
|
||||||
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Hooks: []Hook{h},
|
Hooks: []Hook{h},
|
||||||
|
@ -9241,17 +9256,18 @@ func TestContext2Apply_createBefore_depends(t *testing.T) {
|
||||||
|
|
||||||
// Test that things were managed _in the right order_
|
// Test that things were managed _in the right order_
|
||||||
order := h.States
|
order := h.States
|
||||||
|
|
||||||
diffs := h.Diffs
|
diffs := h.Diffs
|
||||||
if !order[0].IsNull() || diffs[0].Action == plans.Delete {
|
if !order[0].IsNull() || diffs[0].Action == plans.Delete {
|
||||||
t.Fatalf("should create new instance first: %#v", order)
|
t.Fatalf("should create new instance first: %#v", order)
|
||||||
}
|
}
|
||||||
|
|
||||||
if order[1].GetAttr("id").AsString() != "baz" {
|
if order[1].GetAttr("id").AsString() != "baz" {
|
||||||
t.Fatalf("update must happen after create: %#v", order)
|
t.Fatalf("update must happen after create: %#v", order[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
if order[2].GetAttr("id").AsString() != "bar" || diffs[2].Action != plans.Delete {
|
if order[2].GetAttr("id").AsString() != "bar" || diffs[2].Action != plans.Delete {
|
||||||
t.Fatalf("destroy must happen after update: %#v", order)
|
t.Fatalf("destroy must happen after update: %#v", order[2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9290,33 +9306,48 @@ func TestContext2Apply_singleDestroy(t *testing.T) {
|
||||||
return testApplyFn(info, s, d)
|
return testApplyFn(info, s, d)
|
||||||
}
|
}
|
||||||
p.DiffFn = testDiffFn
|
p.DiffFn = testDiffFn
|
||||||
state := MustShimLegacyState(&State{
|
state := states.NewState()
|
||||||
Modules: []*ModuleState{
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
&ModuleState{
|
root.SetResourceInstanceCurrent(
|
||||||
Path: rootModulePath,
|
addrs.Resource{
|
||||||
Resources: map[string]*ResourceState{
|
Mode: addrs.ManagedResourceMode,
|
||||||
"aws_instance.web": &ResourceState{
|
|
||||||
Type: "aws_instance",
|
Type: "aws_instance",
|
||||||
Primary: &InstanceState{
|
Name: "web",
|
||||||
ID: "bar",
|
}.Instance(addrs.NoKey),
|
||||||
Attributes: map[string]string{
|
&states.ResourceInstanceObjectSrc{
|
||||||
"require_new": "ami-old",
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"bar","require_new":"ami-old"}`),
|
||||||
},
|
},
|
||||||
},
|
addrs.ProviderConfig{
|
||||||
},
|
Type: "aws",
|
||||||
"aws_instance.lb": &ResourceState{
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
|
)
|
||||||
|
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
addrs.Resource{
|
||||||
|
Mode: addrs.ManagedResourceMode,
|
||||||
Type: "aws_instance",
|
Type: "aws_instance",
|
||||||
Primary: &InstanceState{
|
Name: "lb",
|
||||||
ID: "baz",
|
}.Instance(addrs.NoKey),
|
||||||
Attributes: map[string]string{
|
&states.ResourceInstanceObjectSrc{
|
||||||
"instance": "bar",
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"baz","instance":"bar"}`),
|
||||||
|
Dependencies: []addrs.AbsResource{
|
||||||
|
addrs.AbsResource{
|
||||||
|
Resource: addrs.Resource{
|
||||||
|
Mode: addrs.ManagedResourceMode,
|
||||||
|
Type: "aws_instance",
|
||||||
|
Name: "web",
|
||||||
|
},
|
||||||
|
Module: addrs.RootModuleInstance,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
addrs.ProviderConfig{
|
||||||
},
|
Type: "aws",
|
||||||
},
|
}.Absolute(addrs.RootModuleInstance),
|
||||||
})
|
)
|
||||||
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Hooks: []Hook{h},
|
Hooks: []Hook{h},
|
||||||
|
|
|
@ -89,11 +89,32 @@ func TestApplyGraphBuilder_depCbd(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state := states.NewState()
|
||||||
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.A").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"A"}`),
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.B").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"B","test_list":["x"]}`),
|
||||||
|
Dependencies: []addrs.AbsResource{mustResourceAddr("test_object.A")},
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
|
||||||
b := &ApplyGraphBuilder{
|
b := &ApplyGraphBuilder{
|
||||||
Config: testModule(t, "graph-builder-apply-dep-cbd"),
|
Config: testModule(t, "graph-builder-apply-dep-cbd"),
|
||||||
Changes: changes,
|
Changes: changes,
|
||||||
Components: simpleMockComponentFactory(),
|
Components: simpleMockComponentFactory(),
|
||||||
Schemas: simpleTestSchemas(),
|
Schemas: simpleTestSchemas(),
|
||||||
|
State: state,
|
||||||
}
|
}
|
||||||
|
|
||||||
g, err := b.Build(addrs.RootModuleInstance)
|
g, err := b.Build(addrs.RootModuleInstance)
|
||||||
|
|
|
@ -178,7 +178,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (n *NodeDestroyDeposedResourceInstanceObject) Name() string {
|
func (n *NodeDestroyDeposedResourceInstanceObject) Name() string {
|
||||||
return fmt.Sprintf("%s (destroy deposed %s)", n.Addr.String(), n.DeposedKey)
|
return fmt.Sprintf("%s (destroy deposed %s)", n.ResourceInstanceAddr(), n.DeposedKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NodeDestroyDeposedResourceInstanceObject) DeposedInstanceObjectKey() states.DeposedKey {
|
func (n *NodeDestroyDeposedResourceInstanceObject) DeposedInstanceObjectKey() states.DeposedKey {
|
||||||
|
|
|
@ -210,6 +210,22 @@ func mustResourceInstanceAddr(s string) addrs.AbsResourceInstance {
|
||||||
return addr
|
return addr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func mustResourceAddr(s string) addrs.AbsResource {
|
||||||
|
addr, diags := addrs.ParseAbsResourceStr(s)
|
||||||
|
if diags.HasErrors() {
|
||||||
|
panic(diags.Err())
|
||||||
|
}
|
||||||
|
return addr
|
||||||
|
}
|
||||||
|
|
||||||
|
func mustProviderConfig(s string) addrs.AbsProviderConfig {
|
||||||
|
p, diags := addrs.ParseAbsProviderConfigStr(s)
|
||||||
|
if diags.HasErrors() {
|
||||||
|
panic(diags.Err())
|
||||||
|
}
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
func instanceObjectIdForTests(obj *states.ResourceInstanceObject) string {
|
func instanceObjectIdForTests(obj *states.ResourceInstanceObject) string {
|
||||||
v := obj.Value
|
v := obj.Value
|
||||||
if v.IsNull() || !v.IsKnown() {
|
if v.IsNull() || !v.IsKnown() {
|
||||||
|
|
|
@ -7,9 +7,10 @@ import (
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/addrs"
|
"github.com/hashicorp/terraform/addrs"
|
||||||
"github.com/hashicorp/terraform/plans"
|
"github.com/hashicorp/terraform/plans"
|
||||||
|
"github.com/hashicorp/terraform/states"
|
||||||
)
|
)
|
||||||
|
|
||||||
func cbdTestGraph(t *testing.T, mod string, changes *plans.Changes) *Graph {
|
func cbdTestGraph(t *testing.T, mod string, changes *plans.Changes, state *states.State) *Graph {
|
||||||
module := testModule(t, mod)
|
module := testModule(t, mod)
|
||||||
|
|
||||||
applyBuilder := &ApplyGraphBuilder{
|
applyBuilder := &ApplyGraphBuilder{
|
||||||
|
@ -17,6 +18,7 @@ func cbdTestGraph(t *testing.T, mod string, changes *plans.Changes) *Graph {
|
||||||
Changes: changes,
|
Changes: changes,
|
||||||
Components: simpleMockComponentFactory(),
|
Components: simpleMockComponentFactory(),
|
||||||
Schemas: simpleTestSchemas(),
|
Schemas: simpleTestSchemas(),
|
||||||
|
State: state,
|
||||||
}
|
}
|
||||||
g, err := (&BasicGraphBuilder{
|
g, err := (&BasicGraphBuilder{
|
||||||
Steps: cbdTestSteps(applyBuilder.Steps()),
|
Steps: cbdTestSteps(applyBuilder.Steps()),
|
||||||
|
@ -77,7 +79,27 @@ func TestCBDEdgeTransformer(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
g := cbdTestGraph(t, "transform-destroy-cbd-edge-basic", changes)
|
state := states.NewState()
|
||||||
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.A").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"A"}`),
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.B").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"B","test_list":["x"]}`),
|
||||||
|
Dependencies: []addrs.AbsResource{mustResourceAddr("test_object.A")},
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
|
||||||
|
g := cbdTestGraph(t, "transform-destroy-cbd-edge-basic", changes, state)
|
||||||
g = filterInstances(g)
|
g = filterInstances(g)
|
||||||
|
|
||||||
actual := strings.TrimSpace(g.String())
|
actual := strings.TrimSpace(g.String())
|
||||||
|
@ -119,7 +141,38 @@ func TestCBDEdgeTransformerMulti(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
g := cbdTestGraph(t, "transform-destroy-cbd-edge-multi", changes)
|
state := states.NewState()
|
||||||
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.A").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"A"}`),
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.B").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"B"}`),
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.C").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"C","test_list":["x"]}`),
|
||||||
|
Dependencies: []addrs.AbsResource{
|
||||||
|
mustResourceAddr("test_object.A"),
|
||||||
|
mustResourceAddr("test_object.B"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
|
||||||
|
g := cbdTestGraph(t, "transform-destroy-cbd-edge-multi", changes, state)
|
||||||
g = filterInstances(g)
|
g = filterInstances(g)
|
||||||
|
|
||||||
actual := strings.TrimSpace(g.String())
|
actual := strings.TrimSpace(g.String())
|
||||||
|
@ -166,7 +219,36 @@ func TestCBDEdgeTransformer_depNonCBDCount(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
g := cbdTestGraph(t, "transform-cbd-destroy-edge-count", changes)
|
state := states.NewState()
|
||||||
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.A").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"A"}`),
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.B[0]").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"B","test_list":["x"]}`),
|
||||||
|
Dependencies: []addrs.AbsResource{mustResourceAddr("test_object.A")},
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.B[1]").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"B","test_list":["x"]}`),
|
||||||
|
Dependencies: []addrs.AbsResource{mustResourceAddr("test_object.A")},
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
|
||||||
|
g := cbdTestGraph(t, "transform-cbd-destroy-edge-count", changes, state)
|
||||||
|
|
||||||
actual := strings.TrimSpace(g.String())
|
actual := strings.TrimSpace(g.String())
|
||||||
expected := regexp.MustCompile(strings.TrimSpace(`
|
expected := regexp.MustCompile(strings.TrimSpace(`
|
||||||
|
@ -215,22 +297,59 @@ func TestCBDEdgeTransformer_depNonCBDCountBoth(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
g := cbdTestGraph(t, "transform-cbd-destroy-edge-both-count", changes)
|
state := states.NewState()
|
||||||
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.A[0]").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"A"}`),
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.A[1]").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"A"}`),
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.B[0]").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"B","test_list":["x"]}`),
|
||||||
|
Dependencies: []addrs.AbsResource{mustResourceAddr("test_object.A")},
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
root.SetResourceInstanceCurrent(
|
||||||
|
mustResourceInstanceAddr("test_object.B[1]").Resource,
|
||||||
|
&states.ResourceInstanceObjectSrc{
|
||||||
|
Status: states.ObjectReady,
|
||||||
|
AttrsJSON: []byte(`{"id":"B","test_list":["x"]}`),
|
||||||
|
Dependencies: []addrs.AbsResource{mustResourceAddr("test_object.A")},
|
||||||
|
},
|
||||||
|
mustProviderConfig("provider.test"),
|
||||||
|
)
|
||||||
|
|
||||||
|
g := cbdTestGraph(t, "transform-cbd-destroy-edge-both-count", changes, state)
|
||||||
|
|
||||||
actual := strings.TrimSpace(g.String())
|
actual := strings.TrimSpace(g.String())
|
||||||
expected := regexp.MustCompile(strings.TrimSpace(`
|
expected := regexp.MustCompile(strings.TrimSpace(`
|
||||||
test_object.A \(destroy deposed \w+\)
|
test_object.A\[0\]
|
||||||
|
test_object.A\[0\] \(destroy deposed \w+\)
|
||||||
test_object.A\[0\]
|
test_object.A\[0\]
|
||||||
test_object.A\[1\]
|
test_object.A\[1\]
|
||||||
test_object.B\[0\]
|
test_object.B\[0\]
|
||||||
test_object.B\[1\]
|
test_object.B\[1\]
|
||||||
test_object.A \(destroy deposed \w+\)
|
test_object.A\[1\]
|
||||||
|
test_object.A\[1\] \(destroy deposed \w+\)
|
||||||
test_object.A\[0\]
|
test_object.A\[0\]
|
||||||
test_object.A\[1\]
|
test_object.A\[1\]
|
||||||
test_object.B\[0\]
|
test_object.B\[0\]
|
||||||
test_object.B\[1\]
|
test_object.B\[1\]
|
||||||
test_object.A\[0\]
|
|
||||||
test_object.A\[1\]
|
|
||||||
test_object.B\[0\]
|
test_object.B\[0\]
|
||||||
test_object.A\[0\]
|
test_object.A\[0\]
|
||||||
test_object.A\[1\]
|
test_object.A\[1\]
|
||||||
|
|
|
@ -81,7 +81,7 @@ func (t *DestroyEdgeTransformer) Transform(g *Graph) error {
|
||||||
destroyers[key] = append(destroyers[key], n)
|
destroyers[key] = append(destroyers[key], n)
|
||||||
destroyerAddrs[key] = addr
|
destroyerAddrs[key] = addr
|
||||||
|
|
||||||
resAddr := addr.Resource.Absolute(addr.Module).String()
|
resAddr := addr.Resource.Resource.Absolute(addr.Module).String()
|
||||||
destroyersByResource[resAddr] = append(destroyersByResource[resAddr], n)
|
destroyersByResource[resAddr] = append(destroyersByResource[resAddr], n)
|
||||||
case GraphNodeCreator:
|
case GraphNodeCreator:
|
||||||
addr := n.CreateAddr()
|
addr := n.CreateAddr()
|
||||||
|
@ -122,12 +122,6 @@ func (t *DestroyEdgeTransformer) Transform(g *Graph) error {
|
||||||
|
|
||||||
for _, resAddr := range ri.StateDependencies() {
|
for _, resAddr := range ri.StateDependencies() {
|
||||||
for _, desDep := range destroyersByResource[resAddr.String()] {
|
for _, desDep := range destroyersByResource[resAddr.String()] {
|
||||||
// TODO: don't connect this if c is CreateBeforeDestroy.
|
|
||||||
// This will require getting the actual change action at
|
|
||||||
// this point, since the lifecycle may have been forced
|
|
||||||
// by a dependent. This should prevent needing to prune
|
|
||||||
// the edge back out in CBDEdgeTransformer, and allow
|
|
||||||
// non-CBD nodes to depend on CBD destroys directly.
|
|
||||||
log.Printf("[TRACE] DestroyEdgeTransformer: %s has stored dependency of %s\n", dag.VertexName(c), dag.VertexName(desDep))
|
log.Printf("[TRACE] DestroyEdgeTransformer: %s has stored dependency of %s\n", dag.VertexName(c), dag.VertexName(desDep))
|
||||||
g.Connect(dag.BasicEdge(c, desDep))
|
g.Connect(dag.BasicEdge(c, desDep))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue