pkg

package
v0.0.0-...-ed3d0be Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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 Refactor

func Refactor(rootModuleAbsPath string, sourceAddr []string, destAddr []string, currentModuleAbsPath string) error

func RenameAttributeName

func RenameAttributeName(attr *hclwrite.Attribute, name string)

func RenameVariablePrefixInBody

func RenameVariablePrefixInBody(body *hclwrite.Body, sourceAddrs []string, destAddrs []string)

Types

type ModuleConfigs

type ModuleConfigs struct {
	// contains filtered or unexported fields
}

func NewModuleConfigs

func NewModuleConfigs(path string) (*ModuleConfigs, error)

func (ModuleConfigs) Get

func (mc ModuleConfigs) Get(modpath string) *configs.Module

type ModuleSources

type ModuleSources map[string][]byte

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL