Documentation
¶
Index ¶
- func HclWriteBodyFindAllMatchingBlocks(b *hclwrite.Body, typeName string, labels []string) []*hclwrite.Block
- func Refactor(rootModuleAbsPath string, sourceAddr []string, destAddr []string, ...) error
- func RenameAttributeName(attr *hclwrite.Attribute, name string)
- func RenameVariablePrefixInBody(body *hclwrite.Body, sourceAddrs []string, destAddrs []string)
- type ModuleConfigs
- type ModuleSources
- func LoadModule(dir string) (ModuleSources, error)
- func RefactorAttributeInModule(mc *ModuleConfigs, defTypeId, refTypeId string, oldAddrs, newAddrs []string, ...) (ModuleSources, error)
- func RefactorDataSourceAttribute(mc *ModuleConfigs, dsType string, dsName string, oldAddr, newAddr []string, ...) (ModuleSources, error)
- func RefactorDataSourceName(mc *ModuleConfigs, dsType, oldName, newName, currentModuleAbsPath string) (ModuleSources, error)
- func RefactorDataSourceType(mc *ModuleConfigs, oldType, newType, currentModuleAbsPath string) (ModuleSources, error)
- func RefactorLabelInModule(mc *ModuleConfigs, defTypeId, refTypeId string, oldLabels, newLabels []string, ...) (ModuleSources, error)
- func RefactorModuleName(mc *ModuleConfigs, oldName, newName, currentModuleAbsPath string) (ModuleSources, error)
- func RefactorReourceAttribute(mc *ModuleConfigs, resType string, resName string, oldAddr, newAddr []string, ...) (ModuleSources, error)
- func RefactorResourceName(mc *ModuleConfigs, resType, oldName, newName, currentModuleAbsPath string) (ModuleSources, error)
- func RefactorResourceType(mc *ModuleConfigs, oldType, newType, currentModuleAbsPath string) (ModuleSources, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HclWriteBodyFindAllMatchingBlocks ¶
func HclWriteBodyFindAllMatchingBlocks(b *hclwrite.Body, typeName string, labels []string) []*hclwrite.Block
HclWriteBodyFindAllMatchingBlocks checks the top level blocks of the body and returns those matching the type name and labels (if any). Each label component could be "*" to match any.
func RenameAttributeName ¶
Types ¶
type ModuleConfigs ¶
type ModuleConfigs struct {
// contains filtered or unexported fields
}
func NewModuleConfigs ¶
func NewModuleConfigs(path string) (*ModuleConfigs, error)
type ModuleSources ¶
func LoadModule ¶
func LoadModule(dir string) (ModuleSources, error)
LoadModule looks for Terraform configuration files in the given directory and loads each of them into memory as source code, in preparation for further analysis and conversion.
At this stage the files are not parsed at all. Instead, we just read the raw bytes from the file so that they can be passed into a parser in a separate step.
If the given directory or any of the files cannot be read, an error is returned. It is not safe to proceed with processing in that case because we cannot "see" all of the source code for the configuration.
func RefactorAttributeInModule ¶
func RefactorAttributeInModule(mc *ModuleConfigs, defTypeId, refTypeId string, oldAddrs, newAddrs []string, currentModuleAbsPath string, f locateDeclarationFunc) (ModuleSources, error)
func RefactorDataSourceAttribute ¶
func RefactorDataSourceAttribute(mc *ModuleConfigs, dsType string, dsName string, oldAddr, newAddr []string, currentModuleAbsPath string) (ModuleSources, error)
func RefactorDataSourceName ¶
func RefactorDataSourceName(mc *ModuleConfigs, dsType, oldName, newName, currentModuleAbsPath string) (ModuleSources, error)
func RefactorDataSourceType ¶
func RefactorDataSourceType(mc *ModuleConfigs, oldType, newType, currentModuleAbsPath string) (ModuleSources, error)
func RefactorLabelInModule ¶
func RefactorLabelInModule(mc *ModuleConfigs, defTypeId, refTypeId string, oldLabels, newLabels []string, currentModuleAbsPath string, f locateDeclarationFunc) (ModuleSources, error)
func RefactorModuleName ¶
func RefactorModuleName(mc *ModuleConfigs, oldName, newName, currentModuleAbsPath string) (ModuleSources, error)
func RefactorReourceAttribute ¶
func RefactorReourceAttribute(mc *ModuleConfigs, resType string, resName string, oldAddr, newAddr []string, currentModuleAbsPath string) (ModuleSources, error)
func RefactorResourceName ¶
func RefactorResourceName(mc *ModuleConfigs, resType, oldName, newName, currentModuleAbsPath string) (ModuleSources, error)
func RefactorResourceType ¶
func RefactorResourceType(mc *ModuleConfigs, oldType, newType, currentModuleAbsPath string) (ModuleSources, error)