Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow to use fixed mgmt IPs #63

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 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 Expand Up @@ -203,7 +203,7 @@ resource "aws_instance" "f5_bigip" {

# set the mgmt interface
dynamic "network_interface" {
for_each = length(compact(local.mgmt_public_private_ip_primary)) > 0 ? [aws_network_interface.mgmt[0].id] : [aws_network_interface.mgmt1[0].id]
for_each = length(compact(local.mgmt_public_private_ip_primary)) > 0 ? [aws_network_interface.mgmt1[0].id] : [aws_network_interface.mgmt[0].id]
content {
network_interface_id = network_interface.value
device_index = 0
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ variable "ebs_volume_size" {
variable "ebs_volume_type" {
description = "The EBS volume type to use for the root volume"
type = string
default = "gp2"
default = "gp3"
}

variable "enable_imdsv2" {
Expand Down