appuio / terraform-openshift4-exoscale

OpenShift 4 Terraform setup for Exoscale
2 stars 0 forks source link

Fix validation logic for `additional_node_groups.*.state` #67

Closed simu closed 2 years ago

simu commented 2 years ago

I've encountered errors like reproduced below while testing the state migration for #60.

│   on .terraform/modules/cluster/variables.tf line 164, in variable "additional_worker_groups":
│  164:       (v.state == null || lower(v.state) == "running" || lower(v.state) == "stopped")
│     ├────────────────
│     │ v.state is null
│
│ Invalid value for "str" parameter: argument must not be null.

Since Terraform boolean operators don't short-circuit, we should use the ternary operator form to perform the validation anyway (we already do this for the disk size parameter). Currently the old approach works because apparently you can compare a string to null.

Checklist