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

Validate enterprise-only fields during plan #61

Closed ethanndickson closed 3 months ago

ethanndickson commented 3 months ago

Currently, if a user sets an enterprise-only attribute, such as allow_user_autostart to false on a coderd_template, on an AGPL deployment, the resource will be created as coderd does not return an error. However, when the provider goes to read the state of the resource, it will note a state mismatch (as the field is always true for AGPL deployments), and report a provider error. This is very much confusing for users. Ideally, we should return a validation error forbidding this during a plan.

matifali commented 3 months ago

As a reference, you can check how JFrog artifactory provider handles this. They check for licenses during provider initialization and do not work without a valid license.

[!IMPORTANT] They are using SDKv2 and not the terraform plugin framework.