Commit ae766b8
committed
fix(ci-lease): cover all sandbox lifecycle OUs + don't retry POST on 5xx
Two correctness bugs that surfaced once we got past the WAF and into
real lease acquisition.
1) StackSet wasn't following lease lifecycle. SERVICE_MANAGED StackSets
with AutoDeployment don't recurse into descendant OUs — they only
deploy to accounts DIRECTLY in the listed OUs. Original template
targeted just the parent (ou-2laj-4dyae1oa), which has zero direct
accounts, plus an out-of-band create-stack-instances I ran yesterday
against the Available OU. Result: when an account moved Available
-> Active for a lease, the StackSet treated it as "left the targeted
OU", REMOVED the stack (retainStacksOnAccountRemoval=false), and the
workflow's subsequent AssumeRole into the leased account hit a
missing role. Confirmed via list-stack-instances against
account=736822755656 in CleanUp OU returning 0 results.
Fix: enumerate every ISB lifecycle OU explicitly (Entry, Available,
Active, Frozen, CleanUp, Quarantine, Exit). The role now persists
through the full Available -> Active -> CleanUp -> Available cycle.
The CFN stack instance is also protected from aws-nuke by the
upstream nuke-config.yaml `StackSet-Isb-*` glob rule.
2) Lambda's make_isb_api_request retried 5xx errors on POST /leases,
which is non-idempotent. A transient 500 after the server actually
committed the record would create a duplicate lease, eating into
the maxLeasesPerUser quota (currently 1) and leaking a pool
account. Added an `idempotent` flag (default GET/HEAD/DELETE/PUT
yes, POST no). Acquire's POST explicitly opts out; terminate's POST
explicitly opts in (the API returns 404/409 for already-terminated
leases, which we treat as success).
The StackSet update will re-deploy to all 7 OUs — adds ~425 instances
spread across Active/Exit/etc. Wallclock ~15-25 min at
MaxConcurrentPercentage=100.1 parent 6681b93 commit ae766b8
2 files changed
Lines changed: 71 additions & 9 deletions
File tree
- cloudformation
- isb-hub-orgmgmt/ci-deploy-role-stackset
- isb-hub/lambda/lease-proxy
Lines changed: 39 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
36 | 42 | | |
37 | | - | |
38 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
39 | 68 | | |
40 | 69 | | |
41 | 70 | | |
| |||
69 | 98 | | |
70 | 99 | | |
71 | 100 | | |
72 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
73 | 108 | | |
74 | 109 | | |
75 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
93 | 110 | | |
94 | 111 | | |
95 | 112 | | |
| |||
117 | 134 | | |
118 | 135 | | |
119 | 136 | | |
120 | | - | |
| 137 | + | |
121 | 138 | | |
122 | 139 | | |
123 | 140 | | |
| |||
172 | 189 | | |
173 | 190 | | |
174 | 191 | | |
175 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
176 | 199 | | |
177 | 200 | | |
178 | 201 | | |
| |||
251 | 274 | | |
252 | 275 | | |
253 | 276 | | |
254 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
255 | 282 | | |
256 | 283 | | |
257 | 284 | | |
| |||
0 commit comments