[英]It is possible to create multiple conditions for the same CloudWatch alarm for AutoScaling group with Terraform?
这是我的资源,我需要它遵循 2 个条件:
resource "aws_cloudwatch_metric_alarm" "GroupMinSize" {
count = 1
alarm_name = "Autoscaling_Group_Min_Size"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = "2"
metric_name = "GroupMinSize"
namespace = "AWS/AutoScaling"
statistic = "Minimum"
period = "120"
threshold = 1
dimensions = {
AutoScalingGroupName = aws_autoscaling_group.asg[count.index].name
}
alarm_description = "The minimum size of the Auto Scaling group"
}
根据 AWS cloudformation 文档, comparison_operator
是一个字符串,因此您不能有多个条件。 如果 cloudformation 做不到,Terraform 也做不到。
ComparisonOperator
The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic value is used as the first operand.
You can specify the following values: GreaterThanThreshold, GreaterThanOrEqualToThreshold, LessThanThreshold, or LessThanOrEqualToThreshold.
Required: Yes
Type: String
Allowed values: GreaterThanOrEqualToThreshold | GreaterThanThreshold | GreaterThanUpperThreshold | LessThanLowerOrGreaterThanUpperThreshold | LessThanLowerThreshold | LessThanOrEqualToThreshold | LessThanThreshold
但是,您可以组合多个警报以进行复合。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.