Skip to content

Include AWS account ID in drift plan files#21

Merged
gsavage merged 1 commit into
mainfrom
drift-plan-aws-account-id
Jun 24, 2026
Merged

Include AWS account ID in drift plan files#21
gsavage merged 1 commit into
mainfrom
drift-plan-aws-account-id

Conversation

@gsavage

@gsavage gsavage commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What

Add the AWS account ID to the drift.plan.json file generated by the drift-detection workflows.

Why

We deploy one specific commit SHA to every environment via a matrix, so the drift plan files —
which only contained { sha, drift } — were byte-for-byte identical across environments and
therefore shared a fingerprint. Kosli treats same-fingerprint artifacts as the same artifact, so
Environment snapshots reported one arbitrarily-chosen drift file as deployed everywhere, producing
confusing messages in Slack and the Kosli UI.

Including the AWS account ID makes each environment's drift plan unique, so each gets a distinct
fingerprint. The account ID is already looked up when computing the state bucket name, so it is
reused via $GITHUB_ENV rather than adding another aws sts call.

Changes

  • apply.yml (reset-drift-detection) — export AWS_ACCOUNT_ID and add aws_account_id to the
    created drift plan.
  • detect-drift.yml (flag-drift) — same change, keeping both files' JSON shape consistent.

The new shape:

{ "sha": "<sha>", "drift": false, "aws_account_id": "<account-id>" }

Addresses kosli-dev/terraform-server#466

🤖 Generated with Claude Code

The apply and detect-drift workflows wrote a drift.plan.json containing
only the deployed SHA and a drift flag. Because we deploy the same SHA to
every environment via a matrix, the resulting files were byte-for-byte
identical across environments and therefore shared a fingerprint. Kosli
treats same-fingerprint artifacts as the same artifact, so Environment
snapshots reported a single arbitrarily-chosen drift file as deployed
everywhere, producing confusing Slack and UI messages.

Add the AWS account ID (already looked up when computing the state bucket
name) as an extra key so each environment's drift plan is unique and gets
a distinct fingerprint.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@gsavage gsavage merged commit e0c43ba into main Jun 24, 2026
1 check passed
@gsavage gsavage deleted the drift-plan-aws-account-id branch June 24, 2026 09:06
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.

2 participants