Skip to content
👷 The Terragrunt website redesign is Work In Progress! 👷
For a list of outstanding TODOs see this.
To give feedback, click here.

bootstrap

Usage

Bootstrap OpenTofu/Terraform backend infrastructure.

Examples

Provision backend resources defined in remote_state.

Terminal window
terragrunt backend bootstrap

Provision remote_state

Using 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:

terragrunt.hcl
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:

Terminal window
terragrunt backend bootstrap

You’ll ensure the availability of:

  • An S3 bucket named mybucket in the us-east-1 region with the following enabled:
    • Server Side Encryption (SSE)
    • Versioning
    • TLS Enforcement
  • A DynamoDB table named tf-lock in the us-east-1 region with SSE.
  • An S3 bucket named mybucket-logs configured as the access log destination for the mybucket bucket.

The bootstrap command is idempotent. If the resources already exist, bootstrap will not provision them again.

Flags

--all

When this flag is set, Terragrunt will bootstrap all units discovered in the current working directory.

Type: bool

Environment Variables:

  • TG_ALL

--config

Path to the Terragrunt configuration file to use when bootstrapping the resources.

Type: string

Environment Variables:

  • TG_CONFIG

--download-dir

Path to download OpenTofu/Terraform modules into. The default is `.terragrunt-cache`.

Type: string

Environment Variables:

  • TG_DOWNLOAD_DIR