Terragrunt "NoSuchBucket" remote state error in CI
The S3 backend Terragrunt generated points at a bucket that does not exist, is in another region, or is invisible to the runner credentials. Terraform returns "NoSuchBucket" when it tries to read or write state.
What this error means
terragrunt init or apply fails with "Error: Failed to get existing workspaces: ... NoSuchBucket: The specified bucket does not exist", naming your state bucket.
Error: Failed to get existing workspaces: operation error S3: ListObjectsV2,
https response error StatusCode: 404, ... NoSuchBucket: The specified bucket does not exist
status code: 404, bucket: acme-tfstateCommon causes
The state bucket does not exist yet
The bucket in remote_state.config.bucket was never created, or Terragrunt auto-bootstrapping is disabled so it will not create it.
Wrong region or credentials without access
The bucket exists in another region, or the CI IAM role cannot see it, so S3 responds as if it does not exist.
How to fix it
Create or bootstrap the state bucket
Let Terragrunt create the bucket on first init, or provision it out of band before CI runs.
# Terragrunt can create the S3 bucket and lock table on first init
terragrunt init --terragrunt-non-interactiveFix region and credentials
- Confirm the bucket name and its region match remote_state.config.
- Ensure the CI role can list and read/write the bucket.
- Re-run init once access is correct.
env:
AWS_REGION: us-east-1
AWS_ROLE_ARN: ${{ secrets.TF_STATE_ROLE }}How to prevent it
- Provision the state bucket and lock table before pipelines run.
- Keep the backend region consistent with the bucket region.
- Grant the CI role least-privilege access to the state bucket.