File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ resource "aws_instance" "bootstrap" {
161161 subnet_id = var. aws_publish_strategy == " External" ? var. public_subnet_ids [0 ] : var. private_subnet_ids [0 ]
162162 user_data = var. aws_bootstrap_stub_ignition
163163 vpc_security_group_ids = [var . master_sg_id , aws_security_group . bootstrap . id ]
164- associate_public_ip_address = local. public_endpoints
164+ associate_public_ip_address = local. public_endpoints && var . aws_public_ipv4_pool == " "
165165
166166 lifecycle {
167167 # Ignore changes in the AMI which force recreation of the resource. This
@@ -251,9 +251,17 @@ resource "aws_security_group_rule" "bootstrap_journald_gateway" {
251251}
252252
253253resource "aws_eip" "bootstrap" {
254+ count = var. aws_public_ipv4_pool == " " ? 0 : 1
254255 domain = " vpc"
255256 instance = aws_instance. bootstrap . id
256- public_ipv4_pool = var. aws_public_ipv4_pool == " " ? null : var. aws_public_ipv4_pool
257+ public_ipv4_pool = var. aws_public_ipv4_pool
258+
259+ tags = merge (
260+ {
261+ " Name" = " ${ var . cluster_id } -bootstrap-eip"
262+ },
263+ local. tags ,
264+ )
257265
258266 depends_on = [aws_instance . bootstrap ]
259- }
267+ }
Original file line number Diff line number Diff line change 11output "bootstrap_ip" {
2- value = local. public_endpoints ? aws_instance. bootstrap . public_ip : aws_instance. bootstrap . private_ip
2+ value = var . aws_public_ipv4_pool != " " ? aws_eip . bootstrap [ 0 ] . public_ip : local. public_endpoints ? aws_instance. bootstrap . public_ip : aws_instance. bootstrap . private_ip
33}
You can’t perform that action at this time.
0 commit comments