Skip to content

Commit

Permalink
fix: inversed condition for mgmt public / private IP
Browse files Browse the repository at this point in the history
  • Loading branch information
Titouan-Joseph CICORELLA committed Sep 6, 2024
1 parent d21e8f1 commit 0ab2522
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 0ab2522

Please sign in to comment.