Skip to content

Commit

Permalink
Merge pull request #35 from steve-stonehouse/sstonehouse/0.12
Browse files Browse the repository at this point in the history
Adding Terraform 0.12 support.
  • Loading branch information
andypoole authored Jun 27, 2019
2 parents 1fdaffd + 3aa8829 commit 2f63629
Show file tree
Hide file tree
Showing 12 changed files with 354 additions and 496 deletions.
237 changes: 123 additions & 114 deletions README.md

Large diffs are not rendered by default.

91 changes: 46 additions & 45 deletions alarms.tf
Original file line number Diff line number Diff line change
@@ -1,99 +1,100 @@
resource "aws_cloudwatch_metric_alarm" "alarm_rds_DatabaseConnections_writer" {
count = "${var.enabled && var.cw_alarms ? 1 : 0}"
alarm_name = "${aws_rds_cluster.default.id}-alarm-rds-writer-DatabaseConnections"
count = var.enabled && var.cw_alarms ? 1 : 0
alarm_name = "${aws_rds_cluster.default[0].id}-alarm-rds-writer-DatabaseConnections"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "${var.cw_eval_period_connections}"
evaluation_periods = var.cw_eval_period_connections
metric_name = "DatabaseConnections"
namespace = "AWS/RDS"
period = "60"
statistic = "Sum"
threshold = "${var.cw_max_conns}"
alarm_description = "RDS Maximum connection Alarm for ${aws_rds_cluster.default.id} writer"
alarm_actions = ["${var.cw_sns_topic}"]
ok_actions = ["${var.cw_sns_topic}"]
threshold = var.cw_max_conns
alarm_description = "RDS Maximum connection Alarm for ${aws_rds_cluster.default[0].id} writer"
alarm_actions = [var.cw_sns_topic]
ok_actions = [var.cw_sns_topic]

dimensions {
DBClusterIdentifier = "${aws_rds_cluster.default.id}"
dimensions = {
DBClusterIdentifier = aws_rds_cluster.default[0].id
Role = "WRITER"
}
}

resource "aws_cloudwatch_metric_alarm" "alarm_rds_DatabaseConnections_reader" {
count = "${var.enabled && var.cw_alarms && var.replica_count > 0 ? 1 : 0}"
alarm_name = "${aws_rds_cluster.default.id}-alarm-rds-reader-DatabaseConnections"
count = var.enabled && var.cw_alarms && var.replica_count > 0 ? 1 : 0
alarm_name = "${aws_rds_cluster.default[0].id}-alarm-rds-reader-DatabaseConnections"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "${var.cw_eval_period_connections}"
evaluation_periods = var.cw_eval_period_connections
metric_name = "DatabaseConnections"
namespace = "AWS/RDS"
period = "60"
statistic = "Maximum"
threshold = "${var.cw_max_conns}"
alarm_description = "RDS Maximum connection Alarm for ${aws_rds_cluster.default.id} reader(s)"
alarm_actions = ["${var.cw_sns_topic}"]
ok_actions = ["${var.cw_sns_topic}"]
threshold = var.cw_max_conns
alarm_description = "RDS Maximum connection Alarm for ${aws_rds_cluster.default[0].id} reader(s)"
alarm_actions = [var.cw_sns_topic]
ok_actions = [var.cw_sns_topic]

dimensions {
DBClusterIdentifier = "${aws_rds_cluster.default.id}"
dimensions = {
DBClusterIdentifier = aws_rds_cluster.default[0].id
Role = "READER"
}
}

resource "aws_cloudwatch_metric_alarm" "alarm_rds_CPU_writer" {
count = "${var.enabled && var.cw_alarms ? 1 : 0}"
alarm_name = "${aws_rds_cluster.default.id}-alarm-rds-writer-CPU"
count = var.enabled && var.cw_alarms ? 1 : 0
alarm_name = "${aws_rds_cluster.default[0].id}-alarm-rds-writer-CPU"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "${var.cw_eval_period_cpu}"
evaluation_periods = var.cw_eval_period_cpu
metric_name = "CPUUtilization"
namespace = "AWS/RDS"
period = "60"
statistic = "Maximum"
threshold = "${var.cw_max_cpu}"
alarm_description = "RDS CPU Alarm for ${aws_rds_cluster.default.id} writer"
alarm_actions = ["${var.cw_sns_topic}"]
ok_actions = ["${var.cw_sns_topic}"]
threshold = var.cw_max_cpu
alarm_description = "RDS CPU Alarm for ${aws_rds_cluster.default[0].id} writer"
alarm_actions = [var.cw_sns_topic]
ok_actions = [var.cw_sns_topic]

dimensions {
DBClusterIdentifier = "${aws_rds_cluster.default.id}"
dimensions = {
DBClusterIdentifier = aws_rds_cluster.default[0].id
Role = "WRITER"
}
}

resource "aws_cloudwatch_metric_alarm" "alarm_rds_CPU_reader" {
count = "${var.enabled && var.cw_alarms && var.replica_count > 0 ? 1 : 0}"
alarm_name = "${aws_rds_cluster.default.id}-alarm-rds-reader-CPU"
count = var.enabled && var.cw_alarms && var.replica_count > 0 ? 1 : 0
alarm_name = "${aws_rds_cluster.default[0].id}-alarm-rds-reader-CPU"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "${var.cw_eval_period_cpu}"
evaluation_periods = var.cw_eval_period_cpu
metric_name = "CPUUtilization"
namespace = "AWS/RDS"
period = "60"
statistic = "Maximum"
threshold = "${var.cw_max_cpu}"
alarm_description = "RDS CPU Alarm for ${aws_rds_cluster.default.id} reader(s)"
alarm_actions = ["${var.cw_sns_topic}"]
ok_actions = ["${var.cw_sns_topic}"]
threshold = var.cw_max_cpu
alarm_description = "RDS CPU Alarm for ${aws_rds_cluster.default[0].id} reader(s)"
alarm_actions = [var.cw_sns_topic]
ok_actions = [var.cw_sns_topic]

dimensions {
DBClusterIdentifier = "${aws_rds_cluster.default.id}"
dimensions = {
DBClusterIdentifier = aws_rds_cluster.default[0].id
Role = "READER"
}
}

resource "aws_cloudwatch_metric_alarm" "alarm_rds_replica_lag" {
count = "${var.enabled && var.cw_alarms && var.replica_count > 0 ? 1 : 0}"
alarm_name = "${aws_rds_cluster.default.id}-alarm-rds-reader-AuroraReplicaLag"
count = var.enabled && var.cw_alarms && var.replica_count > 0 ? 1 : 0
alarm_name = "${aws_rds_cluster.default[0].id}-alarm-rds-reader-AuroraReplicaLag"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "${var.cw_eval_period_replica_lag}"
evaluation_periods = var.cw_eval_period_replica_lag
metric_name = "AuroraReplicaLag"
namespace = "AWS/RDS"
period = "60"
statistic = "Maximum"
threshold = "${var.cw_max_replica_lag}"
alarm_description = "RDS CPU Alarm for ${aws_rds_cluster.default.id}"
alarm_actions = ["${var.cw_sns_topic}"]
ok_actions = ["${var.cw_sns_topic}"]
threshold = var.cw_max_replica_lag
alarm_description = "RDS CPU Alarm for ${aws_rds_cluster.default[0].id}"
alarm_actions = [var.cw_sns_topic]
ok_actions = [var.cw_sns_topic]

dimensions {
DBClusterIdentifier = "${aws_rds_cluster.default.id}"
dimensions = {
DBClusterIdentifier = aws_rds_cluster.default[0].id
Role = "READER"
}
}

Loading

0 comments on commit 2f63629

Please sign in to comment.