opentofu/terraform/node_data_destroy.go
Mitchell Hashimoto ebb129f051
terraform: data source on refresh should just delete from state
This was caught by an acceptance test. We've now added a unit test. When
refreshing, an orphan (no config) data source should just be deleted.
2017-02-03 20:58:03 +01:00

23 lines
541 B
Go

package terraform
// NodeDestroyableDataResource represents a resource that is "plannable":
// it is ready to be planned in order to create a diff.
type NodeDestroyableDataResource struct {
*NodeAbstractResource
}
// GraphNodeEvalable
func (n *NodeDestroyableDataResource) EvalTree() EvalNode {
addr := n.NodeAbstractResource.Addr
// stateId is the ID to put into the state
stateId := addr.stateId()
// Just destroy it.
var state *InstanceState
return &EvalWriteState{
Name: stateId,
State: &state, // state is nil here
}
}