From df78376438062d72df9274a4838592e6000b4661 Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Tue, 19 Dec 2023 13:46:33 +0000 Subject: [PATCH 01/17] added resources for nat lan --- modules/ionos-datacenter/locals.tf | 32 ++++++++++++++------------- modules/ionos-datacenter/main.tf | 7 ++++++ modules/ionos-datacenter/output.tf | 8 +++++++ modules/ionos-datacenter/variables.tf | 6 +++++ 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/modules/ionos-datacenter/locals.tf b/modules/ionos-datacenter/locals.tf index 8afd83a..9f51c62 100644 --- a/modules/ionos-datacenter/locals.tf +++ b/modules/ionos-datacenter/locals.tf @@ -1,19 +1,20 @@ locals { - create_frontend_crossconnect = var.create_frontend_crossconnect - create_frontend_lan = (local.create_frontend_crossconnect == true || var.associated_frontend_crossconnect_id != "") ? true : false - create_backend_crossconnect = var.create_backend_crossconnect - create_backend_lan = (local.create_backend_crossconnect == true || var.associated_backend_crossconnect_id != "") ? true : false - create_service_crossconnect = var.create_service_crossconnect - create_service_lan = (local.create_service_crossconnect == true || var.associated_service_crossconnect_id != "") ? true : false - create_public_lan = var.create_public_lan - create_nfs_server_lan = var.create_nfs_server_lan - create_alb_target_lan = var.create_alb_target_lan - create_nlb_target_lan = var.create_nlb_target_lan - frontend_crossconnect_shared_group_ids = (length(var.crossconnect_shared_group_ids) > 0 && local.create_frontend_crossconnect == true) ? var.crossconnect_shared_group_ids : [] - backend_crossconnect_shared_group_ids = (length(var.crossconnect_shared_group_ids) > 0 && local.create_backend_crossconnect == true) ? var.crossconnect_shared_group_ids : [] - service_crossconnect_shared_group_ids = (length(var.crossconnect_shared_group_ids) > 0 && local.create_frontend_crossconnect == true) ? var.crossconnect_shared_group_ids : [] - routes_map = var.routes_map - create_postgres_lan = var.create_postgres_lan + create_frontend_crossconnect = var.create_frontend_crossconnect + create_frontend_lan = (local.create_frontend_crossconnect == true || var.associated_frontend_crossconnect_id != "") ? true : false + create_backend_crossconnect = var.create_backend_crossconnect + create_backend_lan = (local.create_backend_crossconnect == true || var.associated_backend_crossconnect_id != "") ? true : false + create_service_crossconnect = var.create_service_crossconnect + create_service_lan = (local.create_service_crossconnect == true || var.associated_service_crossconnect_id != "") ? true : false + create_public_lan = var.create_public_lan + create_nfs_server_lan = var.create_nfs_server_lan + create_alb_target_lan = var.create_alb_target_lan + create_nlb_target_lan = var.create_nlb_target_lan + create_nat_lan = var.create_nat_lan + frontend_crossconnect_shared_group_ids = (length(var.crossconnect_shared_group_ids) > 0 && local.create_frontend_crossconnect == true) ? var.crossconnect_shared_group_ids : [] + backend_crossconnect_shared_group_ids = (length(var.crossconnect_shared_group_ids) > 0 && local.create_backend_crossconnect == true) ? var.crossconnect_shared_group_ids : [] + service_crossconnect_shared_group_ids = (length(var.crossconnect_shared_group_ids) > 0 && local.create_frontend_crossconnect == true) ? var.crossconnect_shared_group_ids : [] + routes_map = var.routes_map + create_postgres_lan = var.create_postgres_lan # this saves the service/backend/frontend lans as an object in a list # Example of an object: # > type({"id" = "id", "routes_list" = [{"network" = "10.0.0.0/24", gateway_ip="10.0.0.0"}]}) @@ -34,4 +35,5 @@ locals { lan_postgres = flatten([ for id in ionoscloud_lan.postgres_lan.*.id: { id = id, routes_list = [{}] }]) lan_alb_target = flatten([ for id in ionoscloud_lan.alb_target_lan.*.id: { id = id, routes_list =[{}] }]) lan_nlb_target = flatten([ for id in ionoscloud_lan.nlb_target_lan.*.id: { id = id, routes_list =[{}] }]) + lan_nat = flatten([ for id in ionoscloud_lan.nat_lan.*.id: { id = id, routes_list = [{}] }]) } diff --git a/modules/ionos-datacenter/main.tf b/modules/ionos-datacenter/main.tf index a33151d..e5b0e5d 100644 --- a/modules/ionos-datacenter/main.tf +++ b/modules/ionos-datacenter/main.tf @@ -110,4 +110,11 @@ resource "ionoscloud_lan" "nlb_target_lan" { name = "${var.datacenter_name}-nlb-target-lan" datacenter_id = ionoscloud_datacenter.datacenter.id public = false +} + +resource "ionoscloud_lan" "nat_lan" { + count = local.create_nat_lan ? 1 : 0 + name = "${var.datacenter_name}-nat-lan" + datacenter_id = ionoscloud_datacenter.datacenter.id + public = false } \ No newline at end of file diff --git a/modules/ionos-datacenter/output.tf b/modules/ionos-datacenter/output.tf index 18f56eb..2666b6c 100644 --- a/modules/ionos-datacenter/output.tf +++ b/modules/ionos-datacenter/output.tf @@ -69,4 +69,12 @@ output "nlb_target_lan_id" { output "lan_nlb_target" { value = local.lan_nlb_target +} + +output "nat_lan_id" { + value = join("", ionoscloud_lan.nat_lan.*.id) +} + +output "lan_nat" { + value = local.lan_nat } \ No newline at end of file diff --git a/modules/ionos-datacenter/variables.tf b/modules/ionos-datacenter/variables.tf index 00ad14e..5ab252e 100644 --- a/modules/ionos-datacenter/variables.tf +++ b/modules/ionos-datacenter/variables.tf @@ -95,4 +95,10 @@ variable "create_nlb_target_lan" { type = bool description = "Specifies whether a private target for the Network Load Balancer shall be created." default = false +} + +variable "create_nat_lan" { + type = bool + description = "Specifies whether a private lan to connect NAT shall be created." + default = false } \ No newline at end of file From a26f8f12e58112f41f84447bf14c50342a6dda5a Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Wed, 20 Dec 2023 10:02:59 +0000 Subject: [PATCH 02/17] updated description --- modules/ionos-datacenter/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ionos-datacenter/variables.tf b/modules/ionos-datacenter/variables.tf index 5ab252e..be07972 100644 --- a/modules/ionos-datacenter/variables.tf +++ b/modules/ionos-datacenter/variables.tf @@ -99,6 +99,6 @@ variable "create_nlb_target_lan" { variable "create_nat_lan" { type = bool - description = "Specifies whether a private lan to connect NAT shall be created." + description = "Specifies whether a private lan to connect a NAT gateway shall be created." default = false } \ No newline at end of file From 4b7b4f6170e1a6fa89c5dc4091c0e7c5d9d4cbec Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Wed, 20 Dec 2023 10:40:13 +0000 Subject: [PATCH 03/17] initial creation of terraform files --- modules/ionos-nat-gateway/locals.tf | 0 modules/ionos-nat-gateway/main.tf | 0 modules/ionos-nat-gateway/output.tf | 0 modules/ionos-nat-gateway/variables.tf | 0 modules/ionos-nat-gateway/versions.tf | 8 ++++++++ 5 files changed, 8 insertions(+) create mode 100644 modules/ionos-nat-gateway/locals.tf create mode 100644 modules/ionos-nat-gateway/main.tf create mode 100644 modules/ionos-nat-gateway/output.tf create mode 100644 modules/ionos-nat-gateway/variables.tf create mode 100644 modules/ionos-nat-gateway/versions.tf diff --git a/modules/ionos-nat-gateway/locals.tf b/modules/ionos-nat-gateway/locals.tf new file mode 100644 index 0000000..e69de29 diff --git a/modules/ionos-nat-gateway/main.tf b/modules/ionos-nat-gateway/main.tf new file mode 100644 index 0000000..e69de29 diff --git a/modules/ionos-nat-gateway/output.tf b/modules/ionos-nat-gateway/output.tf new file mode 100644 index 0000000..e69de29 diff --git a/modules/ionos-nat-gateway/variables.tf b/modules/ionos-nat-gateway/variables.tf new file mode 100644 index 0000000..e69de29 diff --git a/modules/ionos-nat-gateway/versions.tf b/modules/ionos-nat-gateway/versions.tf new file mode 100644 index 0000000..4f95fb0 --- /dev/null +++ b/modules/ionos-nat-gateway/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + ionoscloud = { + source = "ionos-cloud/ionoscloud" + version = "6.3.6" + } + } +} From 388afd732d376acffd93af6666d39bb2f8d62bf9 Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Thu, 21 Dec 2023 14:36:47 +0000 Subject: [PATCH 04/17] added NAT gateway and rule --- modules/ionos-nat-gateway/cidr-workaround.tf | 11 ++++++ modules/ionos-nat-gateway/locals.tf | 0 modules/ionos-nat-gateway/main.tf | 19 +++++++++++ modules/ionos-nat-gateway/variables.tf | 35 ++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 modules/ionos-nat-gateway/cidr-workaround.tf delete mode 100644 modules/ionos-nat-gateway/locals.tf diff --git a/modules/ionos-nat-gateway/cidr-workaround.tf b/modules/ionos-nat-gateway/cidr-workaround.tf new file mode 100644 index 0000000..c244c56 --- /dev/null +++ b/modules/ionos-nat-gateway/cidr-workaround.tf @@ -0,0 +1,11 @@ +module "cidr_workaround" { + source = "../../modules/ionos-cidr-workaround" + k8s_cluster_id = var.k8s_cluster_id + lan_id = var.lan_id +} + +locals { + prefix = module.cidr_workaround.prefix + gateway_ip = "${cidrhost(local.prefix, var.gateway_host_num)}" + gateway_subnet = "${cidrhost(local.prefix, 0)}/24" +} \ No newline at end of file diff --git a/modules/ionos-nat-gateway/locals.tf b/modules/ionos-nat-gateway/locals.tf deleted file mode 100644 index e69de29..0000000 diff --git a/modules/ionos-nat-gateway/main.tf b/modules/ionos-nat-gateway/main.tf index e69de29..a8e4a8c 100644 --- a/modules/ionos-nat-gateway/main.tf +++ b/modules/ionos-nat-gateway/main.tf @@ -0,0 +1,19 @@ +resource "ionoscloud_natgateway" "natgateway" { + datacenter_id = var.datacenter_id + name = var.natgateway_name + public_ips = var.natgateway_public_ips + lans { + id = var.lan_id + gateway_ips = [ local.gateway_ip ] + } +} + +resource "ionoscloud_natgateway_rule" "natgateway_rule" { + datacenter_id = var.datacenter_id + natgateway_id = ionoscloud_natgateway.gateway.id + name = var.natgateway_rule_name + type = "SNAT" + protocol = "TCP" + source_subnet = local.gateway_subnet + public_ip = var.natgateway_public_ips[0] +} \ No newline at end of file diff --git a/modules/ionos-nat-gateway/variables.tf b/modules/ionos-nat-gateway/variables.tf index e69de29..0fdcf37 100644 --- a/modules/ionos-nat-gateway/variables.tf +++ b/modules/ionos-nat-gateway/variables.tf @@ -0,0 +1,35 @@ +variable "datacenter_id" { + description = "" + type = string +} + +variable "natgateway_name" { + description = "" + type = string +} + +variable "natgateway_public_ips" { + description = "Specifies the list of public ips of the NAT gateway." + type = list(string) +} + +variable "k8s_cluster_id" { + description = "" + type = string +} + +variable "lan_id" { + description = "The LAN to connect the NAT gateway to." + type = string +} + +variable "gateway_host_num" { + description = "The number to be set in the last ip block. (Default: 8)" + type = number + default = 8 +} + +variable "natgateway_rule_name" { + description = "" + type = string +} \ No newline at end of file From 71542dd2b668b771f0728f944d0ec9a83a3ea6ec Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Fri, 22 Dec 2023 12:42:46 +0000 Subject: [PATCH 05/17] changed var name --- modules/ionos-nat-gateway/cidr-workaround.tf | 2 +- modules/ionos-nat-gateway/variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ionos-nat-gateway/cidr-workaround.tf b/modules/ionos-nat-gateway/cidr-workaround.tf index c244c56..829a963 100644 --- a/modules/ionos-nat-gateway/cidr-workaround.tf +++ b/modules/ionos-nat-gateway/cidr-workaround.tf @@ -6,6 +6,6 @@ module "cidr_workaround" { locals { prefix = module.cidr_workaround.prefix - gateway_ip = "${cidrhost(local.prefix, var.gateway_host_num)}" + gateway_ip = "${cidrhost(local.prefix, var.natgateway_host_num)}" gateway_subnet = "${cidrhost(local.prefix, 0)}/24" } \ No newline at end of file diff --git a/modules/ionos-nat-gateway/variables.tf b/modules/ionos-nat-gateway/variables.tf index 0fdcf37..2c1192c 100644 --- a/modules/ionos-nat-gateway/variables.tf +++ b/modules/ionos-nat-gateway/variables.tf @@ -23,7 +23,7 @@ variable "lan_id" { type = string } -variable "gateway_host_num" { +variable "natgateway_host_num" { description = "The number to be set in the last ip block. (Default: 8)" type = number default = 8 From 59b8314a56123661efa1191ed6fe2b5076e84ee7 Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Fri, 22 Dec 2023 12:43:57 +0000 Subject: [PATCH 06/17] renamed module --- .../{ionos-nat-gateway => ionos-natgateway}/cidr-workaround.tf | 0 modules/{ionos-nat-gateway => ionos-natgateway}/main.tf | 0 modules/{ionos-nat-gateway => ionos-natgateway}/output.tf | 0 modules/{ionos-nat-gateway => ionos-natgateway}/variables.tf | 0 modules/{ionos-nat-gateway => ionos-natgateway}/versions.tf | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename modules/{ionos-nat-gateway => ionos-natgateway}/cidr-workaround.tf (100%) rename modules/{ionos-nat-gateway => ionos-natgateway}/main.tf (100%) rename modules/{ionos-nat-gateway => ionos-natgateway}/output.tf (100%) rename modules/{ionos-nat-gateway => ionos-natgateway}/variables.tf (100%) rename modules/{ionos-nat-gateway => ionos-natgateway}/versions.tf (100%) diff --git a/modules/ionos-nat-gateway/cidr-workaround.tf b/modules/ionos-natgateway/cidr-workaround.tf similarity index 100% rename from modules/ionos-nat-gateway/cidr-workaround.tf rename to modules/ionos-natgateway/cidr-workaround.tf diff --git a/modules/ionos-nat-gateway/main.tf b/modules/ionos-natgateway/main.tf similarity index 100% rename from modules/ionos-nat-gateway/main.tf rename to modules/ionos-natgateway/main.tf diff --git a/modules/ionos-nat-gateway/output.tf b/modules/ionos-natgateway/output.tf similarity index 100% rename from modules/ionos-nat-gateway/output.tf rename to modules/ionos-natgateway/output.tf diff --git a/modules/ionos-nat-gateway/variables.tf b/modules/ionos-natgateway/variables.tf similarity index 100% rename from modules/ionos-nat-gateway/variables.tf rename to modules/ionos-natgateway/variables.tf diff --git a/modules/ionos-nat-gateway/versions.tf b/modules/ionos-natgateway/versions.tf similarity index 100% rename from modules/ionos-nat-gateway/versions.tf rename to modules/ionos-natgateway/versions.tf From 4e571f9e9522a56a5f6d6b9c43baecba707e5c38 Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Fri, 22 Dec 2023 12:56:50 +0000 Subject: [PATCH 07/17] fixed reference --- modules/ionos-natgateway/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ionos-natgateway/main.tf b/modules/ionos-natgateway/main.tf index a8e4a8c..97fe420 100644 --- a/modules/ionos-natgateway/main.tf +++ b/modules/ionos-natgateway/main.tf @@ -10,7 +10,7 @@ resource "ionoscloud_natgateway" "natgateway" { resource "ionoscloud_natgateway_rule" "natgateway_rule" { datacenter_id = var.datacenter_id - natgateway_id = ionoscloud_natgateway.gateway.id + natgateway_id = ionoscloud_natgateway.natgateway.id name = var.natgateway_rule_name type = "SNAT" protocol = "TCP" From 532ae7e6d1273648f7b823629c5b81c694b34bfc Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Wed, 27 Dec 2023 10:11:28 +0000 Subject: [PATCH 08/17] added ipblock creation --- modules/ionos-natgateway/main.tf | 16 +++++++++++++--- modules/ionos-natgateway/output.tf | 7 +++++++ modules/ionos-natgateway/variables.tf | 22 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/modules/ionos-natgateway/main.tf b/modules/ionos-natgateway/main.tf index 97fe420..ebea824 100644 --- a/modules/ionos-natgateway/main.tf +++ b/modules/ionos-natgateway/main.tf @@ -1,7 +1,7 @@ resource "ionoscloud_natgateway" "natgateway" { datacenter_id = var.datacenter_id name = var.natgateway_name - public_ips = var.natgateway_public_ips + public_ips = var.create_ipblock ? ionoscloud_ipblock.natgateway[0].ips : var.natgateway_public_ips lans { id = var.lan_id gateway_ips = [ local.gateway_ip ] @@ -15,5 +15,15 @@ resource "ionoscloud_natgateway_rule" "natgateway_rule" { type = "SNAT" protocol = "TCP" source_subnet = local.gateway_subnet - public_ip = var.natgateway_public_ips[0] -} \ No newline at end of file + public_ip = var.create_ipblock ? ionoscloud_ipblock.natgateway[0].ips[0] : var.natgateway_public_ips[0] +} + +resource "ionoscloud_ipblock" "natgateway" { + count = var.create_ipblock ? 1 : 0 + location = var.datacenter_location + size = var.ipblock_size + name = var.ipblock_name + lifecycle { + prevent_destroy = true + } +} diff --git a/modules/ionos-natgateway/output.tf b/modules/ionos-natgateway/output.tf index e69de29..9b576d1 100644 --- a/modules/ionos-natgateway/output.tf +++ b/modules/ionos-natgateway/output.tf @@ -0,0 +1,7 @@ +output "natgateway_id" { + value = ionoscloud_natgateway.natgateway.id +} + +output "public_ips" { + value = ionoscloud_ipblock.natgateway.ips +} \ No newline at end of file diff --git a/modules/ionos-natgateway/variables.tf b/modules/ionos-natgateway/variables.tf index 2c1192c..edf2484 100644 --- a/modules/ionos-natgateway/variables.tf +++ b/modules/ionos-natgateway/variables.tf @@ -3,6 +3,11 @@ variable "datacenter_id" { type = string } +variable "datacenter_location" { + description = "" + type = string +} + variable "natgateway_name" { description = "" type = string @@ -32,4 +37,21 @@ variable "natgateway_host_num" { variable "natgateway_rule_name" { description = "" type = string +} + +variable "create_ipblock" { + description = "Specifies whether an ipblock should be created. Default: true." + type = bool + default = true +} + +variable "ipblock_name" { + description = "" + type = string +} + +variable "ipblock_size" { + description = "" + type = number + default = 1 } \ No newline at end of file From 590c39755f843b7578c750976e243533264174d2 Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Wed, 27 Dec 2023 10:29:22 +0000 Subject: [PATCH 09/17] ipblock variables with condition --- modules/ionos-natgateway/main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ionos-natgateway/main.tf b/modules/ionos-natgateway/main.tf index ebea824..4d4652d 100644 --- a/modules/ionos-natgateway/main.tf +++ b/modules/ionos-natgateway/main.tf @@ -20,9 +20,9 @@ resource "ionoscloud_natgateway_rule" "natgateway_rule" { resource "ionoscloud_ipblock" "natgateway" { count = var.create_ipblock ? 1 : 0 - location = var.datacenter_location - size = var.ipblock_size - name = var.ipblock_name + location = var.create_ipblock ? var.datacenter_location : null + size = var.create_ipblock ? var.ipblock_size : null + name = var.create_ipblock ? var.ipblock_name : null lifecycle { prevent_destroy = true } From c95bcfa7899fcf9a05939c753197972311a447d7 Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Wed, 27 Dec 2023 10:53:47 +0000 Subject: [PATCH 10/17] make variables optional --- modules/ionos-natgateway/main.tf | 6 +++--- modules/ionos-natgateway/variables.tf | 16 +++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/ionos-natgateway/main.tf b/modules/ionos-natgateway/main.tf index 4d4652d..ebea824 100644 --- a/modules/ionos-natgateway/main.tf +++ b/modules/ionos-natgateway/main.tf @@ -20,9 +20,9 @@ resource "ionoscloud_natgateway_rule" "natgateway_rule" { resource "ionoscloud_ipblock" "natgateway" { count = var.create_ipblock ? 1 : 0 - location = var.create_ipblock ? var.datacenter_location : null - size = var.create_ipblock ? var.ipblock_size : null - name = var.create_ipblock ? var.ipblock_name : null + location = var.datacenter_location + size = var.ipblock_size + name = var.ipblock_name lifecycle { prevent_destroy = true } diff --git a/modules/ionos-natgateway/variables.tf b/modules/ionos-natgateway/variables.tf index edf2484..9aadc07 100644 --- a/modules/ionos-natgateway/variables.tf +++ b/modules/ionos-natgateway/variables.tf @@ -3,11 +3,6 @@ variable "datacenter_id" { type = string } -variable "datacenter_location" { - description = "" - type = string -} - variable "natgateway_name" { description = "" type = string @@ -42,16 +37,23 @@ variable "natgateway_rule_name" { variable "create_ipblock" { description = "Specifies whether an ipblock should be created. Default: true." type = bool - default = true + default = false +} + +variable "datacenter_location" { + description = "" + type = string + default = null } variable "ipblock_name" { description = "" type = string + default = null } variable "ipblock_size" { description = "" type = number - default = 1 + default = null } \ No newline at end of file From b5b913930a493dcf4f5d1f56c40b00a6d4148cf7 Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Wed, 27 Dec 2023 10:55:06 +0000 Subject: [PATCH 11/17] missing instance key --- modules/ionos-natgateway/output.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ionos-natgateway/output.tf b/modules/ionos-natgateway/output.tf index 9b576d1..a54a7d9 100644 --- a/modules/ionos-natgateway/output.tf +++ b/modules/ionos-natgateway/output.tf @@ -3,5 +3,5 @@ output "natgateway_id" { } output "public_ips" { - value = ionoscloud_ipblock.natgateway.ips + value = ionoscloud_ipblock.natgateway[0].ips } \ No newline at end of file From b7f3ce608e030c1e1b689928dcd94632d0152ed5 Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Wed, 27 Dec 2023 10:57:07 +0000 Subject: [PATCH 12/17] changed output to public ips from natgateway --- modules/ionos-natgateway/output.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ionos-natgateway/output.tf b/modules/ionos-natgateway/output.tf index a54a7d9..461e78f 100644 --- a/modules/ionos-natgateway/output.tf +++ b/modules/ionos-natgateway/output.tf @@ -3,5 +3,5 @@ output "natgateway_id" { } output "public_ips" { - value = ionoscloud_ipblock.natgateway[0].ips + value = ionoscloud_natgateway.natgateway.public_ips } \ No newline at end of file From 785e0f1b29ba83a1d0811086c7139fc80b063dc7 Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Wed, 27 Dec 2023 13:16:03 +0000 Subject: [PATCH 13/17] correct description --- modules/ionos-natgateway/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ionos-natgateway/variables.tf b/modules/ionos-natgateway/variables.tf index 9aadc07..69a86be 100644 --- a/modules/ionos-natgateway/variables.tf +++ b/modules/ionos-natgateway/variables.tf @@ -35,7 +35,7 @@ variable "natgateway_rule_name" { } variable "create_ipblock" { - description = "Specifies whether an ipblock should be created. Default: true." + description = "Specifies whether an ipblock should be created. Default: false." type = bool default = false } From 527ad2d30a97186d7c2d8e7a3b920a879949ea0d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 27 Dec 2023 13:25:14 +0000 Subject: [PATCH 14/17] terraform-docs: automated action --- modules/ionos-natgateway/README.md | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 modules/ionos-natgateway/README.md diff --git a/modules/ionos-natgateway/README.md b/modules/ionos-natgateway/README.md new file mode 100644 index 0000000..57cdd59 --- /dev/null +++ b/modules/ionos-natgateway/README.md @@ -0,0 +1,46 @@ + + +## Providers + +| Name | Version | +|------|---------| +| [ionoscloud](#provider\_ionoscloud) | 6.3.6 | +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [cidr\_workaround](#module\_cidr\_workaround) | ../../modules/ionos-cidr-workaround | n/a | +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [datacenter\_id](#input\_datacenter\_id) | n/a | `string` | n/a | yes | +| [k8s\_cluster\_id](#input\_k8s\_cluster\_id) | n/a | `string` | n/a | yes | +| [lan\_id](#input\_lan\_id) | The LAN to connect the NAT gateway to. | `string` | n/a | yes | +| [natgateway\_name](#input\_natgateway\_name) | n/a | `string` | n/a | yes | +| [natgateway\_public\_ips](#input\_natgateway\_public\_ips) | Specifies the list of public ips of the NAT gateway. | `list(string)` | n/a | yes | +| [natgateway\_rule\_name](#input\_natgateway\_rule\_name) | n/a | `string` | n/a | yes | +| [create\_ipblock](#input\_create\_ipblock) | Specifies whether an ipblock should be created. Default: false. | `bool` | `false` | no | +| [datacenter\_location](#input\_datacenter\_location) | n/a | `string` | `null` | no | +| [ipblock\_name](#input\_ipblock\_name) | n/a | `string` | `null` | no | +| [ipblock\_size](#input\_ipblock\_size) | n/a | `number` | `null` | no | +| [natgateway\_host\_num](#input\_natgateway\_host\_num) | The number to be set in the last ip block. (Default: 8) | `number` | `8` | no | +## Outputs + +| Name | Description | +|------|-------------| +| [natgateway\_id](#output\_natgateway\_id) | n/a | +| [public\_ips](#output\_public\_ips) | n/a | +## Requirements + +| Name | Version | +|------|---------| +| [ionoscloud](#requirement\_ionoscloud) | 6.3.6 | +## Resources + +| Name | Type | +|------|------| +| [ionoscloud_ipblock.natgateway](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/ipblock) | resource | +| [ionoscloud_natgateway.natgateway](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/natgateway) | resource | +| [ionoscloud_natgateway_rule.natgateway_rule](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/6.3.6/docs/resources/natgateway_rule) | resource | + \ No newline at end of file From 38886f8540b4f83083f218b6e879856f1358c274 Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Thu, 28 Dec 2023 10:31:35 +0000 Subject: [PATCH 15/17] make public ips optional --- modules/ionos-natgateway/variables.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ionos-natgateway/variables.tf b/modules/ionos-natgateway/variables.tf index 69a86be..779144a 100644 --- a/modules/ionos-natgateway/variables.tf +++ b/modules/ionos-natgateway/variables.tf @@ -11,6 +11,7 @@ variable "natgateway_name" { variable "natgateway_public_ips" { description = "Specifies the list of public ips of the NAT gateway." type = list(string) + default = null } variable "k8s_cluster_id" { From 54f87eca25a41009b47334d3e6aa1917268a6138 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 28 Dec 2023 10:32:57 +0000 Subject: [PATCH 16/17] terraform-docs: automated action --- modules/ionos-natgateway/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ionos-natgateway/README.md b/modules/ionos-natgateway/README.md index 57cdd59..effc581 100644 --- a/modules/ionos-natgateway/README.md +++ b/modules/ionos-natgateway/README.md @@ -18,13 +18,13 @@ | [k8s\_cluster\_id](#input\_k8s\_cluster\_id) | n/a | `string` | n/a | yes | | [lan\_id](#input\_lan\_id) | The LAN to connect the NAT gateway to. | `string` | n/a | yes | | [natgateway\_name](#input\_natgateway\_name) | n/a | `string` | n/a | yes | -| [natgateway\_public\_ips](#input\_natgateway\_public\_ips) | Specifies the list of public ips of the NAT gateway. | `list(string)` | n/a | yes | | [natgateway\_rule\_name](#input\_natgateway\_rule\_name) | n/a | `string` | n/a | yes | | [create\_ipblock](#input\_create\_ipblock) | Specifies whether an ipblock should be created. Default: false. | `bool` | `false` | no | | [datacenter\_location](#input\_datacenter\_location) | n/a | `string` | `null` | no | | [ipblock\_name](#input\_ipblock\_name) | n/a | `string` | `null` | no | | [ipblock\_size](#input\_ipblock\_size) | n/a | `number` | `null` | no | | [natgateway\_host\_num](#input\_natgateway\_host\_num) | The number to be set in the last ip block. (Default: 8) | `number` | `8` | no | +| [natgateway\_public\_ips](#input\_natgateway\_public\_ips) | Specifies the list of public ips of the NAT gateway. | `list(string)` | `null` | no | ## Outputs | Name | Description | From 04e263264600a623f4c2256392a1465fa24afffb Mon Sep 17 00:00:00 2001 From: Maximilian Greve Date: Thu, 28 Dec 2023 10:51:37 +0000 Subject: [PATCH 17/17] renamed module --- modules/{ionos-natgateway => ionos-k8s-natgateway}/README.md | 0 .../{ionos-natgateway => ionos-k8s-natgateway}/cidr-workaround.tf | 0 modules/{ionos-natgateway => ionos-k8s-natgateway}/main.tf | 0 modules/{ionos-natgateway => ionos-k8s-natgateway}/output.tf | 0 modules/{ionos-natgateway => ionos-k8s-natgateway}/variables.tf | 0 modules/{ionos-natgateway => ionos-k8s-natgateway}/versions.tf | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename modules/{ionos-natgateway => ionos-k8s-natgateway}/README.md (100%) rename modules/{ionos-natgateway => ionos-k8s-natgateway}/cidr-workaround.tf (100%) rename modules/{ionos-natgateway => ionos-k8s-natgateway}/main.tf (100%) rename modules/{ionos-natgateway => ionos-k8s-natgateway}/output.tf (100%) rename modules/{ionos-natgateway => ionos-k8s-natgateway}/variables.tf (100%) rename modules/{ionos-natgateway => ionos-k8s-natgateway}/versions.tf (100%) diff --git a/modules/ionos-natgateway/README.md b/modules/ionos-k8s-natgateway/README.md similarity index 100% rename from modules/ionos-natgateway/README.md rename to modules/ionos-k8s-natgateway/README.md diff --git a/modules/ionos-natgateway/cidr-workaround.tf b/modules/ionos-k8s-natgateway/cidr-workaround.tf similarity index 100% rename from modules/ionos-natgateway/cidr-workaround.tf rename to modules/ionos-k8s-natgateway/cidr-workaround.tf diff --git a/modules/ionos-natgateway/main.tf b/modules/ionos-k8s-natgateway/main.tf similarity index 100% rename from modules/ionos-natgateway/main.tf rename to modules/ionos-k8s-natgateway/main.tf diff --git a/modules/ionos-natgateway/output.tf b/modules/ionos-k8s-natgateway/output.tf similarity index 100% rename from modules/ionos-natgateway/output.tf rename to modules/ionos-k8s-natgateway/output.tf diff --git a/modules/ionos-natgateway/variables.tf b/modules/ionos-k8s-natgateway/variables.tf similarity index 100% rename from modules/ionos-natgateway/variables.tf rename to modules/ionos-k8s-natgateway/variables.tf diff --git a/modules/ionos-natgateway/versions.tf b/modules/ionos-k8s-natgateway/versions.tf similarity index 100% rename from modules/ionos-natgateway/versions.tf rename to modules/ionos-k8s-natgateway/versions.tf