Documentation ¶
Index ¶
- Constants
- func GetDoc(filename string, endBytePos int, reverse bool) (args map[string]string, err error)
- func SetListFromDocIfFound(values *[]interface{}, valueTagName string, fieldDoc map[string]string)
- func SetValueFromDocIfFound(value *string, valueTagName string, fieldDoc map[string]string) (ok bool)
- type BlockDependencyGetter
- type BlockID
- type BlockParentPosGetter
- type BlockProviderGetter
- type BlockType
- type Component
- type Components
- type Graph
- type GraphNode
- type GraphWalkerCB
- type LineReader
- type ParsedBlock
- type PlatformMetadata
- type Profile
- type Profiles
Constants ¶
const ( ComponentDocPrefix = "component" // Documentation comment prefix (i.e. "component[<name-override>]: <description>") ComponentPrefix = "tr_component_" // Prefix for component identifiers in terraform code )
Variables ¶
This section is empty.
Functions ¶
func GetDoc ¶
GetDoc reads a given file and returns documentation when reverse is false the file is read from the beginning until the end byte position or the EOF (endBytePos < 0 reads the entire file) when reverse is true the file is read from the end byte position to the beginning.
func SetListFromDocIfFound ¶
Types ¶
type BlockDependencyGetter ¶
type BlockDependencyGetter interface {
GetDependencies() map[string]tfconfig.AttributeReference
}
type BlockID ¶
type BlockID string
BlockID represents a unique identifier for a terraform block.
func NewBlockID ¶
func (BlockID) FindRequirements ¶
func (BlockID) GetBlock ¶
func (bID BlockID) GetBlock(m *tfconfig.Module) (b ParsedBlock, found bool)
func (BlockID) ParseComponent ¶
type BlockParentPosGetter ¶
type BlockProviderGetter ¶
type BlockProviderGetter interface {
GeProviderName() string
}
type BlockType ¶
type BlockType string
BlockType represents the type of a terraform block.
const ( BlockType_Undefined BlockType = "" // Undefined block type BlockType_ModuleCall BlockType = "module" // Module call block type BlockType_Resource BlockType = "resource" // Resource block type BlockType_Data BlockType = "data" // Data block type BlockType_Local BlockType = "local" // Local block type BlockType_Variable BlockType = "var" // Variable block type BlockType_Output BlockType = "output" // Output block type BlockType_Provider BlockType = "provider" // Provider block type )
func GetBlockType ¶
GetBlockType returns a BlockType from pre-defined set of constants. This would be similar to typecast except, it changes unrecognized values to BlockType_Undefined
type Component ¶
type Component struct { ID string `yaml:",omitempty"` // Unique identifier for the component Title string `yaml:",omitempty"` // Descriptive title for the component Description string `yaml:",omitempty"` // Detailed description of the component's functionality Inputs *jsonschema.Node `yaml:",omitempty"` // Input parameters required by the component Outputs *jsonschema.Node `yaml:",omitempty"` // Output properties produced by the component }
Component represents an implementation of a dependency in the Terrarium platform.
type Components ¶
type Components []Component
Components is a slice of Component objects.
func NewComponents ¶
func NewComponents(platformModule *tfconfig.Module) Components
func (*Components) Append ¶
func (cArr *Components) Append(c Component) *Component
func (Components) GetByID ¶
func (cArr Components) GetByID(id string) *Component
func (*Components) Parse ¶
func (cArr *Components) Parse(platformModule *tfconfig.Module)
type Graph ¶
type Graph []GraphNode
Graph defines the relationships between terraform blocks.
func (*Graph) Walk ¶
func (g *Graph) Walk(roots []BlockID, cb GraphWalkerCB) error
Walk a function to traverse all requirements starting from the given nodes and call cb exactly once for each node that is connected to the given set of nodes. Terraform Outputs are traversed differently in the end, such that, each output that is able to resolve with the blocks been traversed, are selected.
type GraphNode ¶
type GraphNode struct { ID BlockID // Unique identifier for the graph node Requirements []BlockID // IDs of other graph nodes that the current node depends on }
GraphNode represents a single node in the graph. It includes the node's ID and the IDs of the nodes it depends on.
type GraphWalkerCB ¶
type LineReader ¶
func NewLineReader ¶
func NewLineReader(fp *os.File, endBytePos int, reverse bool) LineReader
type ParsedBlock ¶
type PlatformMetadata ¶
type PlatformMetadata struct { Profiles Profiles // Configuration profiles in the platform Components Components // Components in the Terrarium platform Graph Graph // Graph defining the relationships between terraform blocks }
PlatformMetadata represents the metadata for the Terrarium platform. It includes the components and the graph that defines the relationships between terraform blocks.
func NewPlatformMetadata ¶
func NewPlatformMetadata(platformModule *tfconfig.Module, existingYaml []byte) (*PlatformMetadata, error)
NewPlatformMetadata creates a new PlatformMetadata object. It parses the platform module and existing YAML to create the components and the graph.
func (*PlatformMetadata) FromFileBytes ¶
func (pm *PlatformMetadata) FromFileBytes(bytes []byte) error
type Profile ¶
type Profile struct { ID string `yaml:",omitempty"` // Unique identifier for the profile Title string `yaml:",omitempty"` // Descriptive title for the profile Description string `yaml:",omitempty"` // Detailed description of the profile's properties }
Profile represents a set of pre-set configuration variables that can be applied to generated Terraform code.