Skip to content

Commit

Permalink
fix(talos): change talos_cluster_kubeconfig to resource
Browse files Browse the repository at this point in the history
Closes: #89
  • Loading branch information
mrclrchtr committed Oct 11, 2024
1 parent 01a0b73 commit 9c30524
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions talos.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ data "talos_client_configuration" "this" {
)
}

data "talos_cluster_kubeconfig" "this" {
resource "talos_cluster_kubeconfig" "this" {
count = var.control_plane_count > 0 ? 1 : 0
client_configuration = talos_machine_secrets.this.client_configuration
node = local.control_plane_public_ipv4_list[0]
Expand All @@ -136,15 +136,15 @@ locals {
"unknown"
)
kubeconfig = replace(
can(data.talos_cluster_kubeconfig.this[0].kubeconfig_raw) ? data.talos_cluster_kubeconfig.this[0].kubeconfig_raw : "",
can(talos_cluster_kubeconfig.this[0].kubeconfig_raw) ? talos_cluster_kubeconfig.this[0].kubeconfig_raw : "",
local.cluster_endpoint_url_internal, "https://${local.kubeconfig_host}:${local.api_port_k8s}"
)

kubeconfig_data = {
host = "https://${local.best_public_ipv4}:${local.api_port_k8s}"
cluster_name = var.cluster_name
cluster_ca_certificate = var.control_plane_count > 0 ? base64decode(data.talos_cluster_kubeconfig.this[0].kubernetes_client_configuration.ca_certificate) : tls_self_signed_cert.dummy_ca[0].cert_pem
client_certificate = var.control_plane_count > 0 ? base64decode(data.talos_cluster_kubeconfig.this[0].kubernetes_client_configuration.client_certificate) : tls_locally_signed_cert.dummy_issuer[0].cert_pem
client_key = var.control_plane_count > 0 ? base64decode(data.talos_cluster_kubeconfig.this[0].kubernetes_client_configuration.client_key) : tls_private_key.dummy_issuer[0].private_key_pem
cluster_ca_certificate = var.control_plane_count > 0 ? base64decode(talos_cluster_kubeconfig.this[0].kubernetes_client_configuration.ca_certificate) : tls_self_signed_cert.dummy_ca[0].cert_pem
client_certificate = var.control_plane_count > 0 ? base64decode(talos_cluster_kubeconfig.this[0].kubernetes_client_configuration.client_certificate) : tls_locally_signed_cert.dummy_issuer[0].cert_pem
client_key = var.control_plane_count > 0 ? base64decode(talos_cluster_kubeconfig.this[0].kubernetes_client_configuration.client_key) : tls_private_key.dummy_issuer[0].private_key_pem
}
}

0 comments on commit 9c30524

Please sign in to comment.