github.com/hashicorp/terraform-plugin-sdk@v1.17.2/terraform/node_root_variable.go (about)

     1  package terraform
     2  
     3  import (
     4  	"github.com/hashicorp/terraform-plugin-sdk/internal/addrs"
     5  	"github.com/hashicorp/terraform-plugin-sdk/internal/configs"
     6  	"github.com/hashicorp/terraform-plugin-sdk/internal/dag"
     7  )
     8  
     9  // NodeRootVariable represents a root variable input.
    10  type NodeRootVariable struct {
    11  	Addr   addrs.InputVariable
    12  	Config *configs.Variable
    13  }
    14  
    15  var (
    16  	_ GraphNodeSubPath       = (*NodeRootVariable)(nil)
    17  	_ GraphNodeReferenceable = (*NodeRootVariable)(nil)
    18  	_ dag.GraphNodeDotter    = (*NodeApplyableModuleVariable)(nil)
    19  )
    20  
    21  func (n *NodeRootVariable) Name() string {
    22  	return n.Addr.String()
    23  }
    24  
    25  // GraphNodeSubPath
    26  func (n *NodeRootVariable) Path() addrs.ModuleInstance {
    27  	return addrs.RootModuleInstance
    28  }
    29  
    30  // GraphNodeReferenceable
    31  func (n *NodeRootVariable) ReferenceableAddrs() []addrs.Referenceable {
    32  	return []addrs.Referenceable{n.Addr}
    33  }
    34  
    35  // dag.GraphNodeDotter impl.
    36  func (n *NodeRootVariable) DotNode(name string, opts *dag.DotOpts) *dag.DotNode {
    37  	return &dag.DotNode{
    38  		Name: name,
    39  		Attrs: map[string]string{
    40  			"label": n.Name(),
    41  			"shape": "note",
    42  		},
    43  	}
    44  }