我正在使用terraform在下面创建一个AWS报警
resource "aws_cloudwatch_metric_alarm" "terraform-product-monitoring-dynamoDB-UserErrors" {
alarm_name = "terraform-product-monitoring-dynamoDB-UserErrors"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "2"
metric_name = "UserErrors"
namespace = "AWS/DynamoDB"
period = "120"
statistic = "Sum"
threshold = "1"
alarm_description = "This metric monitors the UserErrors for DynamoDB"
alarm_actions = ["${module.admin_sns_email_topic.arn}"]
insufficient_data_actions = []
}
我想得到报警的arn,但是
"${aws_cloudwatch_metric_alarm.terraform-product-monitoring-dynamoDB-UserErrors.arn}"
给出错误
Resource 'aws_cloudwatch_metric_alarm.terraform-product-monitoring-dynamoDB-UserErrors' does not have attribute 'arn' for variable 'aws_cloudwatch_metric_alarm.terraform-product-monitoring-dynamoDB-UserErrors.arn'
有什么想法吗?
干杯
锤
答案 0 :(得分:2)
并非所有资源都有ARN
。如果您需要获取资源aws_cloudwatch_metric_alarm
的名称,请使用id
参考:
https://www.terraform.io/docs/providers/aws/r/cloudwatch_metric_alarm.html#id