From 0ab2522ba3f5cb865bce8c8b7e494558eec5b85c Mon Sep 17 00:00:00 2001 From: Titouan-Joseph CICORELLA Date: Fri, 6 Sep 2024 11:58:14 +0000 Subject: [PATCH] fix: inversed condition for mgmt public / private IP --- main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index e9e8635..fc40cfb 100644 --- a/main.tf +++ b/main.tf @@ -22,9 +22,9 @@ resource "random_string" "dynamic_password" { # #This resource is for static primary and secondary private ips resource "aws_network_interface" "mgmt" { - count = length(compact(local.mgmt_public_private_ip_primary)) > 0 ? length(local.bigip_map["mgmt_subnet_ids"]) : 0 + count = length(compact(local.mgmt_public_private_ip_primary)) > 0 ? 0 : length(local.bigip_map["mgmt_subnet_ids"]) subnet_id = local.bigip_map["mgmt_subnet_ids"][count.index]["subnet_id"] - private_ips = [local.mgmt_public_private_ip_primary[count.index]] + private_ips = [local.mgmt_private_ip_primary[count.index]] security_groups = var.mgmt_securitygroup_ids tags = merge(local.tags, { Name = format("%s-%d", "BIGIP-Managemt-Interface", count.index) @@ -34,7 +34,7 @@ resource "aws_network_interface" "mgmt" { #This resource is for dynamic primary and secondary private ips resource "aws_network_interface" "mgmt1" { - count = length(compact(local.mgmt_public_private_ip_primary)) > 0 ? 0 : length(local.bigip_map["mgmt_subnet_ids"]) + count = length(compact(local.mgmt_public_private_ip_primary)) > 0 ? length(local.bigip_map["mgmt_subnet_ids"]) : 0 subnet_id = local.bigip_map["mgmt_subnet_ids"][count.index]["subnet_id"] security_groups = var.mgmt_securitygroup_ids private_ips_count = 0 @@ -49,7 +49,7 @@ resource "aws_network_interface" "mgmt1" { # resource "aws_eip" "mgmt" { count = length(local.mgmt_public_subnet_id) > 0 ? (length(local.bigip_map["mgmt_subnet_ids"])) : 0 - network_interface = length(compact(local.mgmt_public_private_ip_primary)) > 0 ? aws_network_interface.mgmt[count.index].id : aws_network_interface.mgmt1[count.index].id + network_interface = length(compact(local.mgmt_public_private_ip_primary)) > 0 ? aws_network_interface.mgmt1[count.index].id : aws_network_interface.mgmt[count.index].id domain = "vpc" tags = merge(local.tags, { Name = format("%s-%d", "BIGIP-Managemt-PublicIp", count.index)