Documentation ¶
Index ¶
- Variables
- func LoadMPTFHclBlocks(ignoreUnsupportedBlock bool, dir string) ([]*golden.HclBlock, error)
- type AppendBlockBodyTransform
- type BaseData
- type BaseTransform
- type Data
- type DataSourceData
- type MetaProgrammingTFConfig
- func (c *MetaProgrammingTFConfig) AddBlock(filename string, block *hclwrite.Block)
- func (c *MetaProgrammingTFConfig) DataBlocks() []*terraform.RootBlock
- func (c *MetaProgrammingTFConfig) Init(hclBlocks []*golden.HclBlock) error
- func (c *MetaProgrammingTFConfig) LocalBlocks() []*terraform.RootBlock
- func (c *MetaProgrammingTFConfig) ModuleBlocks() []*terraform.RootBlock
- func (c *MetaProgrammingTFConfig) OutputBlocks() []*terraform.RootBlock
- func (c *MetaProgrammingTFConfig) ResourceBlocks() []*terraform.RootBlock
- func (c *MetaProgrammingTFConfig) RootBlock(address string) *terraform.RootBlock
- func (c *MetaProgrammingTFConfig) SaveToDisk() error
- func (c *MetaProgrammingTFConfig) TerraformBlock() *terraform.RootBlock
- func (c *MetaProgrammingTFConfig) VariableBlocks() []*terraform.RootBlock
- type MetaProgrammingTFPlan
- type NewBlockTransform
- func (n *NewBlockTransform) Apply() error
- func (n *NewBlockTransform) Decode(block *golden.HclBlock, context *hcl.EvalContext) error
- func (n *NewBlockTransform) Format(block *hclwrite.Block) (*hclwrite.Block, error)
- func (n *NewBlockTransform) NewWriteBlock() *hclwrite.Block
- func (n *NewBlockTransform) Type() string
- type ProviderSchemaData
- type RegexReplaceExpressionTransform
- type RemoveBlockContentBlockTransform
- type Rename
- type RenameAttributeOrNestedBlockTransform
- type RequiredProvider
- type ResourceData
- type TerraformCliProviderSchemaRetriever
- type TerraformData
- type TerraformModuleRef
- type TerraformProviderSchemaRetriever
- type Transform
- type UpdateInPlaceTransform
- func (u *UpdateInPlaceTransform) Apply() error
- func (u *UpdateInPlaceTransform) Decode(block *golden.HclBlock, context *hcl.EvalContext) error
- func (u *UpdateInPlaceTransform) PatchWriteBlock(dest terraform.Block, patch *hclwrite.Block)
- func (u *UpdateInPlaceTransform) String() string
- func (u *UpdateInPlaceTransform) Type() string
- func (u *UpdateInPlaceTransform) UpdateBlock() *hclwrite.Block
Constants ¶
This section is empty.
Variables ¶
View Source
var SchemaRetrieverFactory = func(ctx context.Context) TerraformProviderSchemaRetriever { return NewTerraformCliProviderSchemaRetriever(ctx) }
View Source
var ToHclFunc = function.New(&function.Spec{ Description: "Convert an cty.Value to HCL config in string format", Params: []function.Parameter{ { Name: "input", Type: cty.DynamicPseudoType, }, }, Type: function.StaticReturnType(cty.String), Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { input := args[0] return cty.StringVal(string(hclwrite.TokensForValue(input).BuildTokens(nil).Bytes())), nil }, })
Functions ¶
Types ¶
type AppendBlockBodyTransform ¶
type AppendBlockBodyTransform struct { *golden.BaseBlock *BaseTransform TargetBlockAddress string `hcl:"target_block_address" validate:"required"` BlockBody string `hcl:"block_body" validate:"required"` }
func (*AppendBlockBodyTransform) Apply ¶
func (u *AppendBlockBodyTransform) Apply() error
func (*AppendBlockBodyTransform) PatchWriteBlock ¶
func (u *AppendBlockBodyTransform) PatchWriteBlock(dest terraform.Block, patch *hclwrite.Body)
func (*AppendBlockBodyTransform) String ¶
func (u *AppendBlockBodyTransform) String() string
func (*AppendBlockBodyTransform) Type ¶
func (u *AppendBlockBodyTransform) Type() string
type BaseData ¶
type BaseData struct{}
func (*BaseData) AddressLength ¶
func (*BaseData) CanExecutePrePlan ¶
type BaseTransform ¶
type BaseTransform struct{}
func (*BaseTransform) AddressLength ¶
func (bt *BaseTransform) AddressLength() int
func (*BaseTransform) BlockType ¶
func (bt *BaseTransform) BlockType() string
func (*BaseTransform) CanExecutePrePlan ¶
func (bt *BaseTransform) CanExecutePrePlan() bool
func (*BaseTransform) Transform ¶
func (bt *BaseTransform) Transform()
type DataSourceData ¶
type DataSourceData struct { *BaseData *golden.BaseBlock DataSourceType string `hcl:"data_source_type,optional"` UseCount bool `hcl:"use_count,optional" default:"false"` UseForEach bool `hcl:"use_for_each,optional" default:"false"` Result cty.Value `attribute:"result"` }
func (*DataSourceData) ExecuteDuringPlan ¶
func (dd *DataSourceData) ExecuteDuringPlan() error
func (*DataSourceData) String ¶
func (dd *DataSourceData) String() string
func (*DataSourceData) Type ¶
func (dd *DataSourceData) Type() string
type MetaProgrammingTFConfig ¶
type MetaProgrammingTFConfig struct { *golden.BaseConfig // contains filtered or unexported fields }
func NewMetaProgrammingTFConfig ¶
func NewMetaProgrammingTFConfig(m *TerraformModuleRef, varConfigDir *string, hclBlocks []*golden.HclBlock, cliFlagAssignedVars []golden.CliFlagAssignedVariables, ctx context.Context) (*MetaProgrammingTFConfig, error)
func (*MetaProgrammingTFConfig) AddBlock ¶
func (c *MetaProgrammingTFConfig) AddBlock(filename string, block *hclwrite.Block)
func (*MetaProgrammingTFConfig) DataBlocks ¶
func (c *MetaProgrammingTFConfig) DataBlocks() []*terraform.RootBlock
func (*MetaProgrammingTFConfig) Init ¶
func (c *MetaProgrammingTFConfig) Init(hclBlocks []*golden.HclBlock) error
func (*MetaProgrammingTFConfig) LocalBlocks ¶
func (c *MetaProgrammingTFConfig) LocalBlocks() []*terraform.RootBlock
func (*MetaProgrammingTFConfig) ModuleBlocks ¶
func (c *MetaProgrammingTFConfig) ModuleBlocks() []*terraform.RootBlock
func (*MetaProgrammingTFConfig) OutputBlocks ¶
func (c *MetaProgrammingTFConfig) OutputBlocks() []*terraform.RootBlock
func (*MetaProgrammingTFConfig) ResourceBlocks ¶
func (c *MetaProgrammingTFConfig) ResourceBlocks() []*terraform.RootBlock
func (*MetaProgrammingTFConfig) RootBlock ¶
func (c *MetaProgrammingTFConfig) RootBlock(address string) *terraform.RootBlock
func (*MetaProgrammingTFConfig) SaveToDisk ¶
func (c *MetaProgrammingTFConfig) SaveToDisk() error
func (*MetaProgrammingTFConfig) TerraformBlock ¶
func (c *MetaProgrammingTFConfig) TerraformBlock() *terraform.RootBlock
func (*MetaProgrammingTFConfig) VariableBlocks ¶
func (c *MetaProgrammingTFConfig) VariableBlocks() []*terraform.RootBlock
type MetaProgrammingTFPlan ¶
type MetaProgrammingTFPlan struct { Transforms []Transform // contains filtered or unexported fields }
func RunMetaProgrammingTFPlan ¶
func RunMetaProgrammingTFPlan(c *MetaProgrammingTFConfig) (*MetaProgrammingTFPlan, error)
func (*MetaProgrammingTFPlan) Apply ¶
func (m *MetaProgrammingTFPlan) Apply() error
func (*MetaProgrammingTFPlan) String ¶
func (m *MetaProgrammingTFPlan) String() string
type NewBlockTransform ¶
type NewBlockTransform struct { *golden.BaseBlock *BaseTransform NewBlockType string `hcl:"new_block_type"` FileName string `hcl:"filename" validate:"endswith=.tf"` Labels []string `hcl:"labels,optional"` NewBody string `hcl:"body,optional"` // contains filtered or unexported fields }
func (*NewBlockTransform) Apply ¶
func (n *NewBlockTransform) Apply() error
func (*NewBlockTransform) Decode ¶
func (n *NewBlockTransform) Decode(block *golden.HclBlock, context *hcl.EvalContext) error
func (*NewBlockTransform) NewWriteBlock ¶
func (n *NewBlockTransform) NewWriteBlock() *hclwrite.Block
func (*NewBlockTransform) Type ¶
func (n *NewBlockTransform) Type() string
type ProviderSchemaData ¶
type ProviderSchemaData struct { *BaseData *golden.BaseBlock Source string `hcl:"provider_source"` Version string `hcl:"provider_version"` Resources cty.Value `attribute:"resources"` }
func (*ProviderSchemaData) ExecuteDuringPlan ¶
func (r *ProviderSchemaData) ExecuteDuringPlan() error
func (*ProviderSchemaData) Type ¶
func (r *ProviderSchemaData) Type() string
type RegexReplaceExpressionTransform ¶
type RegexReplaceExpressionTransform struct { *golden.BaseBlock *BaseTransform Regex string `hcl:"regex" validate:"required"` Replacement string `hcl:"replacement"` }
func (*RegexReplaceExpressionTransform) Apply ¶
func (r *RegexReplaceExpressionTransform) Apply() error
func (*RegexReplaceExpressionTransform) Type ¶
func (r *RegexReplaceExpressionTransform) Type() string
type RemoveBlockContentBlockTransform ¶
type RemoveBlockContentBlockTransform struct { *golden.BaseBlock *BaseTransform TargetBlockAddress string `hcl:"target_block_address"` Paths []string `hcl:"paths"` }
func (*RemoveBlockContentBlockTransform) Apply ¶
func (r *RemoveBlockContentBlockTransform) Apply() error
func (*RemoveBlockContentBlockTransform) Type ¶
func (r *RemoveBlockContentBlockTransform) Type() string
type Rename ¶
type Rename struct { ResourceType string `hcl:"resource_type"` // We'll deprecate `attribute_path` in favor of `element_path`. AttributePath []string `hcl:"attribute_path,optional" validate:"excluded_with=element_path"` ElementPath []string `hcl:"element_path,optional" validate:"excluded_with=attribute_path,required_without=attribute_path"` NewName string `hcl:"new_name" validate:"required"` RenameOnlyNewNameAbsent bool `hcl:"rename_only_new_name_absent,optional" default:"false"` }
type RenameAttributeOrNestedBlockTransform ¶
type RenameAttributeOrNestedBlockTransform struct { *golden.BaseBlock *BaseTransform Renames []Rename `hcl:"rename,block"` }
func (*RenameAttributeOrNestedBlockTransform) Apply ¶
func (r *RenameAttributeOrNestedBlockTransform) Apply() error
func (*RenameAttributeOrNestedBlockTransform) Type ¶
func (r *RenameAttributeOrNestedBlockTransform) Type() string
type RequiredProvider ¶
type ResourceData ¶
type ResourceData struct { *BaseData *golden.BaseBlock ResourceType string `hcl:"resource_type,optional"` UseCount bool `hcl:"use_count,optional" default:"false"` UseForEach bool `hcl:"use_for_each,optional" default:"false"` Result cty.Value `attribute:"result"` }
func (*ResourceData) ExecuteDuringPlan ¶
func (rd *ResourceData) ExecuteDuringPlan() error
func (*ResourceData) String ¶
func (rd *ResourceData) String() string
func (*ResourceData) Type ¶
func (rd *ResourceData) Type() string
type TerraformCliProviderSchemaRetriever ¶
type TerraformCliProviderSchemaRetriever struct {
// contains filtered or unexported fields
}
func (TerraformCliProviderSchemaRetriever) Get ¶
func (t TerraformCliProviderSchemaRetriever) Get(providerSource, versionConstraint string) (*tfjson.ProviderSchema, error)
type TerraformData ¶
type TerraformData struct { *BaseData *golden.BaseBlock RequiredVersion *string `attribute:"required_version"` RequiredProviders map[string]RequiredProvider `attribute:"required_providers"` Block cty.Value `attribute:"block"` }
func (*TerraformData) ExecuteDuringPlan ¶
func (d *TerraformData) ExecuteDuringPlan() error
func (*TerraformData) Type ¶
func (d *TerraformData) Type() string
type TerraformModuleRef ¶
type TerraformModuleRef struct { Key string `json:"Key"` Source string `json:"Source"` Dir string `json:"Dir"` AbsDir string Version string `json:"Version"` GitHash string }
func ModuleRefs ¶
func ModuleRefs(tfDir string) ([]*TerraformModuleRef, error)
func NewTerraformModuleRef ¶
func NewTerraformModuleRef(dir, key, source, version string) (*TerraformModuleRef, error)
func NewTerraformRootModuleRef ¶
func NewTerraformRootModuleRef(dir string) (*TerraformModuleRef, error)
func (*TerraformModuleRef) Load ¶
func (m *TerraformModuleRef) Load() error
func (*TerraformModuleRef) LoadAbsDir ¶
func (m *TerraformModuleRef) LoadAbsDir() error
func (*TerraformModuleRef) LoadGitHash ¶
func (m *TerraformModuleRef) LoadGitHash()
type TerraformProviderSchemaRetriever ¶
type TerraformProviderSchemaRetriever interface {
Get(providerSource, versionConstraint string) (*tfjson.ProviderSchema, error)
}
func NewTerraformCliProviderSchemaRetriever ¶
func NewTerraformCliProviderSchemaRetriever(ctx context.Context) TerraformProviderSchemaRetriever
type Transform ¶
type Transform interface { golden.ApplyBlock Transform() }
type UpdateInPlaceTransform ¶
type UpdateInPlaceTransform struct { *golden.BaseBlock *BaseTransform TargetBlockAddress string `hcl:"target_block_address" validate:"required"` DynamicBlockBody string `hcl:"dynamic_block_body,optional"` // contains filtered or unexported fields }
func (*UpdateInPlaceTransform) Apply ¶
func (u *UpdateInPlaceTransform) Apply() error
func (*UpdateInPlaceTransform) Decode ¶
func (u *UpdateInPlaceTransform) Decode(block *golden.HclBlock, context *hcl.EvalContext) error
func (*UpdateInPlaceTransform) PatchWriteBlock ¶
func (u *UpdateInPlaceTransform) PatchWriteBlock(dest terraform.Block, patch *hclwrite.Block)
func (*UpdateInPlaceTransform) String ¶
func (u *UpdateInPlaceTransform) String() string
func (*UpdateInPlaceTransform) Type ¶
func (u *UpdateInPlaceTransform) Type() string
func (*UpdateInPlaceTransform) UpdateBlock ¶
func (u *UpdateInPlaceTransform) UpdateBlock() *hclwrite.Block
Source Files ¶
- base_data.go
- base_transform.go
- data_data_source.go
- data_provider_schema.go
- data_resource.go
- data_terraform.go
- init.go
- mptf_block.go
- mptf_config.go
- mptf_funcs.go
- mptf_plan.go
- resource_schema.go
- terraform_module_ref.go
- transform_append_block_body.go
- transform_new_block.go
- transform_regex_replace_expression.go
- transform_remove_block_element_block.go
- transform_rename_block_element.go
- transform_update_in_place.go
Click to show internal directories.
Click to hide internal directories.