Documentation ¶
Index ¶
Constants ¶
const ( TfResource = "resource" TfVar = "var" TfLocal = "local" TfOutput = "output" TfModule = "module" TfProvider = "provider" )
List of the managed Terraform types.
Variables ¶
var ManagedTerraformTypes = map[string]interface{}{ TfResource: nil, TfVar: nil, TfLocal: nil, TfOutput: nil, TfModule: nil, TfProvider: nil, }
ManagedTerraformTypes is a set of all the managed Terraform types.
var TfConfigElementRegexp = regexp.MustCompile(`^"module.root.(.*)"$`)
TfConfigElementRegexp allows to match valid Terraform configuration elements and extract their type+name.
var TfModuleRegexp = regexp.MustCompile(`(module\..*?)\.(.*)`)
TfModuleRegexp allows to match Terraform modules and extract their name.
Functions ¶
This section is empty.
Types ¶
type BaseConfigElement ¶
type BaseConfigElement struct {
// contains filtered or unexported fields
}
BaseConfigElement represents a concrete Terraform configuration element.
func NewBaseConfigElement ¶
func NewBaseConfigElement(parent *Module, name string, tfType string) *BaseConfigElement
NewBaseConfigElement creates a new module using the specified parent module, name and type.
func (*BaseConfigElement) GetName ¶
func (e *BaseConfigElement) GetName() string
GetName returns the name of this element.
func (*BaseConfigElement) GetParent ¶
func (e *BaseConfigElement) GetParent() *Module
GetParent returns the parent module of this element.
func (*BaseConfigElement) GetQualifiedName ¶
func (e *BaseConfigElement) GetQualifiedName() string
GetQualifiedName returns the qualified name ([parentQualifiedName.]name) of this element.
func (*BaseConfigElement) GetTfType ¶
func (e *BaseConfigElement) GetTfType() string
GetTfType returns the Terraform type of this element.
func (*BaseConfigElement) SetParent ¶
func (e *BaseConfigElement) SetParent(parent *Module)
SetParent sets the parent module of this element.
type ConfigElement ¶
type ConfigElement interface { GetParent() *Module SetParent(parent *Module) GetName() string GetQualifiedName() string GetTfType() string }
ConfigElement represents a generic Terraform configuration element.
type Dependency ¶
type Dependency struct { // This element depends on the `Destination` element. Source ConfigElement // This element is a dependency of the `Source` element. Destination ConfigElement }
Dependency represents a directed dependency between two Terraform configuration elements.
func NewDependency ¶
func NewDependency(source, destination ConfigElement) *Dependency
NewDependency creates a new dependency using the specified source and destination elements.
type Graph ¶
type Graph struct { Root *Module Dependencies []*Dependency }
Graph represents a Terraform configuration (elements + dependencies).
func NewGraph ¶
func NewGraph(root *Module, dependencies []*Dependency) *Graph
NewGraph creates a new graph using the specified root module and dependencies.
type Module ¶
type Module struct { *BaseConfigElement Children map[string]ConfigElement }
Module represents a Terraform configuration module.
func (*Module) AddChild ¶
func (m *Module) AddChild(e ConfigElement)
AddChild adds the specified element to this module.