terraform: Enable DestroyEdgeTransformer

This commit is contained in:
Mitchell Hashimoto 2016-09-20 10:23:48 -07:00
parent 08dade5475
commit 311d27108e
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
3 changed files with 28 additions and 16 deletions

View File

@ -54,15 +54,18 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer {
State: b.State,
},
// Attach the configuration to any resources
&AttachResourceConfigTransformer{Module: b.Module},
// Create orphan output nodes
&OrphanOutputTransformer{Module: b.Module, State: b.State},
// Attach the configuration to any resources
&AttachResourceConfigTransformer{Module: b.Module},
// Attach the state
&AttachStateTransformer{State: b.State},
// Destruction ordering
&DestroyEdgeTransformer{Module: b.Module, State: b.State},
// Create all the providers
&MissingProviderTransformer{Providers: b.Providers, Factory: providerFactory},
&ProviderTransformer{},

View File

@ -34,12 +34,8 @@ func (n *NodeApplyableResource) ReferenceableName() []string {
// GraphNodeReferencer
func (n *NodeApplyableResource) References() []string {
// Let's make this a little shorter so it is easier to reference
c := n.Config
if c == nil {
return nil
}
// If we have a config, that is our source of truth
if c := n.Config; c != nil {
// Grab all the references
var result []string
result = append(result, c.DependsOn...)
@ -51,6 +47,14 @@ func (n *NodeApplyableResource) References() []string {
}
return result
}
// If we have state, that is our next source
if s := n.ResourceState; s != nil {
return s.Dependencies
}
return nil
}
// GraphNodeProviderConsumer

View File

@ -30,6 +30,11 @@ func (n *NodeDestroyResource) ProvidedBy() []string {
return []string{resourceProvider(n.Addr.Type, "")}
}
// GraphNodeDestroyer
func (n *NodeDestroyResource) DestroyAddr() *ResourceAddress {
return n.Addr
}
// GraphNodeAttachResourceState
func (n *NodeDestroyResource) ResourceAddr() *ResourceAddress {
return n.Addr