strict

package
v0.69.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package strict provides utilities used by Terragrunt to support a "strict" mode. By default strict mode is disabled, but when enabled, any breaking changes to Terragrunt behavior that is not backwards compatible will result in an error.

Note that any behavior outlined here should be documented in /docs/_docs/04_reference/strict-mode.md

That is how users will know what to expect when they enable strict mode, and how to customize it.

Index

Constants

View Source
const (
	// SpinUp is the control that prevents the deprecated `spin-up` command from being used.
	SpinUp = "spin-up"
	// TearDown is the control that prevents the deprecated `tear-down` command from being used.
	TearDown = "tear-down"
	// PlanAll is the control that prevents the deprecated `plan-all` command from being used.
	PlanAll = "plan-all"
	// ApplyAll is the control that prevents the deprecated `apply-all` command from being used.
	ApplyAll = "apply-all"
	// DestroyAll is the control that prevents the deprecated `destroy-all` command from being used.
	DestroyAll = "destroy-all"
	// OutputAll is the control that prevents the deprecated `output-all` command from being used.
	OutputAll = "output-all"
	// ValidateAll is the control that prevents the deprecated `validate-all` command from being used.
	ValidateAll = "validate-all"
	// SkipDependenciesInputs is the control that prevents reading dependencies inputs and get performance boost.
	SkipDependenciesInputs = "skip-dependencies-inputs"
	// DisableLogFormattingName is the control that prevents the deprecated `--terragrunt-disable-log-formatting` flag from being used.
	DisableLogFormatting = "terragrunt-disable-log-formatting"
	// JSONLog is the control that prevents the deprecated `--terragrunt-json-log` flag from being used.
	JSONLog = "terragrunt-json-log"
)

Variables

View Source
var (
	// ErrInvalidStrictControl is returned when an invalid strict control is used.
	ErrInvalidStrictControl = errors.New("Invalid value(s) used for --strict-control.") //nolint:stylecheck,revive
)
View Source
var StrictControls = Controls{
	SpinUp: {
		Error:   errors.Errorf("The `%s` command is no longer supported. Use `terragrunt run-all apply` instead.", SpinUp),
		Warning: fmt.Sprintf("The `%s` command is deprecated and will be removed in a future version. Use `terragrunt run-all apply` instead.", SpinUp),
	},
	TearDown: {
		Error:   errors.Errorf("The `%s` command is no longer supported. Use `terragrunt run-all destroy` instead.", TearDown),
		Warning: fmt.Sprintf("The `%s` command is deprecated and will be removed in a future version. Use `terragrunt run-all destroy` instead.", TearDown),
	},
	PlanAll: {
		Error:   errors.Errorf("The `%s` command is no longer supported. Use `terragrunt run-all plan` instead.", PlanAll),
		Warning: fmt.Sprintf("The `%s` command is deprecated and will be removed in a future version. Use `terragrunt run-all plan` instead.", PlanAll),
	},
	ApplyAll: {
		Error:   errors.Errorf("The `%s` command is no longer supported. Use `terragrunt run-all apply` instead.", ApplyAll),
		Warning: fmt.Sprintf("The `%s` command is deprecated and will be removed in a future version. Use `terragrunt run-all apply` instead.", ApplyAll),
	},
	DestroyAll: {
		Error:   errors.Errorf("The `%s` command is no longer supported. Use `terragrunt run-all destroy` instead.", DestroyAll),
		Warning: fmt.Sprintf("The `%s` command is deprecated and will be removed in a future version. Use `terragrunt run-all destroy` instead.", DestroyAll),
	},
	OutputAll: {
		Error:   errors.Errorf("The `%s` command is no longer supported. Use `terragrunt run-all output` instead.", OutputAll),
		Warning: fmt.Sprintf("The `%s` command is deprecated and will be removed in a future version. Use `terragrunt run-all output` instead.", OutputAll),
	},
	ValidateAll: {
		Error:   errors.Errorf("The `%s` command is no longer supported. Use `terragrunt run-all validate` instead.", ValidateAll),
		Warning: fmt.Sprintf("The `%s` command is deprecated and will be removed in a future version. Use `terragrunt run-all validate` instead.", ValidateAll),
	},
	SkipDependenciesInputs: {
		Error:   errors.Errorf("The `%s` option is deprecated. Reading inputs from dependencies has been deprecated and will be removed in a future version of Terragrunt. To continue using inputs from dependencies, forward them as outputs.", SkipDependenciesInputs),
		Warning: fmt.Sprintf("The `%s` option is deprecated and will be removed in a future version of Terragrunt. Reading inputs from dependencies has been deprecated. To continue using inputs from dependencies, forward them as outputs.", SkipDependenciesInputs),
	},
	DisableLogFormatting: {
		Error:   errors.Errorf("The `--%s` flag is no longer supported. Use `--terragrunt-log-format=key-value` instead.", DisableLogFormatting),
		Warning: fmt.Sprintf("The `--%s` flag is deprecated and will be removed in a future version. Use `--terragrunt-log-format=key-value` instead.", DisableLogFormatting),
	},
	JSONLog: {
		Error:   errors.Errorf("The `--%s` flag is no longer supported. Use `--terragrunt-log-format=json` instead.", JSONLog),
		Warning: fmt.Sprintf("The `--%s` flag is deprecated and will be removed in a future version. Use `--terragrunt-log-format=json` instead.", JSONLog),
	},
}

Functions

This section is empty.

Types

type Control

type Control struct {
	// Error is the error that will be returned when the control is enabled.
	Error error
	// Warning is a warning that will be logged when the control is not enabled.
	Warning string
}

Control represents a control that can be enabled or disabled in strict mode. When the control is enabled, Terragrunt will behave in a way that is not backwards compatible.

func GetStrictControl

func GetStrictControl(name string) (Control, bool)

GetStrictControl returns the strict control with the given name.

func (Control) Evaluate

func (control Control) Evaluate(opts *options.TerragruntOptions) (string, error)

Evaluate returns a warning if the control is not enabled, and an error if the control is enabled.

type Controls

type Controls map[string]Control

func (Controls) Names added in v0.68.5

func (controls Controls) Names() []string

Names returns the names of all strict controls.

func (Controls) ValidateControlNames

func (controls Controls) ValidateControlNames(strictControlNames []string) error

ValidateControlNames validates that the given control names are valid.

Jump to

Keyboard shortcuts

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