coder / terraform-provider-coderd

Manage a Coder deployment using Terraform
https://registry.terraform.io/providers/coder/coderd/latest/docs
Mozilla Public License 2.0
10 stars 2 forks source link

fix: skip validating unknown version names #123

Closed ethanndickson closed 1 month ago

ethanndickson commented 1 month ago

Same problem as seen in #115.

This fixes a problem where having multiple template version names manually set using Terraform variables would always return a duplicate name error, as Terraform would mark the attribute, although it is required and already written in the config, as Unknown before calling our custom validator. This unknown value is only ever passed to the validator, never Create or Update.

Knowing this, we see the same problem exists for all attributes we read in our custom validator. The only remaining one is active, where we check at least one version is marked as active. In this case, we also need to skip validating active if any of the booleans are unknown.

We previously didn't have any tests that explicitly used Terraform variables, so this PR adds one, in case the behaviour of these variable set attributes is changed in the future.

ethanndickson commented 1 month ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ethanndickson and the rest of your teammates on Graphite Graphite