Skip to content

Does Terragrunt create my state backend automatically?

Yes, if you ask it to. Terragrunt can provision the resources named in your remote_state block, such as an S3 bucket, a DynamoDB table, or a GCS bucket, so you do not have to create them by hand before your first run.

This is opt-in. --backend-bootstrap defaults to false, so an ordinary terragrunt plan or terragrunt apply never creates cloud resources as a side effect of running.

Opting in

Pass the flag on a run:

Terminal window
terragrunt apply --backend-bootstrap

Set the environment variable, which is usually what you want in CI:

Terminal window
export TG_BACKEND_BOOTSTRAP=true

Or bootstrap as a separate step, which keeps provisioning out of your normal apply path:

Terminal window
terragrunt backend bootstrap

The backend bootstrap command and the --backend-bootstrap flag do the same work. See State Backend for what gets created for each backend.

If it still does not run

remote_state.disable_init blocks bootstrapping even when you have opted in. If you set it, Terragrunt skips creating backend resources regardless of the flag, while still letting OpenTofu/Terraform initialize a backend that already exists. That combination is useful for run --all validate in CI, where you want no resources created at all.

Bootstrapping the Azure backend requires the azure-backend experiment.


← Back to all frequently asked questions