Skip to content

Commit

Permalink
Add variable for enabling auto scale group metrics (#11)
Browse files Browse the repository at this point in the history
* Add "enabled_metrics" proprety to asg resource

* Add new metrics array variable for asg

* Add description.

* README update

* Update Readme.md
  • Loading branch information
dggriffin authored and TerribleDev committed Jul 10, 2017
1 parent b7744e5 commit 5fc3e27
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ module "ecs" {
cluster_cpu_scale_out = 70
# scale cluster in on cpu %
cluster_cpu_scale_in = 20
# list of instance metrics we'd like to enable, defaults to empty array
asg_metrics = ["GroupTerminatingInstances", "GroupMaxSize", "GroupDesiredCapacity", "GroupPendingInstances", "GroupInServiceInstances", "GroupMinSize", "GroupTotalInstances"]
}
# This registers a "service" (a set of containers) in the cluster made above with the image tag specified.
Expand Down
1 change: 1 addition & 0 deletions tf_ecs_cluster/asg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ resource "aws_autoscaling_group" "app" {
launch_configuration = "${aws_launch_configuration.app.name}"
termination_policies = ["OldestLaunchConfiguration", "OldestInstance"]
depends_on = ["aws_launch_configuration.app"]
enabled_metrics = "${var.asg_metrics}"

/*
in 0.9.3 deletes are not handled properly when lc, and asg's have create before destroy
Expand Down
5 changes: 5 additions & 0 deletions tf_ecs_cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ variable "cluster_cpu_scale_out" {
variable "cluster_cpu_scale_in" {
default = 20
}

variable "asg_metrics" {
description = "The list of metrics to enable for this auto scale group."
default = []
}

0 comments on commit 5fc3e27

Please sign in to comment.