如何将event_api_destination添加到AWS中的CloudWatch规则?
如何将资源 aws_cloudwatch_event_api_destination 和 aws_cloudwatch_event_connection 添加到 terraform 中的资源 aws_cloudwatch_event_rule ?
这段代码在下面
resource "aws_cloudwatch_event_rule" "test123_schedule_everyday" {
name = "${var.test123_bucket_name}-schedule-everyday-${var.env}"
description = "Meter reader get api data every 11:00 PM at lotus"
schedule_expression = "cron(0 16 * * ? *)"
is_enabled = "${var.test123_cloudwatch_is_enable}"
lifecycle {
ignore_changes = [schedule_expression, description, is_enabled]
}
}
resource "aws_cloudwatch_event_api_destination" "test123_event_api" {
name = "test-dev-api"
description = "test-dev-api destination"
invocation_endpoint = "https://test.com"
invocation_rate_limit_per_second = "1"
http_method = "GET"
connection_arn = aws_cloudwatch_event_connection.test123_event_connection.arn
}
resource "aws_cloudwatch_event_connection" "test123_event_connection" {
name = "test-dev-connection"
description = "A connection description"
authorization_type = "API_KEY"
auth_parameters {
api_key {
key = "test-key"
value = "TUVURVJSRUFESU5HOkNCWktXWFU3NzZDS0dGTk5LNjdGWUFVNFFRNE1HV0o3"
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您寻求的是 aws_cloudwatch_event_target。这允许您将目的地指定为给定规则的目标,如官方 API 目标文档。
I believe what you seek is an aws_cloudwatch_event_target. This allows you to specify your destination as a target for a given rule, as documented in the official API destinations documentation.