kube-hetzner / terraform-hcloud-kube-hetzner

Optimized and Maintenance-free Kubernetes on Hetzner Cloud in one command!
MIT License
2.42k stars 371 forks source link

[Bug]: Terraform failing if csi is disabled (disable_hetzner_csi) and `hetzner_csi_version` not set #1470

Closed UBaggeler closed 2 months ago

UBaggeler commented 2 months ago

Description

We are not using csi (disable_hetzner_csi = true) and therefore hetzner_csi_version is not set. Since a few weeks, Terraform apply is failing with the following error.

╷
│ Error: Error in function call
│ 
│   on .terraform/modules/kube-hetzner/init.tf line 258, in resource "null_resource" "kustomization":
│  258:     content = templatefile(
│  259:       "${path.module}/templates/hcloud-csi.yaml.tpl",
│  260:       {
│  261:         version = local.csi_version
│  262:         values  = indent(4, trimspace(var.hetzner_csi_values))
│  263:     })
│     ├────────────────
│     │ while calling templatefile(path, vars)
│     │ local.csi_version is null
│     │ path.module is ".terraform/modules/kube-hetzner"
│     │ var.hetzner_csi_values is ""
│ 
│ Call to function "templatefile" failed:
│ .terraform/modules/kube-hetzner/templates/hcloud-csi.yaml.tpl:10,15-22:
│ Invalid template interpolation value; The expression result is null. Cannot
│ include a null value in a string template..

Kube.tf file

[...]

  # To disable Hetzner CSI storage, you can set the following to "true", default is "false".
  disable_hetzner_csi = true

  # If you want to use a specific Hetzner CCM and CSI version, set them below; otherwise, leave them as-is for the latest versions.
  # hetzner_ccm_version = ""
  # hetzner_csi_version = ""

[...]

Screenshots

No response

Platform

Linux