Documentation
¶
Overview ¶
Package terraform is the representation of a Terraform Module
Index ¶
- type Input
- type Module
- func (m *Module) Convert() terraformsdk.Module
- func (m *Module) HasHeader() bool
- func (m *Module) HasInputs() bool
- func (m *Module) HasModuleCalls() bool
- func (m *Module) HasOutputs() bool
- func (m *Module) HasProviders() bool
- func (m *Module) HasRequirements() bool
- func (m *Module) HasResources() bool
- type ModuleCall
- type Options
- type Output
- type Position
- type Provider
- type Requirement
- type Resource
- type SortBy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Input ¶
type Input struct { Name string `json:"name" toml:"name" xml:"name" yaml:"name"` Type types.String `json:"type" toml:"type" xml:"type" yaml:"type"` Description types.String `json:"description" toml:"description" xml:"description" yaml:"description"` Default types.Value `json:"default" toml:"default" xml:"default" yaml:"default"` Required bool `json:"required" toml:"required" xml:"required" yaml:"required"` Position Position `json:"-" toml:"-" xml:"-" yaml:"-"` }
Input represents a Terraform input.
func (*Input) GetValue ¶
GetValue returns JSON representation of the 'Default' value, which is an 'interface'. If 'Default' is a primitive type, the primitive value of 'Default' will be returned and not the JSON formatted of it.
func (*Input) HasDefault ¶
HasDefault indicates if a Terraform variable has a default value set.
type Module ¶
type Module struct { XMLName xml.Name `json:"-" toml:"-" xml:"module" yaml:"-"` Header string `json:"header" toml:"header" xml:"header" yaml:"header"` Inputs []*Input `json:"inputs" toml:"inputs" xml:"inputs>input" yaml:"inputs"` ModuleCalls []*ModuleCall `json:"modules" toml:"modules" xml:"modules>module" yaml:"modules"` Outputs []*Output `json:"outputs" toml:"outputs" xml:"outputs>output" yaml:"outputs"` Providers []*Provider `json:"providers" toml:"providers" xml:"providers>provider" yaml:"providers"` Requirements []*Requirement `json:"requirements" toml:"requirements" xml:"requirements>requirement" yaml:"requirements"` Resources []*Resource `json:"resources" toml:"resources" xml:"resources>resource" yaml:"resources"` RequiredInputs []*Input `json:"-" toml:"-" xml:"-" yaml:"-"` OptionalInputs []*Input `json:"-" toml:"-" xml:"-" yaml:"-"` }
Module represents a Terraform module. It consists of
- Header ('header' json key): Module header found in shape of multi line comments at the beginning of 'main.tf' - Inputs ('inputs' json key): List of input 'variables' extracted from the Terraform module .tf files - ModuleCalls ('modules' json key): List of 'modules' extracted from the Terraform module .tf files - Outputs ('outputs' json key): List of 'outputs' extracted from Terraform module .tf files - Providers ('providers' json key): List of 'providers' extracted from resources used in Terraform module - Requirements ('requirements' json key): List of 'requirements' extracted from the Terraform module .tf files - Resources ('resources' json key): List of 'resources' extracted from the Terraform module .tf files
func LoadWithOptions ¶
LoadWithOptions returns new instance of Module with all the inputs and outputs discovered from provided 'path' containing Terraform config
func (*Module) Convert ¶
func (m *Module) Convert() terraformsdk.Module
Convert internal Module to its equivalent in plugin-sdk
func (*Module) HasModuleCalls ¶
HasModuleCalls indicates if the module has modulecalls.
func (*Module) HasOutputs ¶
HasOutputs indicates if the module has outputs.
func (*Module) HasProviders ¶
HasProviders indicates if the module has providers.
func (*Module) HasRequirements ¶
HasRequirements indicates if the module has requirements.
func (*Module) HasResources ¶
HasResources indicates if the module has resources.
type ModuleCall ¶
type ModuleCall struct { Name string `json:"name"` Source string `json:"source"` Version string `json:"version,omitempty"` }
ModuleCall represents a submodule called by Terraform module.
func (*ModuleCall) FullName ¶
func (mc *ModuleCall) FullName() string
FullName returns full name of the modulecall, with version if available
type Options ¶
type Options struct { Path string ShowHeader bool HeaderFromFile string SortBy *SortBy OutputValues bool OutputValuesPath string }
Options contains required options to load a Module from path
type Output ¶
type Output struct { Name string `json:"name" toml:"name" xml:"name" yaml:"name"` Description types.String `json:"description" toml:"description" xml:"description" yaml:"description"` Value types.Value `json:"value,omitempty" toml:"value,omitempty" xml:"value,omitempty" yaml:"value,omitempty"` Sensitive bool `json:"sensitive,omitempty" toml:"sensitive,omitempty" xml:"sensitive,omitempty" yaml:"sensitive,omitempty"` Position Position `json:"-" toml:"-" xml:"-" yaml:"-"` ShowValue bool `json:"-" toml:"-" xml:"-" yaml:"-"` }
Output represents a Terraform output.
func (*Output) GetValue ¶
GetValue returns JSON representation of the 'Value', which is an 'interface'. If 'Value' is a primitive type, the primitive value of 'Value' will be returned and not the JSON formatted of it.
func (*Output) HasDefault ¶
HasDefault indicates if a Terraform output has a default value set.
func (*Output) MarshalJSON ¶
MarshalJSON custom yaml marshal function to take '--output-values' flag into consideration. It means if the flag is not set Value and Sensitive fields are set to 'omitempty', otherwise if output values are being shown 'omitempty' gets explicitly removed to show even empty and false values.
func (*Output) MarshalXML ¶
MarshalXML custom xml marshal function to take '--output-values' flag into consideration. It means if the flag is not set Value and Sensitive fields are set to 'omitempty', otherwise if output values are being shown 'omitempty' gets explicitly removed to show even empty and false values.
func (*Output) MarshalYAML ¶
MarshalYAML custom yaml marshal function to take '--output-values' flag into consideration. It means if the flag is not set Value and Sensitive fields are set to 'omitempty', otherwise if output values are being shown 'omitempty' gets explicitly removed to show even empty and false values.
type Position ¶
type Position struct { Filename string `json:"-" toml:"-" xml:"-" yaml:"-"` Line int `json:"-" toml:"-" xml:"-" yaml:"-"` }
Position represents position of Terraform input or output in a file.
type Provider ¶
type Provider struct { Name string `json:"name" toml:"name" xml:"name" yaml:"name"` Alias types.String `json:"alias" toml:"alias" xml:"alias" yaml:"alias"` Version types.String `json:"version" toml:"version" xml:"version" yaml:"version"` Position Position `json:"-" toml:"-" xml:"-" yaml:"-"` }
Provider represents a Terraform output.
type Requirement ¶
type Requirement struct { Name string `json:"name" xml:"name" yaml:"name"` Version types.String `json:"version" xml:"version" yaml:"version"` }
Requirement represents a requirement for Terraform module.
type Resource ¶
type Resource struct { Type string `json:"type" toml:"type" xml:"type" yaml:"type"` ProviderName string `json:"providerName" toml:"providerName" xml:"providerName" yaml:"providerName"` ProviderSource string `json:"provicerSource" toml:"providerSource" xml:"providerSource" yaml:"providerSource"` Mode string `json:"mode" toml:"mode" xml:"mode" yaml:"mode"` Version types.String `json:"version" toml:"version" xml:"version" yaml:"version"` }
Resource represents a managed or data type that is created by the module