Back to Terragrunt

Bootstrap

docs/src/data/commands/backend/bootstrap.mdx

1.0.31.6 KB
Original Source

import { Aside } from '@astrojs/starlight/components';

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:

hcl
# 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:

bash
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.

<Aside type="tip" title="--backend-bootstrap">

The flag --backend-bootstrap is equivalent to explicitly running the bootstrap command.

Using it in conjunction with any run command will result in any required bootstrapping to be performed prior to initiating the run.

</Aside>