From 0c022bf315d4b46f944116ce394eb5fc8fb72355 Mon Sep 17 00:00:00 2001 From: Marvin Bertram Date: Tue, 1 Oct 2024 14:14:34 +0200 Subject: [PATCH] Add suffix for natgw naming --- .spacelift/config.yml | 2 +- main.tf | 5 +++-- variables.tf | 6 ++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.spacelift/config.yml b/.spacelift/config.yml index ebdc40f05..8ec282938 100644 --- a/.spacelift/config.yml +++ b/.spacelift/config.yml @@ -1,4 +1,4 @@ version: 1 -module_version: 0.3.4 +module_version: 0.3.5 diff --git a/main.tf b/main.tf index 70fa5d7c4..e098a2e0e 100644 --- a/main.tf +++ b/main.tf @@ -1135,10 +1135,11 @@ resource "aws_nat_gateway" "this" { tags = merge( { "Name" = format( - "${var.name_prefix}-${var.short_aws_region}%s-natgw", + "${var.name_prefix}-${var.short_aws_region}%s-natgw-%s", substr(element(var.azs, var.single_nat_gateway ? 0 : count.index), length(element(var.azs, var.single_nat_gateway ? 0 : count.index)) - 1, 1 - ) + ), + var.nat_gateway_suffix ) }, var.tags, diff --git a/variables.tf b/variables.tf index e82156f41..453578a24 100644 --- a/variables.tf +++ b/variables.tf @@ -1263,6 +1263,12 @@ variable "enable_tgw_nat_gateway" { default = false } +variable "nat_gateway_suffix" { + description = "Suffix to append to AWS NAT gateway name" + type = string + default = "main" +} + ################################################################################ # Customer Gateways ################################################################################