Repository navigation
fix(devops): guard WIF pilot partial recovery - #9884
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e0e25b596
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if set(planned_resources) != EXPECTED_BOOTSTRAP_RESOURCES: | ||
| errors.append( | ||
| "bootstrap recovery planned values must contain exactly " f"{sorted(EXPECTED_BOOTSTRAP_RESOURCES)}" | ||
| ) |
There was a problem hiding this comment.
Validate planned WIF values before recovery
In the recovery flow documented for operators, the checked plan is supplied as JSON, but this branch only compares the planned resource addresses. A stale saved plan from before the display-name fix still has the exact two prior resources and the same create/no-op actions while carrying the rejected 36/44-char WIF display names in planned_values, so --partial-recovery-plan-json passes and the operator can apply a plan that repeats the IAM API failure. Please validate the planned values for the WIF pool/provider rather than only the address set.
Useful? React with 👍 / 👎.
The development bootstrap stopped after two desired resources because the WIF display names exceeded the IAM API limit. Bound both labels and accept only the recorded two-resource state plus the remaining three creates during recovery.
5e0e25b to
1003811
Compare
## Summary - Shorten both Workload Identity Federation display names to satisfy the IAM API's 32-character limit. - Add a regression guard for both display names. - Add a state-aware recovery gate for the known development-only partial apply. Related: BasedHardware#9842 ## Root cause and durable guard The development bootstrap created its service account and `roles/browser` binding, then IAM rejected the WIF pool display name as too long. The provider display name was also too long and would have failed next. The guard now rejects either overlong WIF display name. Its recovery mode accepts only the recorded two-resource prior state, preserves those resources as no-ops, and permits only creation of the pool, provider, and WIF impersonation binding. It rejects updates, replacements, deletions, unexpected state, and IAM changes. ## Verification - `python3 .github/scripts/test_check_opentofu_development_wif_pilot.py` — 12 tests passed. - Backend-free OpenTofu init, validate, saved plan, JSON rendering, and exact five-create assertion — passed with the invalid offline sentinel token; no GCP authentication or mutation path. - `tofu -chdir=infrastructure/opentofu/pilots/development-wif-plan fmt -check` — passed. - `make preflight` — passed all 13 selected checks after rebasing onto the current `main`. ## Product invariants affected none ## Failure class (fixes) Failure-Class: none No existing registered failure class covers a provider display-name contract missing from an IaC guard.
Summary
Related: #9842
Root cause and durable guard
The development bootstrap created its service account and
roles/browserbinding, then IAM rejected the WIF pool display name as too long. The provider display name was also too long and would have failed next.The guard now rejects either overlong WIF display name. Its recovery mode accepts only the recorded two-resource prior state, preserves those resources as no-ops, and permits only creation of the pool, provider, and WIF impersonation binding. It rejects updates, replacements, deletions, unexpected state, and IAM changes.
Verification
python3 .github/scripts/test_check_opentofu_development_wif_pilot.py— 12 tests passed.tofu -chdir=infrastructure/opentofu/pilots/development-wif-plan fmt -check— passed.make preflight— passed all 13 selected checks after rebasing onto the currentmain.Product invariants affected
none
Failure class (fixes)
Failure-Class: none
No existing registered failure class covers a provider display-name contract missing from an IaC guard.