Skip to content

fix(terraform): default bedrock object lock to governance so teardown stays clean#37

Merged
stxkxs merged 1 commit into
mainfrom
bedrock-governance-default
Jun 9, 2026
Merged

fix(terraform): default bedrock object lock to governance so teardown stays clean#37
stxkxs merged 1 commit into
mainfrom
bedrock-governance-default

Conversation

@stxkxs

@stxkxs stxkxs commented Jun 9, 2026

Copy link
Copy Markdown
Member

Problem

The production bedrock substrate forced S3 Object Lock into COMPLIANCE mode with a 7-year retention on the invocation-log bucket. COMPLIANCE retention can't be shortened or bypassed by anyone — not even the account root — so tearing down a deploy leaves an invocation bucket that can't be emptied or deleted until 2033. Spinning validation clusters up and down slowly accumulates permanently undeletable buckets.

Fix

  • Production defaults to GOVERNANCE / 365-day retention. Logs stay immutable by default, but an admin (s3:BypassGovernanceRetention) can clear the lock, so environments tear down cleanly.
  • The invocations bucket sets force_destroy = (object_lock_mode != "COMPLIANCE") — GOVERNANCE buckets are removable on terragrunt destroy; COMPLIANCE buckets stay protected.
  • COMPLIANCE stays a one-line opt-in — set object_lock_mode = "COMPLIANCE" in an env config for a tenant that genuinely needs cryptographic immutability.

dev/staging already used GOVERNANCE/365, so this brings production in line and makes teardown clean across the board.

Scope

Existing COMPLIANCE-locked buckets from prior deploys are unaffected — they stay locked until retention expires. This changes only new applies. tofu fmt + tofu validate pass on the component.

… stays clean

The production bedrock substrate forced S3 Object Lock into COMPLIANCE mode with
a 7-year retention on the invocation-log bucket. COMPLIANCE retention cannot be
shortened or bypassed by anyone — including the account root — so every teardown
of a production deploy left an invocation bucket that cannot be emptied or
deleted until the retention expires. Iterating on validation clusters slowly
accumulated permanently undeletable buckets.

Root cause: live/production/bedrock/terragrunt.hcl set object_lock_mode =
COMPLIANCE (retention 2555 days), and the component's invocations bucket carried
no force_destroy, so even a GOVERNANCE bucket would block destroy on its locked
objects.

Fix:
- Production defaults to GOVERNANCE / 365-day retention. Logs stay immutable by
  default, but an admin with s3:BypassGovernanceRetention can clear the lock so
  the environment tears down cleanly.
- The invocations bucket sets force_destroy = (object_lock_mode != COMPLIANCE),
  so GOVERNANCE buckets are removable on terragrunt destroy while COMPLIANCE
  buckets stay protected from accidental destroy.
- COMPLIANCE remains a one-line opt-in: set object_lock_mode = "COMPLIANCE" in
  an env config for a tenant that needs cryptographic immutability.

Existing COMPLIANCE-locked buckets from prior deploys are unaffected — they stay
locked until their retention expires; this changes only new applies.
@stxkxs stxkxs merged commit d1e69d0 into main Jun 9, 2026
14 checks passed
@stxkxs stxkxs deleted the bedrock-governance-default branch June 9, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant