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 ¶
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" // TfLogJSON is the control that prevents the deprecated `--terragrunt-tf-logs-to-json` flag from being used. TfLogJSON = "terragrunt-tf-logs-to-json" // RootTerragruntHCL is the control that prevents usage of a `terragrunt.hcl` file as the root of Terragrunt configurations. RootTerragruntHCL = "root-terragrunt-hcl" )
const ( // StatusOngoing is the status of a control that is ongoing. StatusOngoing = iota // StatusCompleted is the status of a control that is completed. StatusCompleted )
Variables ¶
var ( // ErrInvalidStrictControl is returned when an invalid strict control is used. ErrInvalidStrictControl = errors.New("Invalid value(s) used for --strict-control.") //nolint:stylecheck,revive )
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), }, TfLogJSON: { Error: errors.Errorf("The `--%s` flag is no longer supported. Use `--terragrunt-log-format=json` instead.", TfLogJSON), Warning: fmt.Sprintf("The `--%s` flag is deprecated and will be removed in a future version. Use `--terragrunt-log-format=json` instead.", TfLogJSON), }, RootTerragruntHCL: { Error: errors.Errorf("Using `terragrunt.hcl` as the root of Terragrunt configurations is an anti-pattern, and no longer supported. Use a differently named file like `root.hcl` instead. For more information, see https://terragrunt.gruntwork.io/docs/migrate/migrating-from-root-terragrunt-hcl"), Warning: "Using `terragrunt.hcl` as the root of Terragrunt configurations is an anti-pattern, and no longer recommended. In a future version of Terragrunt, this will result in an error. You are advised to use a differently named file like `root.hcl` instead. For more information, see https://terragrunt.gruntwork.io/docs/migrate/migrating-from-root-terragrunt-hcl", }, }
var TriggeredControls = xsync.NewMapOf[*Control, bool]()
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 // Status of the strict control. Status int }
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 ¶
GetStrictControl returns the strict control with the given name.