6 "github.com/hashicorp/terraform/config"
7 "github.com/hashicorp/terraform/dag"
10 // ConcreteProviderNodeFunc is a callback type used to convert an
11 // abstract provider to a concrete one of some type.
12 type ConcreteProviderNodeFunc func(*NodeAbstractProvider) dag.Vertex
14 // NodeAbstractProvider represents a provider that has no associated operations.
15 // It registers all the common interfaces across operations for providers.
16 type NodeAbstractProvider struct {
20 // The fields below will be automatically set using the Attach
21 // interfaces if you're running those transforms, but also be explicitly
22 // set if you already have that information.
24 Config *config.ProviderConfig
27 func (n *NodeAbstractProvider) Name() string {
28 result := fmt.Sprintf("provider.%s", n.NameValue)
29 if len(n.PathValue) > 1 {
30 result = fmt.Sprintf("%s.%s", modulePrefixStr(n.PathValue), result)
37 func (n *NodeAbstractProvider) Path() []string {
41 // RemovableIfNotTargeted
42 func (n *NodeAbstractProvider) RemoveIfNotTargeted() bool {
43 // We need to add this so that this node will be removed if
44 // it isn't targeted or a dependency of a target.
48 // GraphNodeReferencer
49 func (n *NodeAbstractProvider) References() []string {
54 return ReferencesFromConfig(n.Config.RawConfig)
58 func (n *NodeAbstractProvider) ProviderName() string {
63 func (n *NodeAbstractProvider) ProviderConfig() *config.RawConfig {
68 return n.Config.RawConfig
71 // GraphNodeAttachProvider
72 func (n *NodeAbstractProvider) AttachProvider(c *config.ProviderConfig) {
76 // GraphNodeDotter impl.
77 func (n *NodeAbstractProvider) DotNode(name string, opts *dag.DotOpts) *dag.DotNode {
80 Attrs: map[string]string{