resolving dependency outputs: NoSuchBucket: The specified bucket does not exist
Fixes Terragrunt's dependency-output fetch failing with NoSuchBucket when the state bucket doesn't exist yet. Use when validate or plan with --dependency-fetch-output-from-state fails resolving a dependency instead of using mock_outputs. Not for missing state keys (NoSuchKey), which do fall back to mocks.
TL;DR: mock_outputs only rescues you when the state OBJECT is missing (NoSuchKey). When the whole state BUCKET doesn't exist yet (NoSuchBucket), Terragrunt fails instead of using the mock. Bootstrap the bucket first (or drop the fetch-from-state flag for that run).
resolving dependency "network" outputs: fetching dependency state from s3://my-not-yet-created-bucket/network/terraform.tfstate: operation error S3: GetObject,
... NoSuchBucket: The specified bucket does not existSteps
Read the error:
NoSuchBucketmeans the bucket is missing, not just the key. Expected: you know bootstrapping is the gap.Bootstrap the backend:
terragrunt backend bootstrap(or create the bucket out of band). Expected: the bucket exists.Re-run your original command. Expected: dependency outputs resolve, or
mock_outputskick in for genuinely unapplied units.
When this applies
validate/planwith--dependency-fetch-output-from-state(now the default read path in recent 1.x) fails withNoSuchBucketon a dependency.- The environment was never bootstrapped.
When it doesn't apply
NoSuchKey(bucket exists, key missing): mocks DO apply there; if they don't, the mock block itself is misconfigured.- AccessDenied on the bucket: that's permissions, not bootstrapping.
Tool versions
Terragrunt 1.x with dependency outputs read from state (default since the experiment graduated).
Why it happens
The mock fallback was implemented for the "not applied yet" signal, which the code recognized as a missing key. A missing bucket is a different S3 error code, so it falls through to a hard failure instead of the mock path. From the dependent unit's perspective both mean the same thing, but the code doesn't treat them the same.
Edge cases
- Bootstrapping creates the bucket with Terragrunt's expected config (versioning etc.); hand-creating it works but skips that reconciliation.
- In CI for a brand-new environment, run
backend bootstrapas an explicit first step rather than relying on per-run flags.