From a28b5c936f3bfc0e68dcec8e5c9aac4432d73d0c Mon Sep 17 00:00:00 2001 From: Sivaanand Murugesan Date: Thu, 15 Jun 2023 20:18:45 +0530 Subject: [PATCH] PLT-512-1:Module support for ssh_keys (#70) --- spectro-cluster-edge-vsphere.tf | 3 +-- spectro-cluster-libvirt.tf | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/spectro-cluster-edge-vsphere.tf b/spectro-cluster-edge-vsphere.tf index a478e93..a7714c7 100644 --- a/spectro-cluster-edge-vsphere.tf +++ b/spectro-cluster-edge-vsphere.tf @@ -5,8 +5,7 @@ resource "spectrocloud_cluster_edge_vsphere" "this" { edge_host_uid = each.value.edge_host_uid cloud_config { - ssh_key = try(each.value.cloud_config.ssh_key, "") - ssh_keys = try(each.value.cloud_config.ssh_keys, []) + ssh_keys = concat(try(try(each.value.cloud_config.ssh_key, "") == "" ? try(each.value.cloud_config.ssh_keys, []) : [each.value.cloud_config.ssh_key], []), try(each.value.cloud_config.ssh_keys, [])) static_ip = each.value.cloud_config.static_ip network_type = each.value.cloud_config.network_type vip = each.value.cloud_config.vip diff --git a/spectro-cluster-libvirt.tf b/spectro-cluster-libvirt.tf index e87f06c..0a7e720 100644 --- a/spectro-cluster-libvirt.tf +++ b/spectro-cluster-libvirt.tf @@ -5,8 +5,7 @@ resource "spectrocloud_cluster_libvirt" "this" { tags = try(each.value.tags, []) cloud_config { - ssh_key = try(each.value.cloud_config.ssh_key, "") - ssh_keys = try(each.value.cloud_config.ssh_keys, []) + ssh_keys = concat(try(try(each.value.cloud_config.ssh_key, "") == "" ? try(each.value.cloud_config.ssh_keys, []) : [each.value.cloud_config.ssh_key], []), try(each.value.cloud_config.ssh_keys, [])) vip = try(each.value.cloud_config.vip, "") ntp_servers = try(each.value.cloud_config.ntp_servers, []) network_search_domain = try(each.value.cloud_config.search_domain, "")