From 21081f41db91a64cb03192894fb63842b11355da Mon Sep 17 00:00:00 2001 From: maxi418 <144135803+maxi418@users.noreply.github.com> Date: Wed, 10 Jan 2024 11:49:45 +0100 Subject: [PATCH] Dbp 495 added variable for rule protocol (#22) * added variable for rule protocol * terraform-docs: automated action --------- Co-authored-by: github-actions[bot] --- modules/ionos-k8s-natgateway/README.md | 3 ++- modules/ionos-k8s-natgateway/main.tf | 2 +- modules/ionos-k8s-natgateway/variables.tf | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/ionos-k8s-natgateway/README.md b/modules/ionos-k8s-natgateway/README.md index effc581..bb15daa 100644 --- a/modules/ionos-k8s-natgateway/README.md +++ b/modules/ionos-k8s-natgateway/README.md @@ -23,8 +23,9 @@ | [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\_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 | +| [natgateway\_rule\_protocol](#input\_natgateway\_rule\_protocol) | Specifies the protocol of the NAT gateway rule. Default: ALL. | `string` | `"ALL"` | no | ## Outputs | Name | Description | diff --git a/modules/ionos-k8s-natgateway/main.tf b/modules/ionos-k8s-natgateway/main.tf index ebea824..560d832 100644 --- a/modules/ionos-k8s-natgateway/main.tf +++ b/modules/ionos-k8s-natgateway/main.tf @@ -13,7 +13,7 @@ resource "ionoscloud_natgateway_rule" "natgateway_rule" { natgateway_id = ionoscloud_natgateway.natgateway.id name = var.natgateway_rule_name type = "SNAT" - protocol = "TCP" + protocol = var.natgateway_rule_protocol source_subnet = local.gateway_subnet public_ip = var.create_ipblock ? ionoscloud_ipblock.natgateway[0].ips[0] : var.natgateway_public_ips[0] } diff --git a/modules/ionos-k8s-natgateway/variables.tf b/modules/ionos-k8s-natgateway/variables.tf index 779144a..fdc3b57 100644 --- a/modules/ionos-k8s-natgateway/variables.tf +++ b/modules/ionos-k8s-natgateway/variables.tf @@ -25,7 +25,7 @@ variable "lan_id" { } variable "natgateway_host_num" { - description = "The number to be set in the last ip block. (Default: 8)" + description = "The number to be set in the last ip block. Default: 8." type = number default = 8 } @@ -35,6 +35,12 @@ variable "natgateway_rule_name" { type = string } +variable "natgateway_rule_protocol" { + description = "Specifies the protocol of the NAT gateway rule. Default: ALL." + type = string + default = "ALL" +} + variable "create_ipblock" { description = "Specifies whether an ipblock should be created. Default: false." type = bool