Commit 66dbc5b
Fix inconsistent-apply-result errors for tsb_oidc and tsb_team (#16)
## Summary
- `tsb_oidc.secret` is proto `INPUT_ONLY` (accepted on write, never
echoed back). `flatten<Resource>` was unconditionally overwriting the
model with the server's always-empty response for such fields, producing
"Provider produced inconsistent result after apply" on every
create/update. Fixed generically in `cmd/gen-provider` by detecting
`google.api.field_behavior = INPUT_ONLY` and skipping the flatten
assignment.
- `tsb_team.source_type` is Computed-only with a `Default` that falls
back to the proto enum zero value (`"INVALID"`) because it's missing the
upstream `enumdefault` override tag its sibling `User.source_type` has.
TSB's `CreateTeam`/`UpdateTeam` always coerce an unset source type to
`LOCAL` server-side, so the planned `"INVALID"` never matches the
server's real response. Fixed in `internal/provider/schema_fixup.go`:
Computed-only string attributes whose Default resolves to the enum
zero-value sentinel now drop the Default in favor of
`UseStateForUnknown`, so the plan value stays unknown until the server's
actual value is known. `User.source_type`'s legitimate `MANUAL` default
is untouched.
## Test plan
- [x] `go build ./...`
- [x] `go test ./...`
- [x] `make format` (clean diff)
- [x] Ad hoc test confirming `fixupSchema(TeamSchema())` drops the
Default + adds `UseStateForUnknown` on `source_type`, while
`fixupSchema(UserSchema())` leaves its `MANUAL` default untouched
- [ ] `terraform apply` against a live TSB instance with `tsb_oidc` +
`tsb_team` resources (not run here — requires live infra)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>1 parent b62d0f2 commit 66dbc5b
4 files changed
Lines changed: 66 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
504 | 508 | | |
505 | 509 | | |
506 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
268 | 274 | | |
269 | 275 | | |
270 | 276 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
9 | 20 | | |
10 | 21 | | |
11 | 22 | | |
12 | | - | |
| 23 | + | |
13 | 24 | | |
14 | 25 | | |
15 | 26 | | |
| |||
28 | 39 | | |
29 | 40 | | |
30 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
31 | 53 | | |
32 | 54 | | |
33 | 55 | | |
34 | 56 | | |
35 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
36 | 66 | | |
37 | 67 | | |
38 | 68 | | |
| |||
44 | 74 | | |
45 | 75 | | |
46 | 76 | | |
47 | | - | |
| 77 | + | |
| 78 | + | |
48 | 79 | | |
49 | | - | |
| 80 | + | |
50 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
51 | 85 | | |
52 | 86 | | |
53 | 87 | | |
| |||
0 commit comments