Skip to content

Commit

Permalink
Allow each instance to have a public IP assigned via LC. (#5)
Browse files Browse the repository at this point in the history
* Removed some commented out code.

* Allow each instance to have a public IP assigned to it (off by default).

* Updated README
  • Loading branch information
jasiek authored and tfhartmann committed Jul 10, 2017
1 parent 92def7a commit 3903090
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Module Input Variables
- `region` - AWS Region - defaults to us-east-1
- `servers` - Number of ECS Servers to start in the cluster - defaults to 2
- `instance_type` - AWS instance type - defaults to t2.micro
- `associate_public_ip_address` - assign a publicly-routable IP address to every instance in the cluster - default: `false`.
- `docker_storage_size` - EBS Volume size in Gib that the ECS Instance uses for Docker images and metadata - defaults to 22
- `dockerhub_email` - Email Address used to authenticate to dockerhub. http://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html

- `dockerhub_token` - Auth Token used for dockerhub. http://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html
- `extra_tags` - Additional tags to be added to the ECS autoscaling group. Must be in the form of an array of hashes. See https://www.terraform.io/docs/providers/aws/r/autoscaling_group.html for examples.
```
Expand Down
3 changes: 1 addition & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ data "aws_ami" "ecs_ami" {
}

resource "aws_launch_configuration" "ecs" {
#name = "ecs-${var.name}"
name_prefix = "ecs-${var.name}-"
image_id = "${var.ami == "" ? format("%s", data.aws_ami.ecs_ami.id) : var.ami}" # Workaround until 0.9.6
instance_type = "${var.instance_type}"
key_name = "${var.key_name}"
iam_instance_profile = "${aws_iam_instance_profile.ecs_profile.name}"
security_groups = ["${aws_security_group.ecs.id}"]
associate_public_ip_address = "${var.associate_public_ip_address}"
ebs_block_device {
device_name = "/dev/xvdcz"
volume_size = "${var.docker_storage_size}"
Expand All @@ -40,7 +40,6 @@ EOF
}

resource "aws_autoscaling_group" "ecs" {
#name = "ecs-asg-${var.name}"
name = "asg-${aws_launch_configuration.ecs.name}"
vpc_zone_identifier = ["${var.subnet_id}"]
launch_configuration = "${aws_launch_configuration.ecs.name}"
Expand Down
4 changes: 4 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ variable "tagName" {
variable "vpc_id" {
description = "The AWS VPC ID which you want to deploy your instances"
}

variable "associate_public_ip_address" {
default = false
}

0 comments on commit 3903090

Please sign in to comment.