Documentation
¶
Overview ¶
Package locals provides resolution for file-scoped local variables in Atmos stack configurations. Locals enable users to define temporary variables that are available within a single file, similar to Terraform and Terragrunt locals.
Key features: - File-scoped: locals do not inherit across file boundaries - Dependency resolution: locals can reference other locals with topological sorting - Cycle detection: circular dependencies are detected and reported clearly - Multi-scope: locals can be defined at global, component-type, and component levels
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver handles dependency resolution and cycle detection for locals. It uses topological sorting to determine the order in which locals should be resolved.
func NewResolver ¶
NewResolver creates a resolver for a set of locals. The filePath is used for error message context.
func (*Resolver) GetDependencies ¶
GetDependencies returns the dependency graph for testing/debugging.
func (*Resolver) Resolve ¶
Resolve processes all locals in dependency order, returning resolved values. Parent locals (from outer scopes) are available during resolution. Returns error if circular dependency detected or undefined local referenced.
func (*Resolver) WithTemplateContext ¶ added in v1.205.0
WithTemplateContext sets additional context available during template resolution. This allows locals to reference other sections like .settings and .vars from the same file. Returns the resolver for method chaining.
func (*Resolver) WithYamlFunctionProcessor ¶ added in v1.205.0
func (r *Resolver) WithYamlFunctionProcessor(processor YamlFunctionProcessor) *Resolver
WithYamlFunctionProcessor sets a callback for processing YAML function tags. This allows locals to use YAML functions like !terraform.state and !terraform.output. Returns the resolver for method chaining.
type YamlFunctionProcessor ¶ added in v1.205.0
YamlFunctionProcessor is a callback for processing YAML function tags in locals. It takes a string value (e.g., "!terraform.state component .output") and returns the resolved value. If the string is not a YAML function, it should return (nil, nil) to indicate no processing was done.