terraform: new graph nodes implement Dotter

This commit is contained in:
Mitchell Hashimoto 2016-12-02 22:26:40 -05:00
parent 4c9d9ffae8
commit 9197422881
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 23 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"github.com/hashicorp/terraform/config"
"github.com/hashicorp/terraform/dag"
)
// NodeAbstractProvider represents a provider that has no associated operations.
@ -60,3 +61,14 @@ func (n *NodeAbstractProvider) ProviderConfig() *config.RawConfig {
func (n *NodeAbstractProvider) AttachProvider(c *config.ProviderConfig) {
n.Config = c
}
// GraphNodeDotter impl.
func (n *NodeAbstractProvider) DotNode(name string, opts *dag.DotOpts) *dag.DotNode {
return &dag.DotNode{
Name: name,
Attrs: map[string]string{
"label": n.Name(),
"shape": "diamond",
},
}
}

View File

@ -166,3 +166,14 @@ func (n *NodeAbstractResource) AttachResourceState(s *ResourceState) {
func (n *NodeAbstractResource) AttachResourceConfig(c *config.Resource) {
n.Config = c
}
// GraphNodeDotter impl.
func (n *NodeAbstractResource) DotNode(name string, opts *dag.DotOpts) *dag.DotNode {
return &dag.DotNode{
Name: name,
Attrs: map[string]string{
"label": n.Name(),
"shape": "box",
},
}
}