cockroachdb / terraform-provider-cockroach

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

[CC-25232] Use plan instead of config #147

Closed erademacher closed 1 year ago

erademacher commented 1 year ago

For most resources, this is a simple find & replace.

For the database resource, I had it read the database from the create response and load it into the state instead of copying the plan (which can contain unknowns).

Private endpoint services is a weird case. Apparently, Terraform doesn't like it when Unknown values are loaded into non-Terraform types. Thankfully, this is only a problem for fully computed attributes. Required and optional attributes are loaded as nil. To resolve this, though, I had to change the data type for services to types.List and pass in the exact schema type to its constructor. I pulled the schema object out of the Schema method so I could extract the attribute type without dupicating code.

Commit checklist

erademacher commented 1 year ago

TFTR!