terraform: Adding flag for CreateBeforeDestroy
This commit is contained in:
parent
8d5d7c32c8
commit
f398708be2
|
@ -557,6 +557,9 @@ func graphAddDiff(g *depgraph.Graph, d *ModuleDiff) error {
|
||||||
Target: newN,
|
Target: newN,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Set the CreateBeforeDestroy flag on the old noun
|
||||||
|
rn.Resource.Flags |= FlagCreateBeforeDestroy
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dep := &depgraph.Dependency{
|
dep := &depgraph.Dependency{
|
||||||
Name: newN.Name,
|
Name: newN.Name,
|
||||||
|
|
|
@ -704,6 +704,12 @@ func TestGraphAddDiff_createBeforeDestroy(t *testing.T) {
|
||||||
t.Fatalf("bad:\n\n%s\n\nexpected:\n\n%s", actual, expected)
|
t.Fatalf("bad:\n\n%s\n\nexpected:\n\n%s", actual, expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify the flag is set
|
||||||
|
r := g.Noun("aws_instance.bar")
|
||||||
|
if r.Meta.(*GraphNodeResource).Resource.Flags&FlagCreateBeforeDestroy == 0 {
|
||||||
|
t.Fatalf("missing FlagCreateBeforeDestroy")
|
||||||
|
}
|
||||||
|
|
||||||
// Verify that our original structure has not been modified
|
// Verify that our original structure has not been modified
|
||||||
diffHash2 := checksumStruct(t, diff)
|
diffHash2 := checksumStruct(t, diff)
|
||||||
if diffHash != diffHash2 {
|
if diffHash != diffHash2 {
|
||||||
|
|
|
@ -47,6 +47,7 @@ const (
|
||||||
FlagTainted
|
FlagTainted
|
||||||
FlagOrphan
|
FlagOrphan
|
||||||
FlagHasTainted
|
FlagHasTainted
|
||||||
|
FlagCreateBeforeDestroy
|
||||||
)
|
)
|
||||||
|
|
||||||
// InstanceInfo is used to hold information about the instance and/or
|
// InstanceInfo is used to hold information about the instance and/or
|
||||||
|
|
Loading…
Reference in New Issue