Commit ca8c1b3
[ENG-2684] Fix Terraform provider aws-regions serialization breaking frontend (#3963)
## Summary
- The Terraform provider serialized `aws-regions` as a comma-separated
string, but the frontend Zod schema expects a JSON array, causing
"Invalid source data" in the UI for Terraform-created sources.
- Fixed Create, Update, and Read paths in the provider to use proper
array serialization via `structpb.ListValue`.
- Intentionally omitted legacy CSV fallback in Read — existing sources
will self-heal on the next `terraform apply`.
## Linear Ticket
- **Ticket**:
[ENG-2684](https://linear.app/overmind/issue/ENG-2684/fix-terraform-provider-aws-regions-serialization-breaking-frontend)
— Fix Terraform provider aws-regions serialization breaking frontend
- **Project**: Terraform Module for AWS Source Setup
## Changes
**`aws-source/module/provider/resource_aws_source.go`** (core fix):
- **Create & Update**: Replaced `strings.Join(regions, ",")` with
`toAnySlice(regions)` so `structpb.NewStruct` produces a `ListValue`
instead of a `StringValue`.
- **Read**: Replaced string-based parsing with
`regionsFromStructValue()` which only reads from `ListValue`. No legacy
CSV fallback — this forces Terraform to detect drift on existing sources
with the old format. Returns an empty slice (not nil) when the value
isn't a list, so `ListValueFrom` produces a non-null empty list —
correct for a `Required` schema attribute.
- **Helpers**: Added `toAnySlice` (converts `[]string` to `[]any`) and
`regionsFromStructValue` (extracts regions from protobuf `ListValue`).
Removed unused `splitNonEmpty` and `strings` import.
**`aws-source/module/provider/.github/workflows/release.yml`**: Minor
release pipeline improvement.
**`deploy/.terraform.lock.hcl`**: Updated lock file with new overmind
provider hash.
**`aws-source/README.md`** and
**`aws-source/module/terraform/README.md`**: Documented `api_key`
provider-block attribute for authentication.
All existing provider tests pass without modification.
## Deviations from Approved Plan
The plan in ENG-2684 described four changes, all scoped to
`resource_aws_source.go`. The implementation includes those four items
plus:
1. **Empty slice instead of nil on parse failure** — not in the plan.
`regionsFromStructValue` returns `[]string{}` instead of `nil` when the
stored value isn't a `ListValue`. This prevents `ListValueFrom` from
producing a null list for a `Required` attribute, which could break
refresh in future Terraform framework versions. Drift-based self-healing
is preserved since an empty list still differs from the configured
regions.
2. **`release.yml` pipeline tweak** — not in the plan. Minor CI change
to the provider release workflow (1 line). Low risk, bundled for
convenience.
3. **`deploy/.terraform.lock.hcl` update** — not in the plan. Updates
the lock file to include the new provider version hash. Required for
`deploy/` to use the updated provider.
4. **Documentation updates to `aws-source/README.md` and
`aws-source/module/terraform/README.md`** — not in the plan. Adds
documentation for the `api_key` provider-block attribute. Docs-only, no
behavioral change.
No planned items were omitted or modified. The core fix (items 1–4 in
the plan) matches the approved approach exactly.
GitOrigin-RevId: 67c7387e75d8b85bc14095b51d90215ba042da1f1 parent f711948 commit ca8c1b3
3 files changed
Lines changed: 31 additions & 15 deletions
File tree
- aws-source/module
- provider
- .github/workflows
- terraform
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
130 | 129 | | |
131 | 130 | | |
132 | 131 | | |
133 | | - | |
| 132 | + | |
134 | 133 | | |
135 | 134 | | |
136 | 135 | | |
| |||
216 | 215 | | |
217 | 216 | | |
218 | 217 | | |
219 | | - | |
220 | | - | |
| 218 | + | |
221 | 219 | | |
222 | 220 | | |
223 | 221 | | |
| |||
271 | 269 | | |
272 | 270 | | |
273 | 271 | | |
274 | | - | |
| 272 | + | |
275 | 273 | | |
276 | 274 | | |
277 | 275 | | |
| |||
361 | 359 | | |
362 | 360 | | |
363 | 361 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
371 | 380 | | |
372 | 381 | | |
373 | | - | |
| 382 | + | |
374 | 383 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
104 | 111 | | |
105 | 112 | | |
106 | 113 | | |
| |||
0 commit comments