Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e79c8b4

Browse files
committed
Allow publicly accessible cluster machines
This allows the public access of cluster machines if the Security Group allows it.
1 parent 846b64f commit e79c8b4

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

ecs-cluster/main.tf

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ variable "desired_capacity" {
8989
default = 3
9090
}
9191

92+
variable "associate_public_ip_address" {
93+
description = "Should created instances be publicly accessible (if the SG allows)"
94+
default = false
95+
}
96+
9297
variable "root_volume_size" {
9398
description = "Root volume size in GB"
9499
default = 25
@@ -165,13 +170,14 @@ resource "template_file" "cloud_config" {
165170
resource "aws_launch_configuration" "main" {
166171
name_prefix = "${format("%s-", var.name)}"
167172

168-
image_id = "${var.image_id}"
169-
instance_type = "${var.instance_type}"
170-
ebs_optimized = "${var.instance_ebs_optimized}"
171-
iam_instance_profile = "${var.iam_instance_profile}"
172-
key_name = "${var.key_name}"
173-
security_groups = ["${aws_security_group.cluster.id}"]
174-
user_data = "${template_file.cloud_config.rendered}"
173+
image_id = "${var.image_id}"
174+
instance_type = "${var.instance_type}"
175+
ebs_optimized = "${var.instance_ebs_optimized}"
176+
iam_instance_profile = "${var.iam_instance_profile}"
177+
key_name = "${var.key_name}"
178+
security_groups = ["${aws_security_group.cluster.id}"]
179+
user_data = "${template_file.cloud_config.rendered}"
180+
associate_public_ip_address = "${var.associate_public_ip_address}"
175181

176182
# root
177183
root_block_device {

0 commit comments

Comments
 (0)