diff --git a/terraform/node_resource.go b/terraform/node_resource_apply.go similarity index 100% rename from terraform/node_resource.go rename to terraform/node_resource_apply.go diff --git a/terraform/node_resource_destroy.go b/terraform/node_resource_destroy.go new file mode 100644 index 0000000000..5eaa80c272 --- /dev/null +++ b/terraform/node_resource_destroy.go @@ -0,0 +1,51 @@ +package terraform + +import ( + "fmt" + + "github.com/hashicorp/terraform/config" +) + +// NodeDestroyResource represents a resource that is to be destroyed. +type NodeApplyableResource struct { + Addr *ResourceAddress // Addr is the address for this resource +} + +func (n *NodeApplyableResource) Name() string { + return n.Addr.String() +} + +// GraphNodeSubPath +func (n *NodeApplyableResource) Path() []string { + return n.Addr.Path +} + +// GraphNodeReferenceable +func (n *NodeApplyableResource) ReferenceableName() []string { + if n.Config == nil { + return nil + } + + return []string{n.Config.Id()} +} + +// GraphNodeProviderConsumer +func (n *NodeApplyableResource) ProvidedBy() []string { + // If we have a config we prefer that above all else + if n.Config != nil { + return []string{resourceProvider(n.Config.Type, n.Config.Provider)} + } + + // If we have state, then we will use the provider from there + if n.ResourceState != nil { + return []string{n.ResourceState.Provider} + } + + // Use our type + return []string{resourceProvider(n.Addr.Type, "")} +} + +// GraphNodeEvalable +func (n *NodeApplyableResource) EvalTree() EvalNode { + return nil +} diff --git a/terraform/transform_diff.go b/terraform/transform_diff.go index 8f91d57293..cae5d7528f 100644 --- a/terraform/transform_diff.go +++ b/terraform/transform_diff.go @@ -40,7 +40,10 @@ func (t *DiffTransformer) Transform(g *Graph) error { // Go through all the resources in this module. for name, inst := range m.Resources { log.Printf("[TRACE] DiffTransformer: Resource %q: %#v", name, inst) - // TODO: Destroy diff + + // TODO: destroy + if inst.Destroy { + } // If this diff has no attribute changes, then we have // nothing to do and therefore won't add it to the graph.