Skip to content

Commit

Permalink
Add min_servers and max_servers variables. (#19)
Browse files Browse the repository at this point in the history
* Add min/max variables.

* Updated docs.

* Fix formatting.
  • Loading branch information
joestump authored and tfhartmann committed Sep 7, 2017
1 parent 3aa1e74 commit 906a292
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ Module Input Variables
- `vpc_id` - The VPC ID to place the cluster in

#### Optional
note about `user_data` and - `additional_user_data_script`: The `user_data` parameter overwrites the user_data template used by this module, this will break some of the module features. (`docker_storage_size`, `dockerhub_token`, and `dockerhub_email`) `additional_user_data_script` however will concatenate additional data to the end of the current user_data script. It is recomended that you use `additional_user_data_script`. These two parameters are mutually exclusive - you can not pass both into this module and expect it to work.

- `additional_user_data_script` - Additional user_data scripts content
**NOTE About User Data:** The `user_data` parameter overwrites the `user_data` template used by this module, this will break some of the module features (e.g. `docker_storage_size`, `dockerhub_token`, and `dockerhub_email`). However, `additional_user_data_script` will concatenate additional data to the end of the current `user_data` script. It is recomended that you use `additional_user_data_script`. These two parameters are mutually exclusive - you can not pass both into this module and expect it to work.

- `additional_user_data_script` - Additional `user_data` scripts content
- `region` - AWS Region - defaults to us-east-1
- `servers` - Number of ECS Servers to start in the cluster - defaults to 2
- `servers` - Number of ECS Servers to start in the cluster - defaults to 1
- `min_servers` - Minimum number of ECS Servers to start in the cluster - defaults to 1
- `max_servers` - Maximum number of ECS Servers to start in the cluster - defaults to 10
- `instance_type` - AWS instance type - defaults to t2.micro
- `iam_path` - IAM path, this is useful when creating resources with the same name across multiple regions. Defaults to /
- `associate_public_ip_address` - assign a publicly-routable IP address to every instance in the cluster - default: `false`.
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ resource "aws_autoscaling_group" "ecs" {
name = "asg-${aws_launch_configuration.ecs.name}"
vpc_zone_identifier = ["${var.subnet_id}"]
launch_configuration = "${aws_launch_configuration.ecs.name}"
min_size = 1
max_size = 10
min_size = "${var.min_servers}"
max_size = "${var.max_servers}"
desired_capacity = "${var.servers}"
termination_policies = ["OldestLaunchConfiguration", "ClosestToNextInstanceHour", "Default"]

Expand Down
10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ variable "key_name" {
description = "SSH key name in your AWS account for AWS instances."
}

variable "min_servers" {
description = "Minimum number of ECS servers to run."
default = 1
}

variable "max_servers" {
description = "Maximum number of ECS servers to run."
default = 10
}

variable "name" {
description = "AWS ECS Cluster Name"
}
Expand Down

0 comments on commit 906a292

Please sign in to comment.