pkg

package
v0.0.0-...-007b9a1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 27 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectoryAutoFix

func DirectoryAutoFix(dirPath string) error

Types

type Arg

type Arg struct {
	Name string
	File *hcl.File
	*HclAttribute
}

Arg is a wrapper of the attribute

type Args

type Args []*Arg

Args is the collection of args with the same type

func (Args) SortByName

func (a Args) SortByName() Args

func (Args) SortHeadMetaArgs

func (a Args) SortHeadMetaArgs() Args

type AutoFixBlock

type AutoFixBlock interface {
	AutoFix()
}

func BuildRemovedBlock

func BuildRemovedBlock(b *HclBlock, f *hcl.File) AutoFixBlock

type HclAttribute

type HclAttribute struct {
	*hclsyntax.Attribute
	WriteAttribute *hclwrite.Attribute
}

func NewHclAttribute

func NewHclAttribute(attribute *hclsyntax.Attribute, writeAttribute *hclwrite.Attribute) *HclAttribute

type HclBlock

type HclBlock struct {
	*hclsyntax.Block
	WriteBlock *hclwrite.Block
}

func NewHclBlock

func NewHclBlock(rb *hclsyntax.Block, wb *hclwrite.Block) *HclBlock

func (*HclBlock) Attributes

func (b *HclBlock) Attributes() map[string]*HclAttribute

func (*HclBlock) Clear

func (b *HclBlock) Clear() *HclBlock

func (*HclBlock) NestedBlocks

func (b *HclBlock) NestedBlocks() []*HclBlock

type HclFile

type HclFile struct {
	*hcl.File

	WriteFile *hclwrite.File
	FileName  string
	// contains filtered or unexported fields
}

func ParseConfig

func ParseConfig(config []byte, filename string) (*HclFile, hcl.Diagnostics)

func (*HclFile) AutoFix

func (f *HclFile) AutoFix()

func (*HclFile) ClearWriteFile

func (f *HclFile) ClearWriteFile()

func (*HclFile) GetBlock

func (f *HclFile) GetBlock(i int) *HclBlock

type LocalsBlock

type LocalsBlock struct {
	HclBlock   *HclBlock
	Attributes Args
	File       *hcl.File
}

func BuildLocalsBlock

func BuildLocalsBlock(block *HclBlock, file *hcl.File) *LocalsBlock

func (*LocalsBlock) AutoFix

func (b *LocalsBlock) AutoFix()

type MovedBlock

type MovedBlock struct {
	HclBlock *HclBlock
	File     *hcl.File
}

func BuildMovedBlock

func BuildMovedBlock(block *HclBlock, file *hcl.File) *MovedBlock

func (*MovedBlock) AutoFix

func (b *MovedBlock) AutoFix()

type NestedBlock

type NestedBlock struct {
	SortField string
	Index     int
	// contains filtered or unexported fields
}

NestedBlock is a wrapper of the nested Block

func (*NestedBlock) AutoFix

func (b *NestedBlock) AutoFix()

func (*NestedBlock) BlockType

func (b *NestedBlock) BlockType() string

func (*NestedBlock) DefRange

func (b *NestedBlock) DefRange() hcl.Range

DefRange gets the definition range of the nested Block

type NestedBlocks

type NestedBlocks struct {
	Blocks []*NestedBlock
	Range  *hcl.Range
}

NestedBlocks is the collection of nestedBlocks with the same type

func (*NestedBlocks) GetRange

func (b *NestedBlocks) GetRange() *hcl.Range

GetRange returns the entire range of this type of nestedBlocks

type OutputBlock

type OutputBlock struct {
	Block      *HclBlock
	Attributes Args
}

func BuildOutputBlock

func BuildOutputBlock(f *hcl.File, b *HclBlock) *OutputBlock

func (*OutputBlock) AutoFix

func (b *OutputBlock) AutoFix()

type OutputsFile

type OutputsFile struct {
	File *HclFile
	// contains filtered or unexported fields
}

func BuildOutputsFile

func BuildOutputsFile(f *HclFile) *OutputsFile

func (*OutputsFile) AutoFix

func (f *OutputsFile) AutoFix()

type RemovedBlock

type RemovedBlock struct {
	HclBlock *HclBlock
	File     *hcl.File
}

func (*RemovedBlock) AutoFix

func (r *RemovedBlock) AutoFix()

type ResourceBlock

type ResourceBlock struct {
	Type                 string
	TailMetaArgs         Args
	TailMetaNestedBlocks *NestedBlocks
	// contains filtered or unexported fields
}

ResourceBlock is the wrapper of a resource Block

func BuildBlockWithSchema

func BuildBlockWithSchema(block *HclBlock, file *hcl.File) *ResourceBlock

BuildBlockWithSchema Build the root Block wrapper using hclsyntax.Block

func (*ResourceBlock) AutoFix

func (b *ResourceBlock) AutoFix()

type TerraformBlock

type TerraformBlock struct {
	HclBlock               *HclBlock
	RequiredProvidersBlock *HclBlock

	File *hcl.File
	// contains filtered or unexported fields
}

func BuildTerraformBlock

func BuildTerraformBlock(block *HclBlock, file *hcl.File) *TerraformBlock

func (*TerraformBlock) AutoFix

func (b *TerraformBlock) AutoFix()

type VariableBlock

type VariableBlock struct {
	Block      *HclBlock
	Attributes Args
}

func BuildVariableBlock

func BuildVariableBlock(f *hcl.File, b *HclBlock) *VariableBlock

func (*VariableBlock) AutoFix

func (b *VariableBlock) AutoFix()

type VariablesFile

type VariablesFile struct {
	File *HclFile
	// contains filtered or unexported fields
}

func BuildVariablesFile

func BuildVariablesFile(f *HclFile) *VariablesFile

func (*VariablesFile) AutoFix

func (f *VariablesFile) AutoFix()

Jump to

Keyboard shortcuts

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