UPD: get sns targets from root module variable

This commit is contained in:
xpk 2022-11-10 11:16:24 +08:00
parent bc995f7ac8
commit a348848966
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
18 changed files with 65 additions and 199 deletions

View File

@ -18,8 +18,8 @@ resource "aws_cloudwatch_metric_alarm" "alb-HealthyHostCount" {
namespace = "AWS/ApplicationELB" namespace = "AWS/ApplicationELB"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-emergency] alarm_actions = [var.sns-targets.alarm-actions-emergency]
ok_actions = [var.alarm-actions-emergency] ok_actions = [var.sns-targets.alarm-actions-emergency]
dimensions = { dimensions = {
TargetGroup = "targetgroup/${split("/", each.value)[1]}/${split("/", each.value)[2]}" TargetGroup = "targetgroup/${split("/", each.value)[1]}/${split("/", each.value)[2]}"
LoadBalancer = "app/${split("/", var.load-balancer)[2]}/${split("/", var.load-balancer)[3]}" LoadBalancer = "app/${split("/", var.load-balancer)[2]}/${split("/", var.load-balancer)[3]}"

View File

@ -2,20 +2,5 @@ variable cw-alarm-prefix {}
variable actions-enabled {} variable actions-enabled {}
variable load-balancer {} variable load-balancer {}
variable threshold-HealthHostCountMin {} variable threshold-HealthHostCountMin {}
variable alarm-actions-urgent { variable sns-targets {}
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-urgent"
}
variable alarm-actions-emergency {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-emergency"
}
variable alarm-actions-standard {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-standard"
}
variable alarm-actions-general {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support"
}
variable default-tags {} variable default-tags {}

View File

@ -10,8 +10,8 @@ resource "aws_cloudwatch_metric_alarm" "asg-CPUUtilization" {
namespace = "AWS/EC2" namespace = "AWS/EC2"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
AutoScalingGroupName = var.asg-name AutoScalingGroupName = var.asg-name
} }

View File

@ -1,22 +1,7 @@
variable cw-alarm-prefix {} variable cw-alarm-prefix {}
variable actions-enabled {} variable actions-enabled {}
variable asg-name {} variable asg-name {}
variable alarm-actions-urgent { variable sns-targets {}
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-urgent"
}
variable alarm-actions-emergency {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-emergency"
}
variable alarm-actions-standard {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-standard"
}
variable alarm-actions-general {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support"
}
variable default-tags {} variable default-tags {}
variable threshold-CPUUtilization {} variable threshold-CPUUtilization {}

View File

@ -10,8 +10,8 @@ resource "aws_cloudwatch_metric_alarm" "ec2-StatusCheckFailed_System" {
namespace = "AWS/EC2" namespace = "AWS/EC2"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-emergency] alarm_actions = [var.sns-targets.alarm-actions-emergency]
ok_actions = [var.alarm-actions-emergency] ok_actions = [var.sns-targets.alarm-actions-emergency]
dimensions = { dimensions = {
InstanceId = var.ec2-instance-id InstanceId = var.ec2-instance-id
} }
@ -33,8 +33,8 @@ resource "aws_cloudwatch_metric_alarm" "ec2-StatusCheckFailed_Instance" {
namespace = "AWS/EC2" namespace = "AWS/EC2"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-emergency] alarm_actions = [var.sns-targets.alarm-actions-emergency]
ok_actions = [var.alarm-actions-emergency] ok_actions = [var.sns-targets.alarm-actions-emergency]
dimensions = { dimensions = {
InstanceId = var.ec2-instance-id InstanceId = var.ec2-instance-id
} }
@ -56,8 +56,8 @@ resource "aws_cloudwatch_metric_alarm" "ec2-CPUUtilization" {
namespace = "AWS/EC2" namespace = "AWS/EC2"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
treat_missing_data = "notBreaching" treat_missing_data = "notBreaching"
dimensions = { dimensions = {
InstanceId = var.ec2-instance-id InstanceId = var.ec2-instance-id
@ -85,8 +85,8 @@ resource "aws_cloudwatch_metric_alarm" "ec2-mem_free" {
namespace = "CWAgent" namespace = "CWAgent"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-standard] alarm_actions = [var.sns-targets.alarm-actions-standard]
ok_actions = [var.alarm-actions-standard] ok_actions = [var.sns-targets.alarm-actions-standard]
dimensions = { dimensions = {
InstanceId = var.ec2-instance-id InstanceId = var.ec2-instance-id
ImageId = data.aws_instance.ec2-instance.ami ImageId = data.aws_instance.ec2-instance.ami
@ -107,8 +107,8 @@ resource "aws_cloudwatch_metric_alarm" "ec2-swap_free" {
alarm_description = "EC2:swap_free" alarm_description = "EC2:swap_free"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-standard] alarm_actions = [var.sns-targets.alarm-actions-standard]
ok_actions = [var.alarm-actions-standard] ok_actions = [var.sns-targets.alarm-actions-standard]
metric_query { metric_query {
id = "m1" id = "m1"
metric { metric {
@ -157,8 +157,8 @@ resource "aws_cloudwatch_metric_alarm" "ec2-disk_free" {
namespace = "CWAgent" namespace = "CWAgent"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
InstanceId = var.ec2-instance-id InstanceId = var.ec2-instance-id
ImageId = data.aws_instance.ec2-instance.ami ImageId = data.aws_instance.ec2-instance.ami
@ -186,8 +186,8 @@ resource "aws_cloudwatch_metric_alarm" "ec2-disk_inodes_free" {
namespace = "CWAgent" namespace = "CWAgent"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
InstanceId = var.ec2-instance-id InstanceId = var.ec2-instance-id
ImageId = data.aws_instance.ec2-instance.ami ImageId = data.aws_instance.ec2-instance.ami
@ -214,8 +214,8 @@ resource "aws_cloudwatch_metric_alarm" "ec2-processes_total" {
namespace = "CWAgent" namespace = "CWAgent"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
InstanceId = var.ec2-instance-id InstanceId = var.ec2-instance-id
ImageId = data.aws_instance.ec2-instance.ami ImageId = data.aws_instance.ec2-instance.ami

View File

@ -1,22 +1,8 @@
variable "cw-alarm-prefix" {} variable "cw-alarm-prefix" {}
variable "actions-enabled" {} variable "actions-enabled" {}
variable "ec2-instance-id" {} variable "ec2-instance-id" {}
variable "alarm-actions-urgent" { variable sns-targets {}
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-urgent"
}
variable "alarm-actions-emergency" {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-emergency"
}
variable "alarm-actions-standard" {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-standard"
}
variable "alarm-actions-general" {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support"
}
variable "default-tags" {} variable "default-tags" {}
variable "threshold-CPUUtilization" {} variable "threshold-CPUUtilization" {}

View File

@ -10,8 +10,8 @@ resource "aws_cloudwatch_metric_alarm" "emr-AppsPending" {
namespace = "AWS/ElasticMapReduce" namespace = "AWS/ElasticMapReduce"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-standard] alarm_actions = [var.sns-targets.alarm-actions-standard]
ok_actions = [var.alarm-actions-standard] ok_actions = [var.sns-targets.alarm-actions-standard]
dimensions = { dimensions = {
JobFlowId = var.job-flow-id JobFlowId = var.job-flow-id
} }
@ -33,8 +33,8 @@ resource "aws_cloudwatch_metric_alarm" "emr-CapacityRemainingGB" {
namespace = "AWS/ElasticMapReduce" namespace = "AWS/ElasticMapReduce"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
JobFlowId = var.job-flow-id JobFlowId = var.job-flow-id
} }

View File

@ -4,20 +4,5 @@ variable job-flow-id {}
variable threshold-AppsPending {} variable threshold-AppsPending {}
variable threshold-CapacityRemainingGB {} variable threshold-CapacityRemainingGB {}
variable alarm-actions-urgent { variable sns-targets {}
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-urgent"
}
variable alarm-actions-emergency {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-emergency"
}
variable alarm-actions-standard {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-standard"
}
variable alarm-actions-general {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support"
}
variable default-tags {} variable default-tags {}

View File

@ -10,8 +10,8 @@ resource "aws_cloudwatch_metric_alarm" "Kafka-ZooKeeperRequestLatencyMsMean" {
namespace = "AWS/Kafka" namespace = "AWS/Kafka"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
"Cluster Name" = var.cluster-name "Cluster Name" = var.cluster-name
} }

View File

@ -1,22 +1,7 @@
variable cw-alarm-prefix {} variable cw-alarm-prefix {}
variable actions-enabled {} variable actions-enabled {}
variable cluster-name {} variable cluster-name {}
variable alarm-actions-urgent { variable sns-targets {}
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-urgent"
}
variable alarm-actions-emergency {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-emergency"
}
variable alarm-actions-standard {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-standard"
}
variable alarm-actions-general {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support"
}
variable default-tags {} variable default-tags {}
variable threshold-ZooKeeperRequestLatencyMsMean {} variable threshold-ZooKeeperRequestLatencyMsMean {}

View File

@ -17,7 +17,7 @@ module "nlb-targetgroups" {
resource "aws_cloudwatch_metric_alarm" "nlb-HealthyHostCount" { resource "aws_cloudwatch_metric_alarm" "nlb-HealthyHostCount" {
for_each = module.nlb-targetgroups.result-set for_each = module.nlb-targetgroups.result-set
alarm_name = "${var.cw-alarm-prefix}:NLBTG:HealthyHostCount:${split(":", each.value)[5]}" alarm_name = "${var.cw-alarm-prefix}:NLBTG:HealthyHostCount:${split(":", each.value)[5]}"
comparison_operator = "LessThanOrEqualToThreshold" comparison_operator = "LessThanThreshold"
evaluation_periods = "1" evaluation_periods = "1"
metric_name = "HealthyHostCount" metric_name = "HealthyHostCount"
period = "300" period = "300"
@ -27,8 +27,8 @@ resource "aws_cloudwatch_metric_alarm" "nlb-HealthyHostCount" {
namespace = "AWS/NetworkELB" namespace = "AWS/NetworkELB"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-emergency] alarm_actions = [var.sns-targets.alarm-actions-emergency]
ok_actions = [var.alarm-actions-emergency] ok_actions = [var.sns-targets.alarm-actions-emergency]
dimensions = { dimensions = {
TargetGroup = split(":", each.value)[5] TargetGroup = split(":", each.value)[5]
LoadBalancer = "net/${split("/", var.load-balancer)[2]}/${split("/", var.load-balancer)[3]}" LoadBalancer = "net/${split("/", var.load-balancer)[2]}/${split("/", var.load-balancer)[3]}"

View File

@ -2,20 +2,5 @@ variable cw-alarm-prefix {}
variable actions-enabled {} variable actions-enabled {}
variable load-balancer {} variable load-balancer {}
variable threshold-HealthHostCountMin {} variable threshold-HealthHostCountMin {}
variable alarm-actions-urgent { variable sns-targets {}
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-urgent"
}
variable alarm-actions-emergency {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-emergency"
}
variable alarm-actions-standard {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-standard"
}
variable alarm-actions-general {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support"
}
variable default-tags {} variable default-tags {}

View File

@ -12,8 +12,8 @@ resource "aws_cloudwatch_metric_alarm" "ES-CPUUtilization" {
namespace = "AWS/ES" namespace = "AWS/ES"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
DomainName = var.domain-name DomainName = var.domain-name
ClientId = data.aws_caller_identity.this.id ClientId = data.aws_caller_identity.this.id
@ -36,8 +36,8 @@ resource "aws_cloudwatch_metric_alarm" "ES-SearchLatency" {
namespace = "AWS/ES" namespace = "AWS/ES"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
DomainName = var.domain-name DomainName = var.domain-name
ClientId = data.aws_caller_identity.this.id ClientId = data.aws_caller_identity.this.id
@ -60,8 +60,8 @@ resource "aws_cloudwatch_metric_alarm" "ES-IndexingLatency" {
namespace = "AWS/ES" namespace = "AWS/ES"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
DomainName = var.domain-name DomainName = var.domain-name
ClientId = data.aws_caller_identity.this.id ClientId = data.aws_caller_identity.this.id
@ -84,8 +84,8 @@ resource "aws_cloudwatch_metric_alarm" "ES-ClusterStatusRed" {
namespace = "AWS/ES" namespace = "AWS/ES"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
DomainName = var.domain-name DomainName = var.domain-name
ClientId = data.aws_caller_identity.this.id ClientId = data.aws_caller_identity.this.id

View File

@ -1,22 +1,7 @@
variable cw-alarm-prefix {} variable cw-alarm-prefix {}
variable actions-enabled {} variable actions-enabled {}
variable domain-name {} variable domain-name {}
variable alarm-actions-urgent { variable sns-targets {}
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-urgent"
}
variable alarm-actions-emergency {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-emergency"
}
variable alarm-actions-standard {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-standard"
}
variable alarm-actions-general {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support"
}
variable default-tags {} variable default-tags {}
variable threshold-CPUUtilization {} variable threshold-CPUUtilization {}

View File

@ -10,8 +10,8 @@ resource "aws_cloudwatch_metric_alarm" "rds-cpu" {
namespace = "AWS/RDS" namespace = "AWS/RDS"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
DBInstanceIdentifier = var.rds-instance-name DBInstanceIdentifier = var.rds-instance-name
} }
@ -33,8 +33,8 @@ resource "aws_cloudwatch_metric_alarm" "rds-storage" {
namespace = "AWS/RDS" namespace = "AWS/RDS"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
DBInstanceIdentifier = var.rds-instance-name DBInstanceIdentifier = var.rds-instance-name
} }
@ -56,8 +56,8 @@ resource "aws_cloudwatch_metric_alarm" "rds-memory" {
namespace = "AWS/RDS" namespace = "AWS/RDS"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
DBInstanceIdentifier = var.rds-instance-name DBInstanceIdentifier = var.rds-instance-name
} }
@ -79,8 +79,8 @@ resource "aws_cloudwatch_metric_alarm" "rds-DiskQueueDepth" {
namespace = "AWS/RDS" namespace = "AWS/RDS"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
DBInstanceIdentifier = var.rds-instance-name DBInstanceIdentifier = var.rds-instance-name
} }
@ -102,8 +102,8 @@ resource "aws_cloudwatch_metric_alarm" "rds-ReadLatency" {
namespace = "AWS/RDS" namespace = "AWS/RDS"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
DBInstanceIdentifier = var.rds-instance-name DBInstanceIdentifier = var.rds-instance-name
} }
@ -125,8 +125,8 @@ resource "aws_cloudwatch_metric_alarm" "rds-WriteLatency" {
namespace = "AWS/RDS" namespace = "AWS/RDS"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
DBInstanceIdentifier = var.rds-instance-name DBInstanceIdentifier = var.rds-instance-name
} }

View File

@ -1,22 +1,7 @@
variable cw-alarm-prefix {} variable cw-alarm-prefix {}
variable actions-enabled {} variable actions-enabled {}
variable rds-instance-name {} variable rds-instance-name {}
variable alarm-actions-urgent { variable sns-targets {}
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-urgent"
}
variable alarm-actions-emergency {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-emergency"
}
variable alarm-actions-standard {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-standard"
}
variable alarm-actions-general {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support"
}
variable default-tags {} variable default-tags {}
variable threshold-FreeableMemory {} variable threshold-FreeableMemory {}

View File

@ -10,8 +10,8 @@ resource "aws_cloudwatch_metric_alarm" "redis-EngineCPUUtilization" {
namespace = "AWS/ElastiCache" namespace = "AWS/ElastiCache"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
CacheClusterId = var.redis-cluster-id CacheClusterId = var.redis-cluster-id
} }
@ -33,8 +33,8 @@ resource "aws_cloudwatch_metric_alarm" "redis-DatabaseMemoryUsagePercentage" {
namespace = "AWS/ElastiCache" namespace = "AWS/ElastiCache"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-urgent] alarm_actions = [var.sns-targets.alarm-actions-urgent]
ok_actions = [var.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent]
dimensions = { dimensions = {
CacheClusterId = var.redis-cluster-id CacheClusterId = var.redis-cluster-id
} }
@ -56,8 +56,8 @@ resource "aws_cloudwatch_metric_alarm" "redis-CacheHitRate" {
namespace = "AWS/ElastiCache" namespace = "AWS/ElastiCache"
insufficient_data_actions = [] insufficient_data_actions = []
actions_enabled = var.actions-enabled actions_enabled = var.actions-enabled
alarm_actions = [var.alarm-actions-standard] alarm_actions = [var.sns-targets.alarm-actions-standard]
ok_actions = [var.alarm-actions-standard] ok_actions = [var.sns-targets.alarm-actions-standard]
dimensions = { dimensions = {
CacheClusterId = var.redis-cluster-id CacheClusterId = var.redis-cluster-id
# CacheNodeId = each.value # CacheNodeId = each.value

View File

@ -1,22 +1,7 @@
variable cw-alarm-prefix {} variable cw-alarm-prefix {}
variable "actions-enabled" {} variable "actions-enabled" {}
variable "redis-cluster-id" {} variable "redis-cluster-id" {}
variable "alarm-actions-urgent" { variable sns-targets {}
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-urgent"
}
variable "alarm-actions-emergency" {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-emergency"
}
variable "alarm-actions-standard" {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support-standard"
}
variable "alarm-actions-general" {
type = string
default = "arn:aws:sns:ap-east-1:843733946244:rackspace-support"
}
variable "default-tags" {} variable "default-tags" {}
variable "threshold-EngineCPUUtilization" {} variable "threshold-EngineCPUUtilization" {}