The following terraform resource creates AWS cloudwatch alarm, but remains in "insufficient data" state. I believe this is due to some of the dimension names I used (DevicePath, fstype) may not be correct. I know the names MountPath and InstanceID are correct but could not verify the other two (DevicePath, fstype). AWS call these dimensions as path, device, fstype and host respectively, however, could not find a reference what terraform calls these.
resource "aws_cloudwatch_metric_alarm" "Low_Disk_Space_For_root_drive" {
alarm_name = "Low_Disk_Space_For_root_drive"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "2"
metric_name = "disk_used_percent"
namespace = "CWAgent"
dimensions {
MountPath = "/"
DevicePath = "/dev/xvda2"
fstype = "xfs"
InstanceId = "i-xxxxxxxxxxxxxxxxx"
}
period = "60"
statistics = "Maximum"
threshold = "90"
alarm_description = "Disk usage for / is high"
insufficient_data_actions = []
actions_enabled = true
alarm_actions = ["arn:aws:sns:xxxxxx"]
ok_actions = ["arn:aws:sns:xxxxxx"]
}