Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit fa52cd5

Browse files
committed
Specify VPC scope for EIP in single-node-asg
1 parent 4b27c5e commit fa52cd5

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

modules/single-node-asg/main.tf

+10-11
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ module "service-data" {
5454

5555
resource "aws_eip" "eip" {
5656
count = var.assign_eip ? 1 : 0
57+
vpc = true
5758
}
5859

5960
resource "aws_iam_role_policy_attachment" "associate_eip" {
@@ -81,17 +82,17 @@ data "aws_iam_policy_document" "associate_eip_policy_doc" {
8182
module "server" {
8283
source = "../asg"
8384

84-
ami = var.ami
85-
elb_names = var.load_balancers
86-
key_name = var.key_name
85+
ami = var.ami
86+
elb_names = var.load_balancers
87+
key_name = var.key_name
8788
# The IAM Instance Profile w/ attach_ebs role
88-
iam_profile = module.instance_profile.iam_profile_id
89-
instance_type = var.instance_type
89+
iam_profile = module.instance_profile.iam_profile_id
90+
instance_type = var.instance_type
9091
# 1 EC2 instance <> 1 EBS volume
91-
max_nodes = 1
92-
min_nodes = 1
93-
placement_group = var.placement_group
94-
public_ip = var.public_ip
92+
max_nodes = 1
93+
min_nodes = 1
94+
placement_group = var.placement_group
95+
public_ip = var.assign_eip ? false : var.public_ip
9596
# the prefix and suffix names are combined in
9697
# the `asg` module to create the full name
9798
name_prefix = var.name_prefix
@@ -130,5 +131,3 @@ module "init-attach-ebs" {
130131
module "init-install-awscli" {
131132
source = "../init-snippet-install-awscli"
132133
}
133-
134-

0 commit comments

Comments
 (0)