codegen

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Contains routines for generating terraform code

Index

Constants

View Source
const (
	// A comment that is added to the top of the generated file to indicate that this file was generated by Terragrunt.
	// We use a hardcoded random string at the end to make the string further unique.
	TerragruntGeneratedSignature = "Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa"

	// The default prefix to use for comments in the generated file
	DefaultCommentPrefix = "# "
)
View Source
const (
	ExistsErrorStr               = "error"
	ExistsSkipStr                = "skip"
	ExistsOverwriteStr           = "overwrite"
	ExistsOverwriteTerragruntStr = "overwrite_terragrunt"
)

Variables

This section is empty.

Functions

func RemoteStateConfigToTerraformCode

func RemoteStateConfigToTerraformCode(backend string, config map[string]interface{}) ([]byte, error)

Convert the arbitrary map that represents a remote state config into HCL code to configure that remote state.

func WriteToFile

func WriteToFile(terragruntOptions *options.TerragruntOptions, basePath string, config GenerateConfig) error

WriteToFile will generate a new file at the given target path with the given contents. If a file already exists at the target path, the behavior depends on the value of IfExists: - if ExistsError, return an error. - if ExistsSkip, do nothing and return - if ExistsOverwrite, overwrite the existing file

Types

type GenerateConfig

type GenerateConfig struct {
	Path             string `cty:"path"`
	IfExists         GenerateConfigExists
	IfExistsStr      string `cty:"if_exists"`
	CommentPrefix    string `cty:"comment_prefix"`
	Contents         string `cty:"contents"`
	DisableSignature bool   `cty:"disable_signature"`
	Disable          bool   `cty:"disable"`
}

Configuration for generating code

type GenerateConfigExists

type GenerateConfigExists int

An enum to represent valid values for if_exists

const (
	ExistsError GenerateConfigExists = iota
	ExistsSkip
	ExistsOverwrite
	ExistsOverwriteTerragrunt
	ExistsUnknown
)

func GenerateConfigExistsFromString

func GenerateConfigExistsFromString(val string) (GenerateConfigExists, error)

GenerateConfigExistsFromString converts a string representation of if_exists into the enum, returning an error if it is not set to one of the known values.

type GenerateFileExistsError

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

func (GenerateFileExistsError) Error

func (err GenerateFileExistsError) Error() string

type UnknownGenerateIfExistsVal

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

func (UnknownGenerateIfExistsVal) Error

func (err UnknownGenerateIfExistsVal) Error() string

Jump to

Keyboard shortcuts

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