github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/terraform/node_data_destroy.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package terraform
     5  
     6  import (
     7  	"log"
     8  
     9  	"github.com/terramate-io/tf/tfdiags"
    10  )
    11  
    12  // NodeDestroyableDataResourceInstance represents a resource that is "destroyable":
    13  // it is ready to be destroyed.
    14  type NodeDestroyableDataResourceInstance struct {
    15  	*NodeAbstractResourceInstance
    16  }
    17  
    18  var (
    19  	_ GraphNodeExecutable = (*NodeDestroyableDataResourceInstance)(nil)
    20  )
    21  
    22  // GraphNodeExecutable
    23  func (n *NodeDestroyableDataResourceInstance) Execute(ctx EvalContext, op walkOperation) tfdiags.Diagnostics {
    24  	log.Printf("[TRACE] NodeDestroyableDataResourceInstance: removing state object for %s", n.Addr)
    25  	ctx.State().SetResourceInstanceCurrent(n.Addr, nil, n.ResolvedProvider)
    26  	return nil
    27  }