feat(terraform): add outputs for kubeconfig and talosconfig
This commit is contained in:
@@ -90,3 +90,23 @@ data "talos_cluster_health" "talos-health" {
|
||||
control_plane_nodes = [each.value.ip_address]
|
||||
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
15
terraform/outputs.tf
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user