From 6d93cc64a98999d17cfff6c6368648ae9e5bd2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Nunes?= Date: Wed, 7 Aug 2024 13:13:51 +0100 Subject: [PATCH] fix(account_billing_alert): fix deprecat threshold --- modules/account_billing_alert/README.md | 4 ++-- modules/account_billing_alert/cost_anomaly_detection.tf | 9 ++++++++- modules/account_billing_alert/requirements.tf | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/account_billing_alert/README.md b/modules/account_billing_alert/README.md index feb364f..31205fc 100644 --- a/modules/account_billing_alert/README.md +++ b/modules/account_billing_alert/README.md @@ -7,13 +7,13 @@ The module is intended to be used in a subaccount, not in a root account which s | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0.0 | -| [aws](#requirement\_aws) | >= 4.30.0 | +| [aws](#requirement\_aws) | >= 4.51.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.30.0 | +| [aws](#provider\_aws) | >= 4.51.0 | ## Modules diff --git a/modules/account_billing_alert/cost_anomaly_detection.tf b/modules/account_billing_alert/cost_anomaly_detection.tf index ae4d6b8..4e3093b 100644 --- a/modules/account_billing_alert/cost_anomaly_detection.tf +++ b/modules/account_billing_alert/cost_anomaly_detection.tf @@ -8,9 +8,16 @@ resource "aws_ce_anomaly_monitor" "service_monitor" { resource "aws_ce_anomaly_subscription" "service_monitor_subscritpion" { count = var.anomaly_detection_threshold == 0 ? 0 : 1 name = "DAILYSUBSCRIPTION" - threshold = var.anomaly_detection_threshold frequency = "DAILY" + threshold_expression { + dimension { + key = "ANOMALY_TOTAL_IMPACT_ABSOLUTE" + match_options = ["GREATER_THAN_OR_EQUAL"] + values = [var.anomaly_detection_threshold] + } + } + monitor_arn_list = [ aws_ce_anomaly_monitor.service_monitor[0].arn, ] diff --git a/modules/account_billing_alert/requirements.tf b/modules/account_billing_alert/requirements.tf index b16395b..eda1b88 100644 --- a/modules/account_billing_alert/requirements.tf +++ b/modules/account_billing_alert/requirements.tf @@ -2,7 +2,7 @@ terraform { required_version = ">= 1.0.0" required_providers { aws = { - version = ">= 4.30.0" + version = ">= 4.51.0" } } }