required_providers

package
v1.219.0 Latest Latest
Warning

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

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

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

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

func (g *Generator) DefaultFilename() string

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) 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 RequiredVersion or RequiredProviders has data.

func (*Generator) Validate

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

Validate checks if the generator context has valid data.

Jump to

Keyboard shortcuts

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