From 1b5bd67c04232a01a10144b4c3812aad025b5dc2 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:03:39 +0100 Subject: [PATCH] feat: use dynamical expressions for UnauthorizedAPICalls --- modules/alarm-baseline/main.tf | 2 +- modules/alarm-baseline/variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/alarm-baseline/main.tf b/modules/alarm-baseline/main.tf index 2d12e970..d3244bd9 100644 --- a/modules/alarm-baseline/main.tf +++ b/modules/alarm-baseline/main.tf @@ -49,7 +49,7 @@ resource "aws_cloudwatch_log_metric_filter" "unauthorized_api_calls" { metric_transformation { name = "UnauthorizedAPICalls" namespace = var.alarm_namespace - value = "1" + value = (var.metric_unauthorizedapicalls == true ? 2 : 1) } } diff --git a/modules/alarm-baseline/variables.tf b/modules/alarm-baseline/variables.tf index c1c651b6..4cae56bb 100644 --- a/modules/alarm-baseline/variables.tf +++ b/modules/alarm-baseline/variables.tf @@ -124,3 +124,9 @@ variable "tags" { "Terraform" = "true" } } + +variable "metric_unauthorizedapicalls" { + description = "This is the value of the amount of UnauthorizedAPICalls" + type = bool + default = true +}