github.com/brandonstevens/terraform@v0.9.6-0.20170512224929-5367f2607e16/terraform/node_provisioner.go (about)

     1  package terraform
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/terraform/config"
     7  )
     8  
     9  // NodeProvisioner represents a provider that has no associated operations.
    10  // It registers all the common interfaces across operations for providers.
    11  type NodeProvisioner struct {
    12  	NameValue string
    13  	PathValue []string
    14  
    15  	// The fields below will be automatically set using the Attach
    16  	// interfaces if you're running those transforms, but also be explicitly
    17  	// set if you already have that information.
    18  
    19  	Config *config.ProviderConfig
    20  }
    21  
    22  func (n *NodeProvisioner) Name() string {
    23  	result := fmt.Sprintf("provisioner.%s", n.NameValue)
    24  	if len(n.PathValue) > 1 {
    25  		result = fmt.Sprintf("%s.%s", modulePrefixStr(n.PathValue), result)
    26  	}
    27  
    28  	return result
    29  }
    30  
    31  // GraphNodeSubPath
    32  func (n *NodeProvisioner) Path() []string {
    33  	return n.PathValue
    34  }
    35  
    36  // GraphNodeProvisioner
    37  func (n *NodeProvisioner) ProvisionerName() string {
    38  	return n.NameValue
    39  }
    40  
    41  // GraphNodeEvalable impl.
    42  func (n *NodeProvisioner) EvalTree() EvalNode {
    43  	return &EvalInitProvisioner{Name: n.NameValue}
    44  }