Skip to content

Commit

Permalink
Merge pull request #74 from neiman-marcus/69-add-variable-to-enable-a…
Browse files Browse the repository at this point in the history
…sg-metrics-to-be-published-to-cloudwatch

69 add variable to enable asg metrics to be published to cloudwatch
  • Loading branch information
nmrad-91 authored Jul 7, 2022
2 parents 0d4cb1e + 1cab48f commit e939ff2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions init/master-write-files.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ write_files:
content: |
#!/bin/bash

for i in {1..3};
for i in 1 2 3
do
AGENT_ASG="$(aws autoscaling describe-auto-scaling-groups --region ${aws_region} | jq -r '.AutoScalingGroups[] | select(.AutoScalingGroupName | startswith("${application}-agent")) | .AutoScalingGroupName')"

Expand All @@ -174,7 +174,7 @@ write_files:
content: |
#!/bin/bash

for i in {1..3};
for i in 1 2 3
do
AGENT_ASG="$(aws autoscaling describe-auto-scaling-groups --region ${aws_region} | jq -r '.AutoScalingGroups[] | select(.AutoScalingGroupName | startswith("${application}-agent")) | .AutoScalingGroupName')"

Expand Down
3 changes: 3 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ resource "aws_autoscaling_group" "agent_asg" {
health_check_type = "EC2"
name = "${var.application}-agent-asg"
default_cooldown = var.asg_default_cooldown
enabled_metrics = var.agent_enabled_metrics

vpc_zone_identifier = data.aws_subnet_ids.private.ids

Expand Down Expand Up @@ -468,6 +469,8 @@ resource "aws_autoscaling_group" "master_asg" {

name = "${var.application}-master-asg"

enabled_metrics = var.master_enabled_metrics

vpc_zone_identifier = data.aws_subnet_ids.private.ids

target_group_arns = [aws_lb_target_group.master_tg.arn]
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,15 @@ variable "asg_default_cooldown" {
type = number
default = 500
}

variable "agent_enabled_metrics" {
description = "A list of metrics to collect for each agent"
type = list(any)
default = []
}

variable "master_enabled_metrics" {
description = "A list of metrics to collect for the master"
type = list(any)
default = []
}

0 comments on commit e939ff2

Please sign in to comment.