siderolabs / terraform-provider-talos

Mozilla Public License 2.0
117 stars 15 forks source link

Datasource talos_cluster_kubeconfig is not idempotent #155

Closed FlxPeters closed 2 months ago

FlxPeters commented 5 months ago

Given I use the example code for the talos_cluster_kubeconfig data source, a new kubeconfig is a returned on every terraform apply.

data "talos_cluster_kubeconfig" "this" {
  depends_on = [
    talos_machine_bootstrap.this
  ]
  client_configuration = talos_machine_secrets.this.client_configuration
  node                 = "10.5.0.2"
}

This is not a show-stopper bug, but the data source will change on each run which is a change in the plan.

Is this an intended behavior?

frezbo commented 5 months ago

yes, that's the intended behavior, maybe we can improve it to generate the client kubeconfig from machine secrets instead of retrieving from the talos api which would return a new one every single time

shkarface commented 4 months ago

+1

luis-guimaraes-exoawk commented 4 months ago

@frezbo It'd be great if we could make it so that it's a fixed value or at least that it only changes when strictly required.

frezbo commented 2 months ago

The only fix would be to convert this to a resource as opposed to a data_source due TF provider internals