Help us shape the future of Go! Take the 2026 Go Developer Survey

varfile

package
v1.233.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package varfile provides a generator for Terraform variable files (.tfvars.json).

Index

Constants

View Source
const (
	// Name is the unique identifier for this generator.
	Name = "varfile"
)

Variables

This section is empty.

Functions

func ConstructFilename

func ConstructFilename(genCtx *generator.GeneratorContext) string

ConstructFilename constructs the dynamic varfile name based on the context. This follows the pattern: {context}-{component}.terraform.tfvars.json or: {context}-{folder}-{component}.terraform.tfvars.json if folder prefix exists.

Types

type Generator

type Generator struct{}

Generator generates Terraform variable files (.tfvars.json).

func (*Generator) DefaultFilename

func (g *Generator) DefaultFilename() string

DefaultFilename returns the default output filename. Note: For varfiles, the actual filename is dynamically constructed based on component and stack context. This returns a placeholder that should be overridden by the calling code.

func (*Generator) Generate

func (g *Generator) Generate(ctx context.Context, genCtx *generator.GeneratorContext) (map[string]any, error)

Generate produces the varfile content. For varfiles, the content is simply the VarsSection map.

func (*Generator) Name

func (g *Generator) Name() string

Name returns the unique identifier for this generator.

func (*Generator) ShouldGenerate

func (g *Generator) ShouldGenerate(genCtx *generator.GeneratorContext) bool

ShouldGenerate returns true if the VarsSection has data.

func (*Generator) Validate

func (g *Generator) Validate(genCtx *generator.GeneratorContext) error

Validate checks if the generator context has required data.

Jump to

Keyboard shortcuts

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