Skip to content

Commit 0353b26

Browse files
committed
Make associate public IP dependent on EIP assignment
1 parent c91ce82 commit 0353b26

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ resource "aws_launch_configuration" "wireguard_launch_config" {
5353
iam_instance_profile = (var.eip_id != "disabled" ? aws_iam_instance_profile.wireguard_profile[0].name : null)
5454
user_data = data.template_file.user_data.rendered
5555
security_groups = local.security_groups_ids
56-
associate_public_ip_address = var.associate_public_ip_address
56+
associate_public_ip_address = (var.eip_id != "disabled" ? true : false)
5757

5858
lifecycle {
5959
create_before_destroy = true

variables.tf

-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ variable "eip_id" {
5656
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."
5757
}
5858

59-
variable "associate_public_ip_address" {
60-
default = true
61-
description = "get a public address or not, use with eip, but set false if the vpn server sits on a private net behidn elb"
62-
}
63-
6459
variable "additional_security_group_ids" {
6560
type = list(string)
6661
default = [""]

0 commit comments

Comments
 (0)