siderolabs / terraform-provider-talos

Mozilla Public License 2.0
123 stars 17 forks source link

fix talos_version nil parsing #118

Closed rgl closed 1 year ago

rgl commented 1 year ago

This fixes the talos_version parsing.

For some odd reason, while trying to use a terraform variable (please see the last commit at the branch at https://github.com/rgl/terraform-libvirt-talos/tree/wip-tfvars). this provider started to crash. This PR fixed that crash by now returning an "internal error" kind of message. But that still does not make my branch work!

Even thou this PR seems to be needed, I'm still stuck, I can now see this internal error, but I have no idea what I'm doing to trigger this in terraform.

PS: Oh, commenting the kubernetes_version property prevents the original crash from happening:

data "talos_machine_configuration" "controller" {
  cluster_name       = var.cluster_name
  cluster_endpoint   = local.cluster_endpoint
  machine_secrets    = talos_machine_secrets.talos.machine_secrets
  machine_type       = "controlplane"
  talos_version      = var.talos_version_tag
  #kubernetes_version = "1.26.8"

Is there a talos-version <-> k8s-version strict relationship? I thought I could use any version from https://github.com/siderolabs/kubelet/pkgs/container/kubelet

rgl commented 1 year ago

I've managed to refactor my terraform code in a way that it no longer crashes this terraform provider.

But I still think this should be merged, to detect that nil case.

And to add the -debug flag to allow us to debug this terraform provider.

frezbo commented 1 year ago

I've added a test and fixed the issue properly

frezbo commented 1 year ago

/m