Dallas Despain
11/22/2024, 4:41 PMaws cloudwatch delete-anomaly-detector \
--single-metric-anomaly-detector
'{
"Namespace": "AWS/ApplicationELB",
"AccountId": "redacted",
"MetricName": "RequestCountPerTarget",
"Dimensions": [
{
"Name": "TargetGroup",
"Value": "redacted"
}
],
"Stat": "Average"
}'
Here's my TF configuration (truncated for brevity
resource "aws_cloudwatch_metric_alarm" "example" {
alarm_name = "example"
#....
#redacted for brevity
#....
provisioner "local-exec" {
when = destroy
command = format("aws cloudwatch delete-anomaly-detector --single-metric-anomoly-detector '%s'", jsonencode({
Namespace = "AWS\\ApplicationELB"
AccountId = "redacted"
MetricName = "RequestCountPerTarget"
Dimensions = [{
Name = "TargetGroup"
Value = "redacted"
}]
Stat = "Average"
}
))
}
}
I also created some gists if that's easier to read.
AWS command I'm trying to get TF to run
Terraform config (truncated)Troy Knapp
11/22/2024, 4:46 PMTroy Knapp
11/22/2024, 4:47 PMDallas Despain
11/22/2024, 4:58 PMTroy Knapp
11/22/2024, 5:04 PMTroy Knapp
11/22/2024, 5:05 PMTroy Knapp
11/22/2024, 5:05 PMDallas Despain
11/22/2024, 5:10 PM