|
1 | 1 | # EventBridge Rule (RDS Extended Support Billing)
|
2 | 2 | resource "aws_cloudwatch_event_rule" "rds_extended_support_billing" {
|
| 3 | + count = var.enable_aws_extended_support_alerts ? 1 : 0 |
3 | 4 | name = "rds-extended-support-billing-notification"
|
4 | 5 | description = "Captures AWS Billing notifications for RDS Extended Support"
|
5 | 6 |
|
6 | 7 | event_pattern = jsonencode({
|
7 | 8 | "source" : ["aws.health"],
|
| 9 | + "detail-type" : ["AWS Health Event"], |
8 | 10 | "detail" : {
|
9 | 11 | "eventTypeCode" : ["AWS_BILLING_NOTIFICATION"],
|
10 | 12 | "eventDescription" : [{
|
11 |
| - "latestDescription" : [{ |
12 |
| - "wildcard" : ["*RDS Extended Support*"] |
13 |
| - }] |
| 13 | + "wildcard" : "*RDS Extended Support*" |
14 | 14 | }]
|
15 | 15 | }
|
16 | 16 | })
|
17 | 17 | }
|
18 | 18 |
|
19 | 19 | resource "aws_cloudwatch_event_target" "rds_extended_support_billing" {
|
20 |
| - rule = aws_cloudwatch_event_rule.rds_extended_support_billing.name |
21 |
| - arn = local.sns_topic_arn |
| 20 | + count = var.enable_aws_extended_support_alerts ? 1 : 0 |
| 21 | + rule = aws_cloudwatch_event_rule.rds_extended_support_billing[0].name |
| 22 | + arn = local.sns_topic_arn |
22 | 23 | }
|
23 | 24 |
|
24 | 25 | # EventBridge Rule (EKS Extended Support Billing)
|
25 | 26 | resource "aws_cloudwatch_event_rule" "eks_extended_support_billing" {
|
26 |
| - name = "rds-extended-support-billing-notification" |
| 27 | + count = var.enable_aws_extended_support_alerts ? 1 : 0 |
| 28 | + name = "eks-extended-support-billing-notification" |
27 | 29 | description = "Captures AWS Billing notifications for EKS Extended Support"
|
28 | 30 |
|
29 | 31 | event_pattern = jsonencode({
|
30 | 32 | "source" : ["aws.health"],
|
| 33 | + "detail-type" : ["AWS Health Event"], |
31 | 34 | "detail" : {
|
32 | 35 | "eventTypeCode" : ["AWS_BILLING_NOTIFICATION"],
|
33 | 36 | "eventDescription" : [{
|
34 |
| - "latestDescription" : [{ |
35 |
| - "wildcard" : ["*EKS Extended Support*"] |
36 |
| - }] |
| 37 | + "wildcard" : "*EKS Extended Support*" |
37 | 38 | }]
|
38 | 39 | }
|
39 | 40 | })
|
40 | 41 | }
|
41 | 42 |
|
42 | 43 | resource "aws_cloudwatch_event_target" "eks_extended_support_billing" {
|
43 |
| - rule = aws_cloudwatch_event_rule.rds_extended_support_billing.name |
44 |
| - arn = local.sns_topic_arn |
| 44 | + count = var.enable_aws_extended_support_alerts ? 1 : 0 |
| 45 | + rule = aws_cloudwatch_event_rule.eks_extended_support_billing[0].name |
| 46 | + arn = local.sns_topic_arn |
45 | 47 | }
|
0 commit comments