Commit 0271796
authored
fix: Prevent enterprise org taint on SAML enforcement error (#3026)
* fix: Prevent enterprise org taint on SAML enforcement error
When creating an enterprise organization in an EMU environment, the REST
API call to set description/display_name fails with a SAML enforcement
error until the PAT is authorized for the new org. Previously this would
taint the resource, causing Terraform to destroy and recreate the org on
the next apply.
This fix:
- Catches SAML enforcement errors in Create and Update functions
- Clears description/display_name from state on create, resets to previous
values on update, so state reflects reality and next plan shows drift
- Returns success instead of error to prevent tainting
- Logs a warning instructing the user to authorize the PAT and re-apply
Fixes: #1914
# Conflicts:
# github/resource_github_enterprise_organization.go
* Update github/resource_github_enterprise_organization_test.go1 parent fbcab61 commit 0271796
File tree
2 files changed
+104
-5
lines changed- github
2 files changed
+104
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
15 | 28 | | |
16 | 29 | | |
17 | 30 | | |
| |||
128 | 141 | | |
129 | 142 | | |
130 | 143 | | |
131 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
132 | 155 | | |
133 | 156 | | |
134 | 157 | | |
| |||
301 | 324 | | |
302 | 325 | | |
303 | 326 | | |
304 | | - | |
| 327 | + | |
305 | 328 | | |
306 | 329 | | |
307 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
308 | 339 | | |
309 | 340 | | |
310 | 341 | | |
| |||
318 | 349 | | |
319 | 350 | | |
320 | 351 | | |
321 | | - | |
| 352 | + | |
322 | 353 | | |
323 | 354 | | |
324 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
325 | 364 | | |
326 | 365 | | |
327 | 366 | | |
| |||
| 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 | | |
8 | 10 | | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 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 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
13 | 73 | | |
14 | 74 | | |
15 | 75 | | |
| |||
0 commit comments