Skip to content

fix(infra): the drift ignore list needed a rule, not a longer list of sightings - #370

Merged
athvin merged 1 commit into
mainfrom
bm/infra-drift-siblings
Nov 1, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/infra-drift-siblings

Conversation

@athvin

@athvin athvin commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Second real drift run (41283281935) after #369.

dev and prod went green — the -detailed-exitcode false positives are gone, which was the main thing #369 fixed. state-backend and core still failed, and the classifier is why that was useful rather than opaque: it reported exactly which attributes it ignored and which it didn't.

stack verdict attributes
state-backend ignored aws_kms_key.state [tags]
state-backend real aws_s3_bucket.state [server_side_encryption_configuration, versioning]
core real aws_iam_role.ci_tf_drift [inline_policy]

All three are the same class #369 already ignored — an attribute the provider deprecated in favour of a separate resource and now computes from it. Run 1's truncated text output had hidden them behind the # … has changed headline.

So the list becomes a rule

Ignore an attribute on a type when a sibling resource owns it.

What makes that safe rather than merely convenient is that nothing hides: turn bucket versioning off in the console and aws_s3_bucket_versioning drifts. The deprecated aws_s3_bucket.versioning mirror saying so as well is duplicate noise, not the signal.

That rule is also the boundary, and it's why entries stay type-scoped:

  • policy is ignored on aws_s3_bucket and nowhere else — a real change to an aws_iam_role_policy document must stay loud.
  • managed_policy_arns moved out of the ignore-anywhere list for the same reason.

With the rule stated, the aws_s3_bucket family is listed in full rather than one sighting at a time — every one of those is owned by an aws_s3_bucket_* resource — so this shouldn't need a third round.

Verification

42 assertions. The two entries run 2 surfaced are mutation-checked: removing aws_s3_bucket:versioning and aws_iam_role:inline_policy turns the suite red on "deprecated sibling mirrors are NOT drift", and the file was restored byte-identical (cmp) with the suite re-confirmed green.

Also corrected the test file's own header, which still claimed three helpers and that §14.2's prod-scoped apply role was unbuilt — it has been since #363/#364. It now states the opposite risk the classifier carries: an over-broad ignore entry retires drift detection while leaving the workflow in the tree, which is why both directions are asserted.

Expected after merge: all four stacks green, with state-backend and core listing their mirrors under "ignored as provider artifacts". I'll dispatch and report.

One process note, since it cost a redo: I ran reset --hard over uncommitted work and lost these two edits. This repo's own memory says to check git status before any git operation here; I didn't.

🤖 Generated with Claude Code

… sightings

Second real drift run (41283281935) after #369. `dev` and `prod` went
GREEN — the `-detailed-exitcode` false positives are gone, which was the
main thing #369 fixed. `state-backend` and `core` still failed, and the
classifier is why that was useful rather than opaque: it reported exactly
which attributes it ignored and which it did not.

  state-backend  ignored  aws_kms_key.state [tags]
                 real     aws_s3_bucket.state
                          [server_side_encryption_configuration, versioning]
  core           real     aws_iam_role.ci_tf_drift [inline_policy]

All three are the SAME class as the ones #369 already ignored — an
attribute the provider deprecated in favour of a separate resource and now
computes from it. Run 1's truncated text output had simply hidden them
behind the `# ... has changed` headline.

So the list stops being a record of sightings and becomes a rule: ignore an
attribute on a type when a SIBLING RESOURCE owns it. What makes that safe
rather than convenient is that nothing hides — turn bucket versioning off
in the console and `aws_s3_bucket_versioning` drifts; the deprecated
`aws_s3_bucket.versioning` mirror saying so too is duplicate noise, not the
signal.

That rule is also the boundary, and it is the reason the entries stay
type-scoped. `policy` is ignored on `aws_s3_bucket` and nowhere else,
because a real change to an `aws_iam_role_policy` document must stay loud.
`managed_policy_arns` moved out of the ignore-anywhere list for the same
reason.

With the rule stated, the `aws_s3_bucket` family is listed in full rather
than one sighting at a time — every one of those is owned by an
`aws_s3_bucket_*` resource — so this does not need a third round.

42 assertions now, and the two entries run 2 surfaced are mutation-checked:
removing `aws_s3_bucket:versioning` and `aws_iam_role:inline_policy` turns
the suite red on "deprecated sibling mirrors are NOT drift".

Also corrected the test file's own header, which still claimed three
helpers and that §14.2's prod-scoped apply role was unbuilt — it has been
since #363/#364 — and now states the opposite risk the classifier carries:
an over-broad ignore entry retires drift detection while leaving the
workflow in the tree.

One process note, since it cost a redo: `reset --hard` on uncommitted work
loses it, and the repo's own memory says to check `git status` before any
git operation here. I did not, and rewrote these two edits.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin force-pushed the bm/infra-drift-siblings branch from 8b034d8 to 62298af Compare November 1, 2026 07:16
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

terraform plan

82285a9 · 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 e977f9d into main Nov 1, 2026
27 checks passed
athvin added a commit that referenced this pull request Nov 5, 2026
`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: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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