Documentation ¶
Index ¶
Constants ¶
View Source
const ( // TypeTerraform represents the terraform block. TypeTerraform = "terraform" // TypeBackend represents the backend block inside terraform block. TypeBackend = "backend" // TypeRequiredProviders represents the required_providers block inside terraform block. TypeRequiredProviders = "required_providers" // TypeProvider represents the provider block. TypeProvider = "provider" // TypeModule represents the module block. TypeModule = "module" // TypeVariable represents the variable block. TypeVariable = "variable" // TypeOutput represents the output block. TypeOutput = "output" // TypeResource represents the resource block. TypeResource = "resource" // TypeK8s represents the kubernetes block. TypeK8s = "kubernetes" // TypeFeatures represents the features block. TypeFeatures = "features" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Block ¶
type Block struct { // Type the type of the block, e.g. provider, module, resource, etc. Type string // Label the label of the block, e.g. aws, aws_instance, etc. Labels []string // Attributes the Attributes of the block. Attributes map[string]any // contains filtered or unexported fields }
Block represents to terraform config block like terraform block, provider block, module block, etc. Block.Print() will generate the config string of the block. E.g. Provider block: *
block1 = &Block{ Type: "provider", Labels: []string{"aws"}, Attributes: map[string]any{ "region": "us-east-1", }, }, block1.Print("hcl") will generate the string: provider "aws" { region = "us-east-1" } block2 = &Block{ Type: "data", Labels: []string{"label1", "label2"}, Attributes: map[string]any{ "test": "test" }, } block2.Print("hcl") will generate the string: data "label1" "label2" { test = "test" }
func (*Block) AppendBlock ¶
func (*Block) EncodeToBytes ¶
EncodeToBytes returns the block as a config bytes.
type Blocks ¶
type Blocks []*Block
func AppendBlocks ¶
AppendBlocks will append the blocks to the target.
func (*Blocks) GetProviderNames ¶
Click to show internal directories.
Click to hide internal directories.