config

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MPL-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Package config provides high level Terramate configuration facilities.

Index

Constants

View Source
const (
	ErrScriptSchema              errors.Kind = "script config has an invalid schema"
	ErrScriptInvalidType         errors.Kind = "invalid type for script field"
	ErrScriptInvalidTypeCommand  errors.Kind = "invalid type for script.job.command"
	ErrScriptInvalidTypeCommands errors.Kind = "invalid type for script.job.commands"
	ErrScriptEmptyCmds           errors.Kind = "job command or commands evaluated to empty list"
	ErrScriptInvalidCmdOptions   errors.Kind = "invalid options for script command"
)

Errors for indicating invalid script schema

View Source
const (
	// ErrStackValidation indicates an error when validating the stack fields.
	ErrStackValidation errors.Kind = "validating stack fields"

	// ErrStackDuplicatedID indicates that two or more stacks have the same ID.
	ErrStackDuplicatedID errors.Kind = "duplicated ID found on stacks"

	// ErrStackInvalidWatch indicates the stack.watch attribute contains invalid values.
	ErrStackInvalidWatch errors.Kind = "invalid stack.watch attribute"

	// ErrStackInvalidTag indicates the stack.tags is invalid.
	ErrStackInvalidTag errors.Kind = "invalid stack.tags entry"

	// ErrStackInvalidWants indicates the stack.wants is invalid.
	ErrStackInvalidWants errors.Kind = "invalid stack.wants entry"

	// ErrStackInvalidWantedBy indicates the stack.wanted_by is invalid.
	ErrStackInvalidWantedBy errors.Kind = "invalid stack.wanted_by entry"
)
View Source
const (
	// ErrSchema indicates that the configuration has an invalid schema.
	ErrSchema errors.Kind = "config has an invalid schema"
)
View Source
const MaxScriptDescRunes = 1000

MaxScriptDescRunes defines the maximum number of runes allowed for a script description.

View Source
const MaxScriptNameRunes = 128

MaxScriptNameRunes defines the maximum number of runes allowed for a script name.

Variables

This section is empty.

Functions

func BundleFunc added in v0.16.0

func BundleFunc(bundles []*Bundle, currentEnv *Environment) function.Function

BundleFunc returns the `tm_bundle` function.

func BundlesFunc added in v0.16.0

func BundlesFunc(bundles []*Bundle, currentEnv *Environment) function.Function

BundlesFunc returns the `tm_bundles` function.

func EvalBool added in v0.13.1

func EvalBool(evalctx *eval.Context, expr hhcl.Expression, name string) (bool, error)

EvalBool evaluates a boolean expression.

func EvalBundleInputSchemas added in v0.16.0

func EvalBundleInputSchemas(evalctx *eval.Context, def *hcl.DefineBundle) ([]*typeschema.Schema, error)

EvalBundleInputSchemas evaluates input definitions into type schemas for a bundle.

func EvalBundleSchemaNamespaces added in v0.16.0

func EvalBundleSchemaNamespaces(root *Root, resolveAPI resolve.API, evalctx *eval.Context, defHCL *hcl.DefineBundle, allowFetch bool) (typeschema.SchemaNamespaces, error)

EvalBundleSchemaNamespaces evaluates the uses_schemas blocks of a bundle definition.

func EvalComponentInputSchemas added in v0.16.0

func EvalComponentInputSchemas(evalctx *eval.Context, def *hcl.DefineComponent) ([]*typeschema.Schema, error)

EvalComponentInputSchemas evaluates input definitions into type schemas for a component.

func EvalComponentSchemaNamespaces added in v0.16.0

func EvalComponentSchemaNamespaces(root *Root, resolveAPI resolve.API, evalctx *eval.Context, defHCL *hcl.DefineComponent, allowFetch bool) (typeschema.SchemaNamespaces, error)

EvalComponentSchemaNamespaces evaluates the uses_schemas blocks of a component definition.

func EvalDefineSchema added in v0.16.0

func EvalDefineSchema(evalctx *eval.Context, schemaHCL *hcl.DefineSchema) (*typeschema.Schema, error)

EvalDefineSchema evaluates a schema definition into a Schema.

func EvalInputFromStackID added in v0.11.8

func EvalInputFromStackID(evalctx *eval.Context, input hcl.Input) (string, error)

EvalInputFromStackID the `from_stack_id` field of an input block using the provided evaluation context.

func EvalInputSchema added in v0.16.0

func EvalInputSchema(evalctx *eval.Context, inputHCL *hcl.DefineInput) (*typeschema.Schema, error)

EvalInputSchema evaluates an input definition into a type schema.

func EvalInputs added in v0.16.0

func EvalInputs(evalctx *eval.Context, rootNS string, instRange info.Range, inputs *ast.MergedBlock, inputsAttr *ast.Attribute, inputDefs map[string]*hcl.DefineInput, schemas typeschema.SchemaNamespaces) (map[string]cty.Value, error)

EvalInputs evaluates input values against their definitions and schemas. evalctx will be modified to contain `{rootNS}.input`.

func EvalObjectAttributes added in v0.16.0

func EvalObjectAttributes(evalctx *eval.Context, attrsHCL []*hcl.DefineObjectAttribute) ([]*typeschema.ObjectTypeAttribute, error)

EvalObjectAttributes evaluates HCL object attribute definitions into type attributes.

func EvalString added in v0.13.1

func EvalString(evalctx *eval.Context, expr hhcl.Expression, name string) (string, error)

EvalString evaluates a string expression.

func EvalUsesSchemas added in v0.16.0

func EvalUsesSchemas(root *Root, resolveAPI resolve.API, evalctx *eval.Context, usesSchemasHCL *hcl.UsesSchemas, allowFetch bool) ([]*typeschema.Schema, error)

EvalUsesSchemas evaluates a uses_schemas block and returns the resolved schemas.

func FlattenBundleTemplate added in v0.16.0

func FlattenBundleTemplate(bundleTpl *hcl.BundleTemplate) []*hcl.Bundle

FlattenBundleTemplate will flatten a bundle template into a list of concrete bundles. If the template contained environments, one bundle per environment is returned (base + env value overrides) If not, a single bundle is returned (base values only).

func IsStack

func IsStack(root *Root, dir string) bool

IsStack returns true if the given directory is a stack, false otherwise.

func MakeEnvObject added in v0.16.0

func MakeEnvObject(env *Environment) cty.Value

MakeEnvObject converts an Environment into a cty object value.

func MakeObjectFromBundle added in v0.16.0

func MakeObjectFromBundle(b *Bundle) cty.Value

MakeObjectFromBundle converts a Bundle into a cty object value.

func ReverseStacks

func ReverseStacks(stacks List[*SortableStack])

ReverseStacks reverses the given stacks slice.

func Skip

func Skip(name string) bool

Skip returns true if the given file/dir name should be ignored by Terramate.

func TmSourceFunc added in v0.16.0

func TmSourceFunc(stackDir, compSrc, bundleSrc string) function.Function

TmSourceFunc returns the `tm_source` function.

func ValidateWatchPaths added in v0.6.1

func ValidateWatchPaths(rootdir string, stackpath string, paths []string) (project.Paths, error)

ValidateWatchPaths validates if the provided watch paths points to regular files inside the project repository.

Types

type Assert

type Assert struct {
	Assertion bool
	Warning   bool
	Message   string
	Range     hhcl.Range
}

Assert represents evaluated assert block configuration.

func EvalAssert

func EvalAssert(evalctx *eval.Context, cfg hcl.AssertConfig) (Assert, error)

EvalAssert evaluates a given assert configuration and returns its evaluated form.

type Bundle added in v0.16.0

type Bundle struct {
	Class          string
	Alias          string
	Name           string
	UUID           string
	Workdir        project.Path
	Source         string
	ResolvedSource project.Path
	Inst           *hcl.Bundle
	Environment    *Environment
	Stacks         map[project.Path]StackMetadata
	Generate       hcl.GenerateConfig
	Inputs         map[string]cty.Value
	Exports        map[string]cty.Value
	Info           info.Range
}

Bundle represents the instantiation of a bundle.

func EvalBundle added in v0.16.0

func EvalBundle(root *Root, resolveAPI resolve.API, evalctx *eval.Context, inst *hcl.Bundle, envs []*Environment, allowFetch bool) (*Bundle, error)

EvalBundle evaluates the bundle.

func EvalBundles added in v0.16.0

func EvalBundles(root *Root, bundlesHCL []*hcl.BundleTemplate, resolveAPI resolve.API, evalctx *eval.Context, envs []*Environment, allowFetch bool) ([]*Bundle, error)

EvalBundles recursively collects all the bundles in the given dir and evaluates them.

type BundleDefinition added in v0.16.0

type BundleDefinition struct {
	Class string

	ScaffoldingName string
	ScaffoldingPath string
}

BundleDefinition represents the definition of a bundle.

func EvalBundleDefinition added in v0.16.0

func EvalBundleDefinition(_ *Root, evalctx *eval.Context, def *hcl.DefineBundle) (*BundleDefinition, error)

EvalBundleDefinition evaluates a bundle definition's scaffolding metadata.

type BundleDefinitionEntry added in v0.16.0

type BundleDefinitionEntry struct {
	Tree   *Tree
	Define *hcl.DefineBundle
}

BundleDefinitionEntry pairs a config tree with its bundle definition.

func ListLocalBundleDefinitions added in v0.16.0

func ListLocalBundleDefinitions(root *Root, dir project.Path) ([]BundleDefinitionEntry, error)

ListLocalBundleDefinitions lists all bundle definitions found under the given directory.

func LoadSingleBundleDefinition added in v0.16.0

func LoadSingleBundleDefinition(root *Root, dir project.Path) (*BundleDefinitionEntry, error)

LoadSingleBundleDefinition loads a single bundle definition from the given directory.

type Component added in v0.16.0

type Component struct {
	Name           string
	Source         string
	ResolvedSource project.Path
	Environment    *Environment
	Inputs         map[string]cty.Value
	Info           info.Range
	Skipped        bool
}

Component represents the instantiation of a component.

func EvalComponent added in v0.16.0

func EvalComponent(root *Root, resolveAPI resolve.API, evalctx *eval.Context, component *hcl.Component, bundles []*Bundle, envs []*Environment, allowFetch bool) (*Component, *hcl.Config, error)

EvalComponent evaluates a component and returns the component with the inputs resolved. evalctx will be modified to contain `component.input`.

type ComponentDefinitionEntry added in v0.16.0

type ComponentDefinitionEntry struct {
	Tree   *Tree
	Define *hcl.DefineComponent
}

ComponentDefinitionEntry pairs a config tree with its component definition.

func ListLocalComponentDefinitions added in v0.16.0

func ListLocalComponentDefinitions(root *Root, dir project.Path) ([]ComponentDefinitionEntry, error)

ListLocalComponentDefinitions lists all component definitions found under the given directory.

type DirElem

type DirElem interface {
	Dir() project.Path
}

DirElem represents a node which is represented by a directory. Eg.: stack, config, etc.

type Environment added in v0.16.0

type Environment struct {
	ID          string
	Name        string
	Description string
	PromoteFrom string
	Info        info.Range
}

Environment is the evaluated environment block.

func EvalEnvironments added in v0.16.0

func EvalEnvironments(root *Root, evalctx *eval.Context) ([]*Environment, error)

EvalEnvironments evaluates the environment blocks from the root configuration.

type Input added in v0.10.1

type Input struct {
	info.Range
	Name        string
	Backend     string
	FromStackID string

	Sensitive *bool
	// contains filtered or unexported fields
}

Input represents an evaluated input block

func EvalInput added in v0.10.1

func EvalInput(evalctx *eval.Context, input hcl.Input) (Input, error)

EvalInput evaluates an input block using the provided evaluation context.

func (*Input) Mock added in v0.10.1

func (i *Input) Mock(evalctx *eval.Context) (cty.Value, bool, error)

Mock evaluates and returns the mock value, if any. The returned boolean will be true only iff the mock exists in the config.

func (*Input) Value added in v0.10.1

func (i *Input) Value(evalctx *eval.Context) (cty.Value, error)

Value evaluates and returns the actual value for the input given the outputs.

type InputDefinition added in v0.16.0

type InputDefinition struct {
	Name          string
	Prompt        string
	PromptDefault cty.Value
	Description   string
	Type          typeschema.Type
	Options       []NamedValue
	Multiline     bool
	Multiselect   bool
}

InputDefinition is the evaluated input definition.

func EvalBundleInputDefinitions added in v0.16.0

func EvalBundleInputDefinitions(evalctx *eval.Context, def *hcl.DefineBundle, schemas typeschema.SchemaNamespaces) ([]*InputDefinition, error)

EvalBundleInputDefinitions evaluates the input definitions of a bundle. evalctx should contain exports.

type Inputs added in v0.10.1

type Inputs []Input

Inputs is a list of Input.

type List

type List[T DirElem] []T

List of directory based elements which implements the sorting interface by the directory path.

func LoadAllStacks

func LoadAllStacks(root *Root, cfg *Tree) (List[*SortableStack], error)

LoadAllStacks loads all stacks inside the given rootdir.

func StacksFromTrees

func StacksFromTrees(trees List[*Tree]) (List[*SortableStack], error)

StacksFromTrees converts a List[*Tree] into a List[*Stack].

func (List[T]) Len

func (l List[T]) Len() int

func (List[T]) Less

func (l List[T]) Less(i, j int) bool

func (List[T]) Paths

func (l List[T]) Paths() project.Paths

Paths returns the project paths from the list.

func (List[T]) Swap

func (l List[T]) Swap(i, j int)

type Metadata added in v0.16.0

type Metadata struct {
	Dir project.Path

	Class       string
	Name        string
	Version     string
	Description string
}

Metadata is the evaluated metadata.

func EvalMetadata added in v0.16.0

func EvalMetadata(_ *Root, evalctx *eval.Context, tree *Tree, def *hcl.Metadata) (*Metadata, error)

EvalMetadata evaluates a metadata block into a Metadata value.

type NamedValue added in v0.16.0

type NamedValue struct {
	Name  string
	Value cty.Value
}

NamedValue is a name/value pair.

type Output added in v0.10.1

type Output struct {
	info.Range
	Name        string
	Description string
	Backend     string
	Value       hhcl.Expression
	Sensitive   *bool
}

Output represents an evaluated output block

func EvalOutput added in v0.10.1

func EvalOutput(evalctx *eval.Context, output hcl.Output) (Output, error)

EvalOutput evaluates an output block using the provided evaluation context.

type Outputs added in v0.10.1

type Outputs []Output

Outputs is a list of outputs.

type Root

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

Root is the root configuration tree. This type is just for ensure better type checking for the cases where a configuration for the root directory is expected and not from anywhere else.

func LoadRoot

func LoadRoot(rootdir string, loadTerragruntModules bool, hclOpts ...hcl.Option) (*Root, error)

LoadRoot loads the root configuration tree.

func NewRoot

func NewRoot(tree *Tree, hclOpts ...hcl.Option) *Root

NewRoot creates a new Root tree for the cfg tree.

func TryLoadConfig

func TryLoadConfig(fromdir string, loadTerragruntModules bool, hclOpts ...hcl.Option) (tree *Root, configpath string, found bool, err error)

TryLoadConfig try to load the Terramate configuration tree. It looks for the the config in fromdir and all parent directories until / is reached. If the configuration is found, it returns the whole configuration tree, configpath != "" and found as true.

func (*Root) ChangeDetectionGitConfig added in v0.11.0

func (root *Root) ChangeDetectionGitConfig() (*hcl.GitChangeDetectionConfig, bool)

ChangeDetectionGitConfig returns the `terramate.config.change_detection.git` object config.

func (*Root) HCLOptions added in v0.13.1

func (root *Root) HCLOptions() []hcl.Option

HCLOptions returns the HCL options used to load the configuration.

func (*Root) HasExperiment added in v0.4.4

func (root *Root) HasExperiment(name string) bool

HasExperiment returns true if the given experiment name is set.

func (*Root) HasTerragruntStacks added in v0.6.5

func (root *Root) HasTerragruntStacks() bool

HasTerragruntStacks returns true if the stack loading has detected Terragrunt files.

func (*Root) HostDir

func (root *Root) HostDir() string

HostDir returns the root directory.

func (*Root) IsTargetsEnabled added in v0.9.0

func (root *Root) IsTargetsEnabled() bool

IsTargetsEnabled returns the configured `terramate.config.cloud.targets.enabled` option.

func (*Root) IsTerragruntChangeDetectionEnabled added in v0.6.5

func (root *Root) IsTerragruntChangeDetectionEnabled() (ret bool)

IsTerragruntChangeDetectionEnabled returns true if Terragrunt change detection integration must be executed.

func (*Root) LoadSubTree

func (root *Root) LoadSubTree(cfgdir project.Path) error

LoadSubTree loads a subtree located at cfgdir into the current tree.

func (*Root) Lookup

func (root *Root) Lookup(path project.Path) (node *Tree, found bool)

Lookup a node from the root using a filesystem query path.

func (*Root) Lookup2 added in v0.10.7

func (root *Root) Lookup2(path project.Path) (node *Tree, skipped bool, found bool)

Lookup2 is like Lookup but returns skipped as true if the path is not found because a parent directory was skipped.

func (*Root) Runtime

func (root *Root) Runtime() project.Runtime

Runtime returns a copy the runtime for the root terramate namespace as a cty.Value map.

func (*Root) StackByID added in v0.11.8

func (root *Root) StackByID(id string) (*Stack, bool, error)

StackByID returns the stack with the given ID.

func (*Root) Stacks

func (root *Root) Stacks() project.Paths

Stacks return the stacks paths.

func (*Root) StacksByPaths

func (root *Root) StacksByPaths(base project.Path, relpaths ...string) List[*Tree]

StacksByPaths returns the stacks from the provided relative paths.

func (*Root) StacksByTagsFilters

func (root *Root) StacksByTagsFilters(filters []string) (project.Paths, error)

StacksByTagsFilters returns the paths of all stacks matching the filters.

func (*Root) TerragruntEnabledOption added in v0.6.5

func (root *Root) TerragruntEnabledOption() hcl.TerragruntChangeDetectionEnabledOption

TerragruntEnabledOption returns the configured `terramate.config.change_detection.terragrunt.enabled` option.

func (*Root) Tree

func (root *Root) Tree() *Tree

Tree returns the root configuration tree.

type Scaffold added in v0.16.0

type Scaffold struct {
	PackageSources []string
}

Scaffold is the evaluated scaffold block.

func EvalScaffold added in v0.16.0

func EvalScaffold(evalctx *eval.Context, scaffoldHCL *hcl.Scaffold) (*Scaffold, error)

EvalScaffold evaluates the scaffold block.

type Script added in v0.4.4

type Script struct {
	Range       info.Range
	Labels      []string
	Name        string
	Description string
	Jobs        []ScriptJob
}

Script represents an evaluated script block

func EvalScript added in v0.4.4

func EvalScript(evalctx *eval.Context, script hcl.Script) (Script, error)

EvalScript evaluates a script block using the provided evaluation context

type ScriptCmd added in v0.4.4

type ScriptCmd struct {
	Args    []string
	Options *ScriptCmdOptions
}

ScriptCmd represents an evaluated script command

type ScriptCmdOptions added in v0.4.4

type ScriptCmdOptions struct {
	CloudSyncDeployment    bool
	CloudSyncDriftStatus   bool
	CloudSyncPreview       bool
	CloudSyncLayer         preview.Layer
	CloudTerraformPlanFile string
	CloudTofuPlanFile      string
	CloudPlanRenderTimeout time.Duration
	UseTerragrunt          bool
	EnableSharing          bool
	MockOnFail             bool
}

ScriptCmdOptions represents optional parameters for a script command

type ScriptJob added in v0.4.4

type ScriptJob struct {
	Name        string
	Description string
	Cmd         *ScriptCmd
	Cmds        []*ScriptCmd
}

ScriptJob represents an evaluated job block

func (ScriptJob) Commands added in v0.4.4

func (es ScriptJob) Commands() []*ScriptCmd

Commands is a convenience method for callers who don't specifically care about which command attr was set e.g. command or commands. This method returns a list of commands irrespective of whether they were set through job.command or job.commands

type SortableStack

type SortableStack struct {
	*Stack
}

SortableStack is a wrapper for the Stack which implements the DirElem type.

func (SortableStack) Dir

func (s SortableStack) Dir() project.Path

Dir implements the List type.

type Stack

type Stack struct {
	// Dir is project's stack directory.
	Dir project.Path

	// ID of the stack.
	ID string

	// Name of the stack.
	Name string

	// Description is the description of the stack.
	Description string

	// Tags is the list of tags of the stack.
	// A tag
	Tags []string

	// After is a list of stack paths that must run before this stack.
	After []string

	// Before is a list of stack paths that must run after this stack.
	Before []string

	// Wants is the list of stacks that must be selected whenever this stack
	// is selected.
	Wants []string

	// wantedBy is the list of stacks that must select this stack
	// whenever they are selected.
	WantedBy []string

	// Watch is the list of files to be watched for changes.
	Watch project.Paths

	// IsChanged tells if this is a changed stack.
	IsChanged bool
}

Stack represents an evaluated stack.

func LoadStack

func LoadStack(root *Root, dir project.Path) (*Stack, error)

LoadStack a single stack from dir.

func NewStackFromHCL

func NewStackFromHCL(root string, cfg hcl.Config) (*Stack, error)

NewStackFromHCL creates a new stack from raw configuration cfg.

func TryLoadStack

func TryLoadStack(root *Root, cfgdir project.Path) (stack *Stack, found bool, err error)

TryLoadStack tries to load a single stack from dir. It sets found as true in case the stack was successfully loaded.

func (*Stack) AppendBefore

func (s *Stack) AppendBefore(path string)

AppendBefore appends the path to the list of stacks that must run after this stack.

func (*Stack) HostDir

func (s *Stack) HostDir(root *Root) string

HostDir returns the file system absolute path of stack.

func (*Stack) PathBase

func (s *Stack) PathBase() string

PathBase returns the base name of the stack path.

func (*Stack) RelPath

func (s *Stack) RelPath() string

RelPath returns the project's relative path of stack.

func (*Stack) RelPathToRoot

func (s *Stack) RelPathToRoot(root *Root) string

RelPathToRoot returns the relative path from the stack to root.

func (*Stack) RuntimeValues

func (s *Stack) RuntimeValues(root *Root) map[string]cty.Value

RuntimeValues returns the runtime "terramate" namespace for the stack.

func (*Stack) Sortable

func (s *Stack) Sortable() *SortableStack

Sortable returns an implementation of stack which can be sorted by config.List.

func (*Stack) String

func (s *Stack) String() string

String representation of the stack.

func (Stack) Validate

func (s Stack) Validate() error

Validate if all stack fields are correct.

func (Stack) ValidateSets

func (s Stack) ValidateSets() error

ValidateSets validate all stack set fields.

func (Stack) ValidateTags

func (s Stack) ValidateTags() error

ValidateTags validates if tags are correctly used in all stack fields.

type StackMetadata added in v0.16.0

type StackMetadata struct {
	Dir project.Path

	Name        string
	Description string
	Tags        []string
	After       []string
	Before      []string
	Wants       []string
	WantedBy    []string
	Watch       []string

	Skipped    bool
	Components []*hcl.Component
}

StackMetadata holds metadata for a stack within a bundle.

func (StackMetadata) Validate added in v0.16.0

func (s StackMetadata) Validate() error

Validate if all stack fields are correct.

func (StackMetadata) ValidateSets added in v0.16.0

func (s StackMetadata) ValidateSets() error

ValidateSets validate all stack set fields.

func (StackMetadata) ValidateTags added in v0.16.0

func (s StackMetadata) ValidateTags() error

ValidateTags validates if tags are correctly used in all stack fields.

type Tree

type Tree struct {
	// Node is the configuration of this tree node.
	Node hcl.Config

	Skipped bool // tells if this node subdirs were skipped

	TerramateFiles []string
	OtherFiles     []string
	TmGenFiles     []string
	TgRootFile     string
	// Children is a map of configuration dir names to tree nodes.
	Children map[string]*Tree

	// Parent is the parent node or nil if none.
	Parent *Tree
	// contains filtered or unexported fields
}

Tree is the configuration tree. The tree maps the filesystem directories, which means each directory in the project has a tree instance even if it's empty (ie no .tm files in it).

func NewTree

func NewTree(cfgdir string) *Tree

NewTree creates a new tree node.

func (*Tree) AsList

func (tree *Tree) AsList() List[*Tree]

AsList returns a list with this node and all its children.

func (*Tree) Dir

func (tree *Tree) Dir() project.Path

Dir returns the directory as a project dir.

func (*Tree) HostDir

func (tree *Tree) HostDir() string

HostDir is the node absolute directory in the host.

func (*Tree) IsEmptyConfig

func (tree *Tree) IsEmptyConfig() bool

IsEmptyConfig tells if the configuration is empty.

func (*Tree) IsInsideStack added in v0.10.6

func (tree *Tree) IsInsideStack() bool

IsInsideStack tells if current tree node is inside a parent stack.

func (*Tree) IsStack

func (tree *Tree) IsStack() bool

IsStack tells if the node is a stack.

func (*Tree) IsTerragruntModule added in v0.13.1

func (tree *Tree) IsTerragruntModule() bool

IsTerragruntModule tells if the node is a Terragrunt module.

func (*Tree) NonEmptyGlobalsParent

func (tree *Tree) NonEmptyGlobalsParent() *Tree

NonEmptyGlobalsParent returns a parent configuration which has globals defined, if any.

func (*Tree) Root

func (tree *Tree) Root() *Root

Root returns the root of the configuration tree.

func (*Tree) RootDir

func (tree *Tree) RootDir() string

RootDir returns the tree root directory..

func (*Tree) RootTree added in v0.6.5

func (tree *Tree) RootTree() *Tree

RootTree returns the tree at the project root.

func (*Tree) SharingBackend added in v0.10.1

func (tree *Tree) SharingBackend(name string) (hcl.SharingBackend, bool)

SharingBackend returns the backend with given name.

func (*Tree) Stack added in v0.5.0

func (tree *Tree) Stack() (*Stack, error)

Stack returns the stack object.

func (*Tree) Stacks

func (tree *Tree) Stacks() List[*Tree]

Stacks returns the stack nodes from the tree. The search algorithm is a Deep-First-Search (DFS).

func (*Tree) TerragruntModule added in v0.13.1

func (tree *Tree) TerragruntModule() (*tg.Module, error)

TerragruntModule returns the Terragrunt module for this node.

Directories

Path Synopsis
Package filter provides helpers for filtering objects.
Package filter provides helpers for filtering objects.
Package tag provides helpers for dealing with Terramate tags.
Package tag provides helpers for dealing with Terramate tags.

Jump to

Keyboard shortcuts

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