Repository navigation
Commit 91ca3c0
committed
fix(iac/gcp): drop attribute.account so both WIF onboarding paths agree
The Terraform module maps three attributes on the AWS branch (google.subject,
attribute.aws_role, attribute.account) while
arm/CUDly-CrossSubscription/setup-gcp-wif.sh maps only the first two. Nothing
reads attribute.account: its only two references in the tree were the mapping
line itself and the comment above it. It is not named by the
attribute_condition, by the impersonation grant's principalSet, or by any test.
Today that divergence is inert, because the script compares only the provider's
attributeCondition. Once the script also compares attributeMapping as an exact
set, it stops being inert: both paths default to pool 'cudly-pool' and provider
'cudly-provider', so a customer onboarded via the Terraform bundle who then runs
the script against the same project lands on this module's provider, fails the
set comparison on the one extra key, and is told to delete the provider and
re-run. That detaches every live federated session, and the next terraform apply
then fights the recreated provider. The verdict would also be wrong: the mapping
is not unsafe, it just carries one extra unused key.
Removing the key rather than teaching the script to expect it keeps the
comparison an exact set, which is what stops an unexpected attribute from being
introduced later and keyed on by a pool-wide
principalSet://.../attribute.X/... grant. Account pinning is unaffected: the
provider's aws.account_id block and the account number inside the pinned role
ARN both still constrain it.
Also corrects the comment above the mapping. It specifically anticipated this
attribute and concluded it was inert because the script "compares conditions,
not mappings" - true when written, false as soon as the script compares
mappings, and a future reader would have trusted it.
Migration: attribute_mapping is not ForceNew in the google provider (the field
is Optional with no ForceNew, and Update appends "attributeMapping" to the PATCH
updateMask), so dropping a key is an in-place update. It rides along with the
change this branch already makes to the same field and adds no replacement risk.
TestGCPTargetMappingMatchesSetupScript locks the two paths to the same mapping
set, parsing both files rather than restating either, and fails if a key is ever
added on one side alone.
Refs #16671 parent bdcc8c8 commit 91ca3c0
2 files changed
Lines changed: 106 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
133 | 141 | | |
134 | 142 | | |
135 | 143 | | |
136 | | - | |
137 | 144 | | |
138 | 145 | | |
139 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
122 | 213 | | |
123 | 214 | | |
124 | 215 | | |
| |||
0 commit comments