Skip to content

Commit 9c30524

Browse files
committed
fix(talos): change talos_cluster_kubeconfig to resource
Closes: #89
1 parent 01a0b73 commit 9c30524

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

talos.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ data "talos_client_configuration" "this" {
119119
)
120120
}
121121

122-
data "talos_cluster_kubeconfig" "this" {
122+
resource "talos_cluster_kubeconfig" "this" {
123123
count = var.control_plane_count > 0 ? 1 : 0
124124
client_configuration = talos_machine_secrets.this.client_configuration
125125
node = local.control_plane_public_ipv4_list[0]
@@ -136,15 +136,15 @@ locals {
136136
"unknown"
137137
)
138138
kubeconfig = replace(
139-
can(data.talos_cluster_kubeconfig.this[0].kubeconfig_raw) ? data.talos_cluster_kubeconfig.this[0].kubeconfig_raw : "",
139+
can(talos_cluster_kubeconfig.this[0].kubeconfig_raw) ? talos_cluster_kubeconfig.this[0].kubeconfig_raw : "",
140140
local.cluster_endpoint_url_internal, "https://${local.kubeconfig_host}:${local.api_port_k8s}"
141141
)
142142

143143
kubeconfig_data = {
144144
host = "https://${local.best_public_ipv4}:${local.api_port_k8s}"
145145
cluster_name = var.cluster_name
146-
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
147-
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
148-
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
146+
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
147+
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
148+
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
149149
}
150150
}

0 commit comments

Comments
 (0)