From bdf6dafb1935a3ce0c4e94464fec9af3365ef157 Mon Sep 17 00:00:00 2001 From: aimee-889 Date: Fri, 1 Mar 2024 11:08:09 +0000 Subject: [PATCH 1/5] fix missing ssh_key for ionos server resource --- modules/ionos-basic-vm/locals.tf | 3 ++- modules/ionos-basic-vm/server.tf | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/ionos-basic-vm/locals.tf b/modules/ionos-basic-vm/locals.tf index f2f8cb2..cbb570d 100644 --- a/modules/ionos-basic-vm/locals.tf +++ b/modules/ionos-basic-vm/locals.tf @@ -1,4 +1,5 @@ locals { + technicaluser_key_path = var.initial_public_key public_ip = var.create_ip_pool ? ionoscloud_ipblock.public_ip[0].ips[0] : var.public_ip dns_zone_name = var.dns_zone_name_override == "" ? module.conventions_coordinates.dns_zone_name : var.dns_zone_name_override basic_vm_server = var.permanent_vm ? ionoscloud_server.basic_vm_server[0] : ionoscloud_server.basic_vm_server_not_permanent[0] @@ -6,7 +7,7 @@ locals { user_data_vars = { "initial_user" = var.initial_user "initial_uid" = var.initial_uid - "initial_public_key" = var.initial_public_key + "initial_public_key" = file(var.initial_public_key) } user_data = base64encode(templatefile("${path.module}/${var.user_data_script}", local.user_data_vars)) } diff --git a/modules/ionos-basic-vm/server.tf b/modules/ionos-basic-vm/server.tf index 8cd8690..6a289f5 100644 --- a/modules/ionos-basic-vm/server.tf +++ b/modules/ionos-basic-vm/server.tf @@ -8,7 +8,7 @@ resource "ionoscloud_server" "basic_vm_server" { image_name = var.image cpu_family = var.cpu_family availability_zone = var.availability_zone - ssh_keys = [] + ssh_keys = [ local.technicaluser_key_path ] # /dev/vda1 volume { @@ -45,7 +45,7 @@ resource "ionoscloud_server" "basic_vm_server_not_permanent" { image_name = var.image cpu_family = var.cpu_family availability_zone = var.availability_zone - ssh_keys = [] + ssh_keys = [ local.technicaluser_key_path ] # /dev/vda1 volume { From c405c904b3c6bf9e7a8ea5adf36d9bb72c3ee4bf Mon Sep 17 00:00:00 2001 From: aimee-889 Date: Mon, 4 Mar 2024 06:45:48 +0000 Subject: [PATCH 2/5] add dns name to outputs of basic vm module --- modules/ionos-basic-vm/outputs.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/ionos-basic-vm/outputs.tf b/modules/ionos-basic-vm/outputs.tf index 7cd4375..63ca9a7 100644 --- a/modules/ionos-basic-vm/outputs.tf +++ b/modules/ionos-basic-vm/outputs.tf @@ -2,6 +2,10 @@ output "basic_vm_server_id" { value = local.basic_vm_server.id } +output "basic_vm_server_dns" { + value = trim(join("", opentelekomcloud_dns_recordset_v2.a_records.*.name), ".") +} + output "basic_vm_server_public_ip" { value = local.basic_vm_server.primary_ip } From e355345da72a6a346cf10a30becbb0c121e1e932 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 4 Mar 2024 06:46:12 +0000 Subject: [PATCH 3/5] terraform-docs: automated action --- modules/ionos-basic-vm/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ionos-basic-vm/README.md b/modules/ionos-basic-vm/README.md index 06c5b93..c794667 100644 --- a/modules/ionos-basic-vm/README.md +++ b/modules/ionos-basic-vm/README.md @@ -49,6 +49,7 @@ | Name | Description | |------|-------------| +| [basic\_vm\_server\_dns](#output\_basic\_vm\_server\_dns) | n/a | | [basic\_vm\_server\_id](#output\_basic\_vm\_server\_id) | n/a | | [basic\_vm\_server\_nicuuid](#output\_basic\_vm\_server\_nicuuid) | n/a | | [basic\_vm\_server\_public\_ip](#output\_basic\_vm\_server\_public\_ip) | n/a | From 01f111fd83f137328556f6f26784b915a3078462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aimee=20Wei=C3=9F?= Date: Wed, 6 Mar 2024 08:44:39 +0100 Subject: [PATCH 4/5] test expression without join --- modules/ionos-basic-vm/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ionos-basic-vm/outputs.tf b/modules/ionos-basic-vm/outputs.tf index 63ca9a7..8410b0a 100644 --- a/modules/ionos-basic-vm/outputs.tf +++ b/modules/ionos-basic-vm/outputs.tf @@ -3,7 +3,7 @@ output "basic_vm_server_id" { } output "basic_vm_server_dns" { - value = trim(join("", opentelekomcloud_dns_recordset_v2.a_records.*.name), ".") + value = trim(opentelekomcloud_dns_recordset_v2.a_records.*.name, ".") } output "basic_vm_server_public_ip" { From 4f6cb6d0646717a923360f595f2aba2254601d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aimee=20Wei=C3=9F?= Date: Wed, 6 Mar 2024 08:54:29 +0100 Subject: [PATCH 5/5] simplify expression --- modules/ionos-basic-vm/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ionos-basic-vm/outputs.tf b/modules/ionos-basic-vm/outputs.tf index 8410b0a..85c8ed0 100644 --- a/modules/ionos-basic-vm/outputs.tf +++ b/modules/ionos-basic-vm/outputs.tf @@ -3,7 +3,7 @@ output "basic_vm_server_id" { } output "basic_vm_server_dns" { - value = trim(opentelekomcloud_dns_recordset_v2.a_records.*.name, ".") + value = trim(opentelekomcloud_dns_recordset_v2.a_records.name, ".") } output "basic_vm_server_public_ip" {