Skip to content

fix(ci): drift fails on an attribute Terraform cannot set - #475

Merged
athvin merged 1 commit into
mainfrom
bm/ci-drift-readonly-attrs
Nov 5, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/ci-drift-readonly-attrs

Conversation

@athvin

@athvin athvin commented Nov 5, 2026

Copy link
Copy Markdown
Owner

drift (dev) reports real drift on module.eks.aws_eks_cluster.this [platform_version]:

~ platform_version = "eks.14" -> "eks.17"

AWS moved it when it patched the control plane. We set it nowhere — grep platform_version infra/terraform/ finds nothing — so there is no configuration for it to drift from. Left alone it fails the daily schedule after every AWS patch, forever, which is the fastest way to teach everyone to ignore a red drift job.

A third rule, not a third entry

IGNORE_ON_TYPE is the sibling-resource rule specifically: an attribute a sibling resource owns, and whose drift that sibling reports itself. Stretching it to cover this would make it mean "whatever we are tired of seeing" — and #370's lesson was that the ignore list needs a rule, not a longer list of sightings.

So IGNORE_READONLY states what qualifies: the attribute appears only in the provider's Attribute Reference, never its Argument Reference, and grep finds it nowhere in infra/terraform/. Both were checked for this entry rather than assumed.

Two fixtures, because the second is what keeps it honest

tf-helpers-test.sh's own header warns that an over-broad entry "silently retires drift detection while leaving the workflow green". So:

fixture expected
a read-only attribute alone not drift (exit 0)
a settable attribute beside it, same type is drift (exit 1), named as [version]

The second is the boundary. Without it, "ignore platform_version on aws_eks_cluster" could be widened to the whole type and nobody would notice EKS drift detection had been switched off.

Observed failing before being trusted

Removing the rule fails both new assertions — and the boundary case keeps passing, which is the direction that proves it asserts an absence rather than nothing:

FAIL  a read-only attribute is NOT drift
PASS  a settable attribute beside it IS drift
FAIL  names only the settable attribute as drift

With the rule: 45 passed, 0 failed.

🤖 Generated with Claude Code

`drift (dev)` reports real drift on
`module.eks.aws_eks_cluster.this [platform_version]`, which AWS moved from
`eks.14` to `eks.17` when it patched the control plane. We set it nowhere —
`grep platform_version infra/terraform/` finds nothing — so there is no
configuration for it to drift FROM. Left alone it fails the daily schedule
after every AWS patch, forever, which is the fastest way to teach everyone to
ignore a red drift job.

A THIRD rule rather than a third entry in `IGNORE_ON_TYPE`. That list is the
sibling-resource rule specifically — an attribute a sibling resource owns, and
whose drift the sibling reports itself — and stretching it to cover this would
make it mean "whatever we are tired of seeing". #370's lesson was that the
ignore list needs a rule, not a longer list of sightings, and it applies here.

`IGNORE_READONLY` states what qualifies: the attribute appears only in the
provider's Attribute Reference, never its Argument Reference, and `grep` finds
it nowhere in infra/terraform/. Both checked for this entry rather than
assumed.

Two fixtures, because the test file's own warning is that an over-broad entry
silently retires drift detection while leaving the workflow green:

  - a read-only attribute alone is NOT drift (exit 0), and
  - a SETTABLE attribute beside it on the SAME type IS drift (exit 1), named as
    `[version]` and not swallowed with its read-only neighbour.

The second is the one that keeps the rule honest: without it, "ignore
platform_version on aws_eks_cluster" could be widened to the whole type and
nobody would notice EKS drift detection had been switched off.

Observed failing before being trusted: removing the rule fails both new
assertions, and the boundary case keeps passing — which is the direction that
proves it is asserting an absence rather than nothing.

45 passed, 0 failed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

terraform plan

b1a5214 · run log and full plans

env add change destroy
state-backend (plan only) 0 0 0
core 0 0 0
dev 0 0 0
prod 0 0 0

Planned with -refresh=false, so this is the config-versus-state diff and
not out-of-band drift. That is a security choice, not a speed one: a refreshing
plan reads secret values, and the plan role is assumable from any PR branch —
which can edit the workflow it runs under. Drift is caught at apply time, which
refreshes fully.

@athvin
athvin merged commit 07b48b3 into main Nov 5, 2026
33 checks passed
@athvin
athvin deleted the bm/ci-drift-readonly-attrs branch November 5, 2026 01:11
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