From c92226cba587d91c6f1050a556a96d0ed23314da Mon Sep 17 00:00:00 2001 From: Konstantinos Angelopoulos Date: Fri, 25 Feb 2022 09:31:56 +0100 Subject: [PATCH] fix printing tf template with multiple ip addresses --- pkg/internal/infrastructure/templates/main.tpl.tf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/internal/infrastructure/templates/main.tpl.tf b/pkg/internal/infrastructure/templates/main.tpl.tf index edb9e35a8..cf35b6e27 100644 --- a/pkg/internal/infrastructure/templates/main.tpl.tf +++ b/pkg/internal/infrastructure/templates/main.tpl.tf @@ -134,7 +134,7 @@ resource "azurerm_subnet_nat_gateway_association" "{{ $natName }}-worker-subnet- #=============================================== #= NAT Gateway User provided IP #=============================================== -{{ range $ipIndex, $ip := .natGateway.ipAddresses -}} +{{ range $ipIndex, $ip := .natGateway.ipAddresses }} data "azurerm_public_ip" "{{ $natName }}-ip-user-provided-{{ $ipIndex }}" { name = "{{ $ip.name }}" resource_group_name = "{{ $ip.resourceGroup }}" @@ -144,8 +144,7 @@ resource "azurerm_nat_gateway_public_ip_association" "{{ $natName }}-ip-user-pro nat_gateway_id = azurerm_nat_gateway.{{ $natName }}.id public_ip_address_id = data.azurerm_public_ip.{{ $natName }}-ip-user-provided-{{ $ipIndex }}.id } - -{{- end }} +{{ end }} {{- else -}} #=============================================== #= NAT Gateway managed IP