Documentation
¶
Overview ¶
Package required_providers provides a generator for Terraform required_providers blocks. This implements DEV-3124: Pin provider versions of components using terraform required_providers.
Index ¶
- Constants
- type Generator
- func (g *Generator) DefaultFilename() string
- func (g *Generator) Generate(ctx context.Context, genCtx *generator.GeneratorContext) (map[string]any, error)
- func (g *Generator) Name() string
- func (g *Generator) ShouldGenerate(genCtx *generator.GeneratorContext) bool
- func (g *Generator) Validate(genCtx *generator.GeneratorContext) error
Constants ¶
View Source
const ( // Name is the unique identifier for this generator. Name = "required_providers" // DefaultFilenameConst is the default output filename for required_providers blocks. DefaultFilenameConst = "terraform_override.tf.json" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct{}
Generator generates Terraform required_providers blocks (terraform_override.tf.json). This enables users to pin provider versions via stack configuration:
terraform:
required_version: ">= 1.10.1"
required_providers:
aws:
source: "hashicorp/aws"
version: "~> 5.0"
func (*Generator) DefaultFilename ¶
DefaultFilename returns the default output filename.
func (*Generator) Generate ¶
func (g *Generator) Generate(ctx context.Context, genCtx *generator.GeneratorContext) (map[string]any, error)
Generate produces the terraform block with required_version and required_providers. The output structure is:
{
"terraform": {
"required_version": ">= 1.10.1",
"required_providers": {
"aws": {
"source": "hashicorp/aws",
"version": "~> 5.0"
}
}
}
}
func (*Generator) ShouldGenerate ¶
func (g *Generator) ShouldGenerate(genCtx *generator.GeneratorContext) bool
ShouldGenerate returns true if RequiredVersion or RequiredProviders has data.
Click to show internal directories.
Click to hide internal directories.