feat(terraform): add outputs for kubeconfig and talosconfig

This commit is contained in:
2026-02-10 00:48:46 +02:00
parent 81b5b8d4f1
commit deb32a61a6
2 changed files with 35 additions and 0 deletions

View File

@@ -90,3 +90,23 @@ data "talos_cluster_health" "talos-health" {
control_plane_nodes = [each.value.ip_address] control_plane_nodes = [each.value.ip_address]
endpoints = [each.value.hostname] endpoints = [each.value.hostname]
} }
data "talos_client_configuration" "talos-client-config" {
depends_on = [data.talos_cluster_health.talos-health]
for_each = var.clusters
cluster_name = each.key
client_configuration = talos_machine_secrets.secrets[each.key].client_configuration
nodes = [each.value.ip_address]
}
resource "talos_cluster_kubeconfig" "talos-kubeconfig" {
depends_on = [data.talos_cluster_health.talos-health]
for_each = var.clusters
client_configuration = talos_machine_secrets.secrets[each.key].client_configuration
node = each.value.ip_address
}

15
terraform/outputs.tf Normal file
View File

@@ -0,0 +1,15 @@
output "kubeconfig" {
value = {
for key, cluster in var.clusters :
key => talos_cluster_kubeconfig.talos-kubeconfig[key].kubeconfig_raw
}
sensitive = true
}
output "talosconfig" {
value = {
for key, cluster in var.clusters :
key => data.talos_client_configuration.talos-client-config[key].talos_config
}
sensitive = true
}