cockroachdb / terraform-provider-cockroach

Terraform provider for CockroachDB Cloud
Apache License 2.0
56 stars 10 forks source link

Force allowlist rebuild when address is changed #40

Closed erademacher closed 1 year ago

erademacher commented 1 year ago

Since the ID is based on the CIDR address, it needs to be recomputed when the address is updated.

erademacher commented 1 year ago

The issue is we are using tfsdk.UseStateForUnknown() for the id attribute and this is used for computed attributes which are known to not change over time. This will produce the following error on the TF apply command while setting the TF state after updating.

I see. Thanks for clarifying! I had a wrong understanding of UseStateForUnknown. Fortunately, though, I just double checked the CCAPI's update allowlist endpoint, and it doesn't let you modify the CIDR address anyway. I marked both CIDR fields as RequiresReplace. The SQL user schema should still be OK, but I'll revisit the cluster schema in another PR.

I tested the update operation for all fields in the allowlist resource and didn't see any errors or get it into a bad state, so hopefully we're good now.

erademacher commented 1 year ago

TFTR!