When this flag is set, Terragrunt will bootstrap all units discovered in the current working directory.
Environment Variables:
TG_ALL
Bootstrap OpenTofu/Terraform backend infrastructure.
Provision backend resources defined in remote_state.
terragrunt backend bootstrapUsing this command bootstraps the resources described in your remote_state block.
If any of the resources described in the remote_state block need provisioning, bootstrap will provision them. If they are present, but configured in a way that differs from remote_state configuration, Terragrunt will attempt to update them when it is safe to do so.
For example, if you have the following remote_state block:
remote_state { backend = "s3" config = { bucket = "mybucket" key = "path/to/my/key" region = "us-east-1" encrypt = true
dynamodb_table = "tf-lock"
accesslogging_bucket_name = "mybucket-logs" }}Then run the following:
terragrunt backend bootstrapYou’ll ensure the availability of:
mybucket in the us-east-1 region with the following enabled:
tf-lock in the us-east-1 region with SSE.mybucket-logs configured as the access log destination for the mybucket bucket.remote_state { backend = "azurerm" config = { resource_group_name = "my-tofu-state" storage_account_name = "mytofustate" container_name = "tfstate" key = "path/to/my/key"
location = "eastus" use_azuread_auth = true assign_blob_data_role = true }}Then run the following:
terragrunt backend bootstrapYou’ll ensure the availability of:
my-tofu-state, created in eastus when missing.mytofustate in that resource group with blob versioning enabled.tfstate in that storage account.Azure may take several minutes to apply a new role assignment. If Terragrunt just assigned the role and the first run fails with a 403 while checking the container, wait and run terragrunt backend bootstrap again.
remote_state { backend = "gcs" config = { project = "my-project" location = "us-central1" bucket = "my-tofu-state" prefix = "path/to/my/prefix"
enable_bucket_policy_only = true
gcs_bucket_labels = { owner = "platform-team" } }}Then run the following:
terragrunt backend bootstrapYou’ll ensure the availability of:
my-tofu-state in the my-project project and the us-central1 location with the following enabled:
owner = "platform-team" label on that bucket.Terragrunt uses project, location, and the settings above only when it creates the bucket. It leaves an existing bucket as it is, and logs a warning if versioning is off there.
The bootstrap command is idempotent. If the resources already exist, bootstrap will not provision them again.
When this flag is set, Terragrunt will bootstrap all units discovered in the current working directory.
Environment Variables:
TG_ALLPath to the Terragrunt configuration file to use when bootstrapping the resources.
Environment Variables:
TG_CONFIGPath to download OpenTofu/Terraform modules into. The default is `.terragrunt-cache`.
Environment Variables:
TG_DOWNLOAD_DIR