From 0353b261007782bf67b824eb933fb979d475a5ff Mon Sep 17 00:00:00 2001 From: James Hale Date: Sun, 13 Oct 2019 18:10:07 -0400 Subject: [PATCH] Make associate public IP dependent on EIP assignment --- main.tf | 2 +- variables.tf | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/main.tf b/main.tf index b8a27ab..e24e1ed 100644 --- a/main.tf +++ b/main.tf @@ -53,7 +53,7 @@ resource "aws_launch_configuration" "wireguard_launch_config" { iam_instance_profile = (var.eip_id != "disabled" ? aws_iam_instance_profile.wireguard_profile[0].name : null) user_data = data.template_file.user_data.rendered security_groups = local.security_groups_ids - associate_public_ip_address = var.associate_public_ip_address + associate_public_ip_address = (var.eip_id != "disabled" ? true : false) lifecycle { create_before_destroy = true diff --git a/variables.tf b/variables.tf index bed2e7b..3e0f867 100644 --- a/variables.tf +++ b/variables.tf @@ -56,11 +56,6 @@ variable "eip_id" { description = "If we detect the default 'disabled' we avoid the EIP switching code in user-data on wg server startup, if an EIP ID is provided the instance will attempt to switch EIP." } -variable "associate_public_ip_address" { - default = true - description = "get a public address or not, use with eip, but set false if the vpn server sits on a private net behidn elb" -} - variable "additional_security_group_ids" { type = list(string) default = [""]