Hi, I would like to use aws_cloudwatch_metric_alarm with multiple dimensions but I don’t know if it’s possible and how to do it.
I have a custom metric with multiple dimensions :
"MetricName": "Messages",
"Namespace": "RabbitMQ",
"Statistic": "Average",
"Dimensions": [
{
"Name": "VHost",
"Value": "/"
},
{
"Name": "Cluster",
"Value": "rabbit@ip-172-31-0-30.eu-west-3.compute.internal"
},
{
"Name": "Metric",
"Value": "Queue"
},
{
"Name": "Queue",
"Value": "asyncWorkflow"
}
]
I would like to use it in the resource aws_cloudwatch_metric_alarm But I don’t know how to define it.
Actually If I put all my dimensions terraform will use only the last one.
resource "aws_cloudwatch_metric_alarm" "worker" {
alarm_name = "worker"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 2
metric_name = "Messages"
namespace = "RabbitMQ"
period = "120"
statistic = "Average"
threshold = "10"
dimensions = {
Name = "Vhost"
Value = "/"
Name = "Cluster"
Value = "rabbit@ip-172-31-0-30.eu-west-3.compute.internal"
Name = "Metric"
Value = "Queue"
Name = "Queue"
Value = "asyncWorkflow"
}
alarm_description = "This metric monitors autoscaling group ${each.key} utilization"
alarm_actions = var.alarm_actions
}
Do you know how I should define all my dimensions ?