Skip to content

Commit 8703c3b

Browse files
denis256yhakbarZachGoldbergkarlcarstensencoderabbitai[bot]
authored
chore: disable of default backend provisioning (#4703)
* Backend bootstrap only by explicit flag * Cleanup * lint issues * Updated error explainer error * Documentation update * Improved errors detection * GCP bootstrap flags * Tests update * Bootstrap flags update * Updated --backend-bootstrap to OIDC * GCP cleanup * Backend update * GCP tests cleanup * AWS tests update * AWS docs update * Docs bootstrap fix * Tests simplification * docs: Add Terralith to Terragrunt guide (#4709) * feat: Adding fixture for Terralith to Terragrunt guide * feat: Adding Terralith to Terragrunt walkthrough * fix: Use Asides where possible * fix: Moving import up to avoid breaking list formatting * fi:x Removing incorrect tip * fix: Fixing asset links * fix: The `gitignore` syntax highlight doesn't exist * fix: Moving fixtures to the `docs-starlight` directory * fix: Adjusting path * fix: Removing `package-lock.json` entry in `.vercelignore` * Revert "fix: Adjusting path" This reverts commit 62e6d2d. * fix: Removing duplicate fixtures * Update docs-starlight/src/content/docs/02-guides/01-terralith-to-terragrunt/05-step-2-refactoring.mdx Co-authored-by: Zach Goldberg <zach@gruntwork.io> * fix: Fixing link for fixture code --------- Co-authored-by: Zach Goldberg <zach@gruntwork.io> * Updated form link (#4771) * Polish to contact form (#4769) * Pricing Page Launch (#4772) * New supercharge module * Updates to links etc * Update copy * Update docs-starlight/src/components/dv-PetAdvertise.astro Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update docs-starlight/src/components/dv-PetAdvertise.astro Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update docs-starlight/src/components/dv-PetAdvertise.astro Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Polish (#4773) * fix: ensure custom API endpoints are set correctly (#4756) * fix: ensure custom API endpoints are set correctly * refactor: ensure consistent use of awshelper.CreateS3Client * chore: fix runner-pool experiment tests (#4770) * Group tests update * Added checking for group tests * chore: lint fixes * runner-pool handling of TestOutputModuleGroups * Bypass partytown (#4783) * Bypass partytown * GTM in header * fix: Only override ref when not set (#4781) * A collection of website polishing (#4784) * Tighten up sidebar. * Standardize CSS ordering between dev and prod. Previously, the site would render one way in prod and another in dev! The issue was that vite was tree-shaking CSS and wound up re-ordering things in a way it thought was permissible, whereas in dev, without that optimization, the CSS was actuallys sequenced differently. This led to a noticable huge margin in dev, but not in prod. This commit asserts the official ordering the CSS layers, and then adds a fix for the left-margin issue. This should now standard dev and prod. * Reduce code font-size from 16px to 14px. * Improve main paragraph text rendering. Use more readable line height and paragraph separation. * Improve spacing after file tree. * Fix sidebar inconsistencies on 3rd level of nav. * feat: Generate stacks in topological order (#4786) * feat: Finalizing topological generation of stacks * feat: Adding tests for topological stack generation * fix: Address race condition in warning suppression * feat: Set name of test to `TestStackGenerationWithNestedTopologyWithRacing` to ensure it's caught by race test * feat: Adding extra generate at the end for confirmation * fix: Updating expected log messages in tests * fix: Fixing AWS Account ID w/ Provider CMD (#4779) * test: Attempting to reproduce issue with OIDC * fix: Fixing `get_aws_account_id()` when using AuthProviderCmd * fix: Addressing lint findings * fix: Adding fixture for backend with OIDC * fix: Adding integration test for OIDC with backend * fix: Consolidating logic for AWS credential acquisition * fix: Addressing lint findings * test: Removing cleanup to fix this * fix: Fixing delete bucket cleanup * fix: Fixing role assumption when env creds aren't fetched from auth provider * fix: Removing unnecessary debug * fix: Skipping failing test for now * Fixed failing OIDC tests * Tests cleanup * chore: aws helper complexity reduction * Updated cleanup order * enabled build tags --------- Co-authored-by: Denis O <denis.o@linux.com> * chore: experiments tests improvements (#4782) * Group tests update * Added checking for group tests * chore: lint fixes * runner-pool handling of TestOutputModuleGroups * Updated plan path save file * Improved FAIL errors * IsExperimentMode() simplification * Discovery include flags * Added passing of discovery include/exclude directories * Fixed discovery flags passing * Improved parsing of tests * docs: Updating migration docs (#4711) * Added --non-interactive * Market strict control as completed * fix: Fixing failing OIDC test (#4791) --------- Co-authored-by: Yousif Akbar <11247449+yhakbar@users.noreply.github.com> Co-authored-by: Zach Goldberg <zach@gruntwork.io> Co-authored-by: Karl Carstensen <karl.carstensen@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: AJ (.jASM) <aj@48k.io> Co-authored-by: Rodin Velichkov <148242776+rvelichkov@users.noreply.github.com> Co-authored-by: Josh Padnick <josh@gruntwork.io>
1 parent 4b27a33 commit 8703c3b

16 files changed

+148
-201
lines changed

cli/commands/run/run.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
"github.com/gruntwork-io/terragrunt/internal/experiment"
3636
"github.com/gruntwork-io/terragrunt/internal/remotestate"
3737
"github.com/gruntwork-io/terragrunt/internal/report"
38-
"github.com/gruntwork-io/terragrunt/internal/strict/controls"
3938
"github.com/gruntwork-io/terragrunt/options"
4039
"github.com/gruntwork-io/terragrunt/shell"
4140
"github.com/gruntwork-io/terragrunt/util"
@@ -793,9 +792,17 @@ func modulesNeedInit(terragruntOptions *options.TerragruntOptions) (bool, error)
793792
return util.Grep(ModuleRegex, fmt.Sprintf("%s/%s", terragruntOptions.WorkingDir, TerraformExtensionGlob))
794793
}
795794

796-
// If the user entered a Terraform command that uses state (e.g. plan, apply), make sure remote state is configured
797-
// before running the command.
795+
// remoteStateNeedsInit determines whether remote state initialization is required before running a Terraform command.
796+
// It returns true if:
797+
// - BackendBootstrap is enabled in options
798+
// - Remote state configuration is provided
799+
// - The Terraform command uses state (e.g., plan, apply, destroy, output, etc.)
800+
// - The remote state backend needs bootstrapping
798801
func remoteStateNeedsInit(ctx context.Context, l log.Logger, remoteState *remotestate.RemoteState, opts *options.TerragruntOptions) (bool, error) {
802+
// If backend bootstrap is disabled, we don't need to initialize remote state
803+
if !opts.BackendBootstrap {
804+
return false, nil
805+
}
799806
// We only configure remote state for the commands that use the tfstate files. We do not configure it for
800807
// commands such as "get" or "version".
801808
if remoteState == nil || !util.ListContainsElement(TerraformCommandsThatUseState, opts.TerraformCliArgs.First()) {
@@ -806,15 +813,6 @@ func remoteStateNeedsInit(ctx context.Context, l log.Logger, remoteState *remote
806813
return false, err
807814
}
808815

809-
if !opts.BackendBootstrap {
810-
ctx = log.ContextWithLogger(ctx, l)
811-
812-
strictControl := opts.StrictControls.Find(controls.RequireExplicitBootstrap)
813-
if err := strictControl.Evaluate(ctx); err != nil {
814-
return false, nil //nolint: nilerr
815-
}
816-
}
817-
818816
return true, nil
819817
}
820818

docs-starlight/src/content/docs/01-getting-started/04-terminology.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Terragrunt stores the current state of infrastructure in one or more OpenTofu/Te
9292

9393
State is an extremely important concept in the context of OpenTofu/Terraform, and it's helpful to read the relevant documentation there to understand what Terragrunt does to it.
9494

95-
Terragrunt has myriad capabilities that are designed to make working with state easier, including automatically provisioning state backend resources, managing unit interaction with external state, and segmenting state.
95+
Terragrunt has myriad capabilities that are designed to make working with state easier, including tooling to bootstrap state backend resources on demand, managing unit interaction with external state, and segmenting state.
9696

9797
The most common way in which state is segmented in Terragrunt projects is to take advantage of filesystem directory structures. Most Terragrunt projects are configured to store state in remote backends like S3 with keys that correspond to the relative path to the unit directory within a project, relative to the root `terragrunt.hcl` file.
9898

docs-starlight/src/content/docs/04-reference/03-strict-controls.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ Skipping dependency inputs is a performance optimization. For more details on pe
114114

115115
**Reason**: Enabling the `skip-dependencies-inputs` option prevents the recursive parsing of Terragrunt inputs, leading to optimized performance during dependency resolution.
116116

117-
### require-explicit-bootstrap
118-
119-
Require explicit usage of `--backend-bootstrap` to automatically bootstrap backend resources.
120-
121117
### root-terragrunt-hcl
122118

123119
Throw an error when users try to reference a root `terragrunt.hcl` file using `find_in_parent_folders`.
@@ -251,6 +247,14 @@ The following strict controls have been completed and are no longer needed:
251247
- [output-all](#output-all)
252248
- [validate-all](#validate-all)
253249

250+
### require-explicit-bootstrap
251+
252+
**Status**: Completed - Backend provisioning is no longer performed automatically by default.
253+
254+
Terragrunt now requires explicit opt-in to bootstrap backend infrastructure. Use `terragrunt backend bootstrap` or pass `--backend-bootstrap` to a `run` command (e.g., `terragrunt run apply --backend-bootstrap`) to provision or update backend resources referenced by the [`remote_state`](/docs/reference/hcl/blocks/#remote_state) block.
255+
256+
This strict control is no longer necessary because the default behavior already requires explicit bootstrapping.
257+
254258
### legacy-all
255259

256260
**Status**: Completed - The legacy `*-all` commands have been removed from Terragrunt.

docs-starlight/src/content/docs/07-migrate/03-cli-redesign.md

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -65,63 +65,64 @@ You can find the new flag names in the [CLI reference](/docs/reference/cli/) (in
6565

6666
Below is a comprehensive mapping of old CLI flag names to their modern counterparts:
6767

68-
| Old Flag | New Flag |
69-
| ------------------------------------------------- | -------------------------------------- |
70-
| `--terragrunt-check` | `--check` |
71-
| `--terragrunt-config` | `--config` |
72-
| `--terragrunt-debug` | `--inputs-debug` |
73-
| `--terragrunt-diff` | `--diff` |
74-
| `--terragrunt-disable-bucket-update` | `--disable-bucket-update` |
75-
| `--terragrunt-disable-command-validation` | `--disable-command-validation` |
76-
| `--terragrunt-download-dir` | `--download-dir` |
77-
| `--terragrunt-exclude-dir` | `--queue-exclude-dir` |
78-
| `--terragrunt-excludes-file` | `--queue-excludes-file` |
79-
| `--terragrunt-fail-on-state-bucket-creation` | `--backend-require-bootstrap` |
80-
| `--terragrunt-fetch-dependency-output-from-state` | `--dependency-fetch-output-from-state` |
81-
| `--terragrunt-forward-tf-stdout` | `--tf-forward-stdout` |
82-
| `--terragrunt-hclfmt-exclude-dir` | `--exclude-dir` |
83-
| `--terragrunt-hclfmt-file` | `--file` |
84-
| `--terragrunt-hclfmt-stdin` | `--stdin` |
85-
| `--terragrunt-hclvalidate-json` | `--json` |
86-
| `--terragrunt-hclvalidate-show-config-path` | `--show-config-path` |
87-
| `--terragrunt-iam-assume-role-duration` | `--iam-assume-role-duration` |
88-
| `--terragrunt-iam-role` | `--iam-assume-role` |
89-
| `--terragrunt-iam-web-identity-token` | `--iam-assume-role-web-identity-token` |
90-
| `--terragrunt-ignore-dependency-errors` | `--queue-ignore-errors` |
91-
| `--terragrunt-ignore-dependency-order` | `--queue-ignore-dag-order` |
92-
| `--terragrunt-ignore-external-dependencies` | `--queue-exclude-external` |
93-
| `--terragrunt-include-dir` | `--queue-include-dir` |
94-
| `--terragrunt-include-external-dependencies` | `--queue-include-external` |
95-
| `--terragrunt-json-disable-dependent-modules` | `--disable-dependent-modules` |
96-
| `--terragrunt-json-out-dir` | `--json-out-dir` |
97-
| `--terragrunt-json-out` | `--out` |
98-
| `--terragrunt-log-custom-format` | `--log-custom-format` |
99-
| `--terragrunt-log-disable` | `--log-disable` |
100-
| `--terragrunt-log-format` | `--log-format` |
101-
| `--terragrunt-log-level` | `--log-level` |
102-
| `--terragrunt-log-show-abs-paths` | `--log-show-abs-paths` |
103-
| `--terragrunt-modules-that-include` | `--units-that-include` |
104-
| `--terragrunt-no-auto-approve` | `--no-auto-approve` |
105-
| `--terragrunt-no-auto-init` | `--no-auto-init` |
106-
| `--terragrunt-no-auto-retry` | `--no-auto-retry` |
107-
| `--terragrunt-no-color` | `--no-color` |
108-
| `--terragrunt-no-destroy-dependencies-check` | `--no-destroy-dependencies-check` |
109-
| `--terragrunt-out-dir` | `--out-dir` |
110-
| `--terragrunt-parallelism` | `--parallelism` |
111-
| `--terragrunt-provider-cache-dir` | `--provider-cache-dir` |
112-
| `--terragrunt-provider-cache-hostname` | `--provider-cache-hostname` |
113-
| `--terragrunt-provider-cache-port` | `--provider-cache-port` |
114-
| `--terragrunt-provider-cache-registry-names` | `--provider-cache-registry-names` |
115-
| `--terragrunt-provider-cache-token` | `--provider-cache-token` |
116-
| `--terragrunt-provider-cache` | `--provider-cache` |
117-
| `--terragrunt-queue-include-units-reading` | `--queue-include-units-reading` |
118-
| `--terragrunt-source-map` | `--source-map` |
119-
| `--terragrunt-source-update` | `--source-update` |
120-
| `--terragrunt-source` | `--source` |
121-
| `--terragrunt-strict-include` | `--queue-strict-include` |
122-
| `--terragrunt-strict-validate` | `--strict-validate` |
123-
| `--terragrunt-use-partial-parse-config-cache` | `--use-partial-parse-config-cache` |
124-
| `--terragrunt-working-dir` | `--working-dir` |
68+
| Old Flag | New Flag |
69+
|---------------------------------------------------|-----------------------------------------------------------|
70+
| `--terragrunt-check` | `--check` |
71+
| `--terragrunt-config` | `--config` |
72+
| `--terragrunt-debug` | `--inputs-debug` |
73+
| `--terragrunt-diff` | `--diff` |
74+
| `--terragrunt-disable-bucket-update` | `--disable-bucket-update` |
75+
| `--terragrunt-disable-command-validation` | `--disable-command-validation` |
76+
| `--terragrunt-download-dir` | `--download-dir` |
77+
| `--terragrunt-exclude-dir` | `--queue-exclude-dir` |
78+
| `--terragrunt-excludes-file` | `--queue-excludes-file` |
79+
| `--terragrunt-fail-on-state-bucket-creation` | removed (no equivalent; backend provisioning is explicit) |
80+
| `--terragrunt-fetch-dependency-output-from-state` | `--dependency-fetch-output-from-state` |
81+
| `--terragrunt-forward-tf-stdout` | `--tf-forward-stdout` |
82+
| `--terragrunt-hclfmt-exclude-dir` | `--exclude-dir` |
83+
| `--terragrunt-hclfmt-file` | `--file` |
84+
| `--terragrunt-hclfmt-stdin` | `--stdin` |
85+
| `--terragrunt-hclvalidate-json` | `--json` |
86+
| `--terragrunt-hclvalidate-show-config-path` | `--show-config-path` |
87+
| `--terragrunt-iam-assume-role-duration` | `--iam-assume-role-duration` |
88+
| `--terragrunt-iam-role` | `--iam-assume-role` |
89+
| `--terragrunt-iam-web-identity-token` | `--iam-assume-role-web-identity-token` |
90+
| `--terragrunt-ignore-dependency-errors` | `--queue-ignore-errors` |
91+
| `--terragrunt-ignore-dependency-order` | `--queue-ignore-dag-order` |
92+
| `--terragrunt-ignore-external-dependencies` | `--queue-exclude-external` |
93+
| `--terragrunt-include-dir` | `--queue-include-dir` |
94+
| `--terragrunt-include-external-dependencies` | `--queue-include-external` |
95+
| `--terragrunt-json-disable-dependent-modules` | `--disable-dependent-modules` |
96+
| `--terragrunt-json-out-dir` | `--json-out-dir` |
97+
| `--terragrunt-json-out` | `--out` |
98+
| `--terragrunt-log-custom-format` | `--log-custom-format` |
99+
| `--terragrunt-log-disable` | `--log-disable` |
100+
| `--terragrunt-log-format` | `--log-format` |
101+
| `--terragrunt-log-level` | `--log-level` |
102+
| `--terragrunt-log-show-abs-paths` | `--log-show-abs-paths` |
103+
| `--terragrunt-modules-that-include` | `--units-that-include` |
104+
| `--terragrunt-no-auto-approve` | `--no-auto-approve` |
105+
| `--terragrunt-no-auto-init` | `--no-auto-init` |
106+
| `--terragrunt-no-auto-retry` | `--no-auto-retry` |
107+
| `--terragrunt-no-color` | `--no-color` |
108+
| `--terragrunt-no-destroy-dependencies-check` | `--no-destroy-dependencies-check` |
109+
| `--terragrunt-out-dir` | `--out-dir` |
110+
| `--terragrunt-parallelism` | `--parallelism` |
111+
| `--terragrunt-provider-cache-dir` | `--provider-cache-dir` |
112+
| `--terragrunt-provider-cache-hostname` | `--provider-cache-hostname` |
113+
| `--terragrunt-provider-cache-port` | `--provider-cache-port` |
114+
| `--terragrunt-provider-cache-registry-names` | `--provider-cache-registry-names` |
115+
| `--terragrunt-provider-cache-token` | `--provider-cache-token` |
116+
| `--terragrunt-provider-cache` | `--provider-cache` |
117+
| `--terragrunt-queue-include-units-reading` | `--queue-include-units-reading` |
118+
| `--terragrunt-source-map` | `--source-map` |
119+
| `--terragrunt-source-update` | `--source-update` |
120+
| `--terragrunt-source` | `--source` |
121+
| `--terragrunt-strict-include` | `--queue-strict-include` |
122+
| `--terragrunt-strict-validate` | `--strict-validate` |
123+
| `--terragrunt-use-partial-parse-config-cache` | `--use-partial-parse-config-cache` |
124+
| `--terragrunt-working-dir` | `--working-dir` |
125+
| `--terragrunt-non-interactive` | `--non-interactive` |
125126

126127
### Update environment variables
127128

docs-starlight/src/data/commands/run.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ examples:
2525
flags:
2626
- all
2727
- auth-provider-cmd
28-
- backend-require-bootstrap
2928
- config
3029
- dependency-fetch-output-from-state
3130
- disable-bucket-update

docs-starlight/src/data/flags/backend-require-bootstrap.mdx

Lines changed: 0 additions & 17 deletions
This file was deleted.

internal/strict/controls/controls.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func New() strict.Controls {
8080
Error: errors.Errorf("Bootstrap backend for remote state by default is no longer supported. Use `--backend-bootstrap` flag instead."),
8181
Warning: "Bootstrapping backend resources by default is deprecated functionality, and will not be the default behavior in a future version of Terragrunt. Use the explicit `--backend-bootstrap` flag to automatically provision backend resources before they're needed.",
8282
Category: stageCategory,
83+
Status: strict.CompletedStatus,
8384
}
8485

8586
controls := strict.Controls{

shell/error_explainer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ var terraformErrorsMatcher = map[string]string{
2727
"(?s).*NoCredentialProviders(?s).*": "Missing AWS credentials. Provide credentials to proceed.",
2828
"(?s).*client: no valid credential sources(?s).*": "Missing AWS credentials. Provide credentials to proceed.",
2929
"(?s).*exec: \"(tofu|terraform)\": executable file not found(?s).*": "The executables 'terraform' and 'tofu' are missing from your $PATH. Please add at least one of these to your $PATH.",
30+
"(?s).*bucket must have been previously created.*": "Remote state bucket not found, create it manually or rerun with --backend-bootstrap to provision automatically.",
31+
"(?s).*specified bucket does not exist.*": "Remote state bucket not found, create it manually or rerun with --backend-bootstrap to provision automatically.",
32+
"(?s).*S3 bucket does not exist.*": "Remote state bucket not found, create it manually or rerun with --backend-bootstrap to provision automatically.",
3033
}
3134

3235
// ExplainError will try to explain the error to the user, if we know how to do so.

0 commit comments

Comments
 (0)