cockroachdb / terraform-provider-cockroach

Terraform provider for CockroachDB Cloud
Apache License 2.0
57 stars 12 forks source link

Replace list attribute with sets #163

Closed erademacher closed 1 year ago

erademacher commented 1 year ago

Lists are ordered. If a user changes the order of a list, Terraform will attempt to update the resource. If there are other resources that depend on the list attributes, they'll be destroyed and recreated. That's a big problem for things like CMEK.

A better alternative is to use a set. It's backwards compatible since it's represented the same way in state, but Terraform ignores the order. Terraform automatically sorts set elements alphabetically, so this required updating some test expecteds.

This also means we no longer need to sort regions or other fields according to the plan.

Using the set plan modifiers required pulling in new framework code, so I also took the opportunity to update the framework from 1.3.3 to 1.3.5 for a few minor bug fixes.

Commit checklist

erademacher commented 1 year ago

Have you tested/is there a good way to test this change with a TFstate that uses the list attributes?

With the test framework? No. But I manually tested a few different moderately complex clusters.

erademacher commented 1 year ago

TFTR!