Documentation ¶
Index ¶
- func CombineBlock(blocks []*hclwrite.Block, output *hclwrite.Block, isForEach bool) map[string][]hclwrite.Tokens
- func GetForEachConstants(instances []types.Instance, items map[string][]hclwrite.Tokens) string
- func GetIdPattern(id string) (string, error)
- func GetResourceBlock(workingDirectory, targetAddress string) (*hclwrite.Block, error)
- func GetTokensForExpression(expression string) hclwrite.Tokens
- func GetValueFromExpression(tokens hclwrite.Tokens) interface{}
- func GetValuePropMap(block *hclwrite.Block, prefix string) map[string]string
- func InjectReference(block *hclwrite.Block, refs []types.Reference) *hclwrite.Block
- func IsArrayWithSameValue(arr []string) bool
- func ListHclFiles(workingDirectory string) []fs.DirEntry
- func ParseHclArray(attrValue string) []string
- func Prefix(arr []string) string
- func ReplaceGenericOutputs(workingDirectory string, outputs []types.Output) error
- func ReplaceResourceBlock(workingDirectory, targetAddress string, newBlock *hclwrite.Block) error
- func Suffix(arr []string) string
- func ToHclSearchReplace(input interface{}, search []string, replacement []string) (string, bool)
- func UpdateMigratedResourceBlock(workingDirectory string, resources []types.GenericUpdateResource) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombineBlock ¶
func CombineBlock(blocks []*hclwrite.Block, output *hclwrite.Block, isForEach bool) map[string][]hclwrite.Tokens
CombineBlock combines `blocks` and update its result to `output` block, and return the difference in a map(key is attribute name, value is a list of attribute values)
func GetForEachConstants ¶
GetForEachConstants converts a map of difference to hcl object
func GetIdPattern ¶
func GetResourceBlock ¶
GetResourceBlock searches tf files in working directory and return `targetAddress` block
func GetTokensForExpression ¶
GetTokensForExpression convert a literal value to hclwrite.Tokens
func GetValueFromExpression ¶
func GetValuePropMap ¶
GetValuePropMap returns a map from literal value to reference
func InjectReference ¶
InjectReference replaces `block`'s literal value with reference provided by `refs`
func IsArrayWithSameValue ¶
IsArrayWithSameValue returns true if all elements in `arr` are identical
func ListHclFiles ¶
func ParseHclArray ¶
ParseHclArray parse `attrValue` to an array, example `attrValue` `["a", "b", 0]` will return ["\"a\"", "\"b\"", "0"]
func ReplaceGenericOutputs ¶
ReplaceGenericOutputs searches tf files in working directory and replace generic resource's output with new address
func ReplaceResourceBlock ¶
ReplaceResourceBlock searches tf files in working directory and replace `targetAddress` block with `newBlock`
func ToHclSearchReplace ¶
ToHclSearchReplace generates hcl expression from `input`
func UpdateMigratedResourceBlock ¶
func UpdateMigratedResourceBlock(workingDirectory string, resources []types.GenericUpdateResource) error
UpdateMigratedResourceBlock searches tf files in working directory and update generic patch resource's target
Types ¶
This section is empty.