From 6e9954c18d3f3bd64792a5b21d0c4dce75669b0f Mon Sep 17 00:00:00 2001 From: Martijn Mol Date: Tue, 23 Jul 2019 16:19:11 +0200 Subject: [PATCH] MARIO-2195 make cloudwatch memory check optional --- apps/cloudwatch_lambda/cloudwatch.tf | 1 + apps/cloudwatch_lambda/variables.tf | 3 ++- apps/lambda_function/cloudwatch.tf | 3 ++- apps/lambda_function/variables.tf | 3 +++ .../cloudwatch.tf | 1 + .../variables.tf | 3 +++ .../cloudwatch.tf | 1 + .../variables.tf | 3 +++ .../cloudwatch.tf | 3 ++- .../variables.tf | 3 +++ .../cloudwatch.tf | 1 + .../variables.tf | 3 +++ apps/lambda_function_scheduled_vpc/cloudwatch.tf | 1 + apps/lambda_function_scheduled_vpc/variables.tf | 3 +++ apps/lambda_function_sns/cloudwatch.tf | 1 + apps/lambda_function_sns/variables.tf | 3 +++ apps/lambda_function_sns_no_vpc/cloudwatch.tf | 1 + apps/lambda_function_sns_no_vpc/variables.tf | 3 +++ apps/lambda_function_sqs_no_vpc/cloudwatch.tf | 1 + apps/lambda_function_sqs_vpc/cloudwatch.tf | 1 + apps/lambda_function_vpc/cloudwatch.tf | 1 + apps/lambda_function_vpc/variables.tf | 3 +++ 22 files changed, 43 insertions(+), 3 deletions(-) diff --git a/apps/cloudwatch_lambda/cloudwatch.tf b/apps/cloudwatch_lambda/cloudwatch.tf index fd35686f..1d6c0b07 100644 --- a/apps/cloudwatch_lambda/cloudwatch.tf +++ b/apps/cloudwatch_lambda/cloudwatch.tf @@ -31,4 +31,5 @@ resource "aws_cloudwatch_metric_alarm" "lambda_memory_alert" { alarm_actions = ["${var.alarm_action_arn}"] actions_enabled = "${var.alarm_action_enabled}" tags = "${local.tags}" + count = "${var.enable_cloudwatch_alarms}" } \ No newline at end of file diff --git a/apps/cloudwatch_lambda/variables.tf b/apps/cloudwatch_lambda/variables.tf index 901b5c88..644358ac 100644 --- a/apps/cloudwatch_lambda/variables.tf +++ b/apps/cloudwatch_lambda/variables.tf @@ -30,4 +30,5 @@ variable "pattern" { } variable "alarm_action_enabled" { default = "true" -} \ No newline at end of file +} +variable "enable_cloudwatch_alarms" {} \ No newline at end of file diff --git a/apps/lambda_function/cloudwatch.tf b/apps/lambda_function/cloudwatch.tf index 68707aa2..bd9ab518 100644 --- a/apps/lambda_function/cloudwatch.tf +++ b/apps/lambda_function/cloudwatch.tf @@ -11,7 +11,8 @@ module "lambda_app_cloudwatch" { tags_purpose = "${var.tags_purpose}" tags_cost_center = "${var.tags_cost_center}" description = "${var.description}" - retention_days = "${var.retention_days}" + retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function/variables.tf b/apps/lambda_function/variables.tf index cdeefdbb..9f6dd59f 100644 --- a/apps/lambda_function/variables.tf +++ b/apps/lambda_function/variables.tf @@ -140,4 +140,7 @@ variable "lambda_memory_alert_threshold" { variable "alarm_action_arn" { default = "" +} +variable "enable_cloudwatch_alarms" { + default = 1 } \ No newline at end of file diff --git a/apps/lambda_function_api_gateway_all_methods_passthrough/cloudwatch.tf b/apps/lambda_function_api_gateway_all_methods_passthrough/cloudwatch.tf index d504f1b2..73450d6c 100644 --- a/apps/lambda_function_api_gateway_all_methods_passthrough/cloudwatch.tf +++ b/apps/lambda_function_api_gateway_all_methods_passthrough/cloudwatch.tf @@ -12,6 +12,7 @@ module "lambda_app_cloudwatch" { tags_cost_center = "${var.tags_cost_center}" description = "${var.description}" retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function_api_gateway_all_methods_passthrough/variables.tf b/apps/lambda_function_api_gateway_all_methods_passthrough/variables.tf index f6b76a50..b9df6ad3 100644 --- a/apps/lambda_function_api_gateway_all_methods_passthrough/variables.tf +++ b/apps/lambda_function_api_gateway_all_methods_passthrough/variables.tf @@ -148,4 +148,7 @@ variable "swagger_api_key" { variable "api_gateway_type" { default = "EDGE" +} +variable "enable_cloudwatch_alarms" { + default = "1" } \ No newline at end of file diff --git a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc/cloudwatch.tf b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc/cloudwatch.tf index 5a532cf4..a07183cb 100644 --- a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc/cloudwatch.tf +++ b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc/cloudwatch.tf @@ -12,6 +12,7 @@ module "lambda_app_cloudwatch" { tags_cost_center = "${var.tags_cost_center}" description = "${var.description}" retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc/variables.tf b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc/variables.tf index bc93db6c..189d6433 100644 --- a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc/variables.tf +++ b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc/variables.tf @@ -141,4 +141,7 @@ variable "swagger_api_key" { variable "api_gateway_type" { default = "EDGE" +} +variable "enable_cloudwatch_alarms" { + default = "1" } \ No newline at end of file diff --git a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_authentication/cloudwatch.tf b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_authentication/cloudwatch.tf index b1de2109..4b5aeba9 100644 --- a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_authentication/cloudwatch.tf +++ b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_authentication/cloudwatch.tf @@ -11,7 +11,8 @@ module "lambda_app_cloudwatch" { tags_domain = "${var.tags_domain}" tags_cost_center = "${var.tags_cost_center}" description = "${var.description}" - retention_days = "${var.retention_days}" + retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_authentication/variables.tf b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_authentication/variables.tf index 9db6a82d..0ff24881 100644 --- a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_authentication/variables.tf +++ b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_authentication/variables.tf @@ -144,4 +144,7 @@ variable "swagger_api_key" { variable "api_gateway_type" { default = "EDGE" +} +variable "enable_cloudwatch_alarms" { + default = 1 } \ No newline at end of file diff --git a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_custom_authenticator/cloudwatch.tf b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_custom_authenticator/cloudwatch.tf index 5a532cf4..a07183cb 100644 --- a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_custom_authenticator/cloudwatch.tf +++ b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_custom_authenticator/cloudwatch.tf @@ -12,6 +12,7 @@ module "lambda_app_cloudwatch" { tags_cost_center = "${var.tags_cost_center}" description = "${var.description}" retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_custom_authenticator/variables.tf b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_custom_authenticator/variables.tf index 54ed6452..4182aca7 100644 --- a/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_custom_authenticator/variables.tf +++ b/apps/lambda_function_api_gateway_all_methods_passthrough_no_vpc_custom_authenticator/variables.tf @@ -156,3 +156,6 @@ variable "swagger_api_key" { variable "api_gateway_type" { default = "EDGE" } +variable "enable_cloudwatch_alarms" { + default = "1" +} \ No newline at end of file diff --git a/apps/lambda_function_scheduled_vpc/cloudwatch.tf b/apps/lambda_function_scheduled_vpc/cloudwatch.tf index 33ca85bf..525cc3e3 100644 --- a/apps/lambda_function_scheduled_vpc/cloudwatch.tf +++ b/apps/lambda_function_scheduled_vpc/cloudwatch.tf @@ -24,6 +24,7 @@ module "lambda_app_cloudwatch" { tags_purpose = "${var.tags_purpose}" description = "${var.description}" retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function_scheduled_vpc/variables.tf b/apps/lambda_function_scheduled_vpc/variables.tf index e6f371ce..002d2fe7 100644 --- a/apps/lambda_function_scheduled_vpc/variables.tf +++ b/apps/lambda_function_scheduled_vpc/variables.tf @@ -112,4 +112,7 @@ variable "alarm_action_arn" { variable "retention_days" { default = "30" +} +variable "enable_cloudwatch_alarms" { + default = "1" } \ No newline at end of file diff --git a/apps/lambda_function_sns/cloudwatch.tf b/apps/lambda_function_sns/cloudwatch.tf index bfd177dc..3f32a91c 100644 --- a/apps/lambda_function_sns/cloudwatch.tf +++ b/apps/lambda_function_sns/cloudwatch.tf @@ -12,6 +12,7 @@ module "lambda_app_cloudwatch" { tags_cost_center = "${var.tags_cost_center}" description = "${var.description}" retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function_sns/variables.tf b/apps/lambda_function_sns/variables.tf index d21b3477..0a2c76dd 100644 --- a/apps/lambda_function_sns/variables.tf +++ b/apps/lambda_function_sns/variables.tf @@ -120,3 +120,6 @@ variable "reserved_concurrent_executions" { variable "sns_subscription_filters" { default = "" } +variable "enable_cloudwatch_alarms" { + default = "1" +} \ No newline at end of file diff --git a/apps/lambda_function_sns_no_vpc/cloudwatch.tf b/apps/lambda_function_sns_no_vpc/cloudwatch.tf index d2ef43e6..5f31ea5d 100644 --- a/apps/lambda_function_sns_no_vpc/cloudwatch.tf +++ b/apps/lambda_function_sns_no_vpc/cloudwatch.tf @@ -12,6 +12,7 @@ module "lambda_app_cloudwatch" { tags_cost_center = "${var.tags_cost_center}" description = "${var.description}" retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function_sns_no_vpc/variables.tf b/apps/lambda_function_sns_no_vpc/variables.tf index 39497234..de3b5aa4 100644 --- a/apps/lambda_function_sns_no_vpc/variables.tf +++ b/apps/lambda_function_sns_no_vpc/variables.tf @@ -126,4 +126,7 @@ variable "reserved_concurrent_executions" { } variable "sns_subscription_filters" { default = "" +} +variable "enable_cloudwatch_alarms" { + default = "1" } \ No newline at end of file diff --git a/apps/lambda_function_sqs_no_vpc/cloudwatch.tf b/apps/lambda_function_sqs_no_vpc/cloudwatch.tf index dd95d3b2..4dca9654 100644 --- a/apps/lambda_function_sqs_no_vpc/cloudwatch.tf +++ b/apps/lambda_function_sqs_no_vpc/cloudwatch.tf @@ -12,6 +12,7 @@ module "lambda_app_cloudwatch" { tags_cost_center = "${var.tags_cost_center}" description = "${var.description}" retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function_sqs_vpc/cloudwatch.tf b/apps/lambda_function_sqs_vpc/cloudwatch.tf index dd95d3b2..4dca9654 100644 --- a/apps/lambda_function_sqs_vpc/cloudwatch.tf +++ b/apps/lambda_function_sqs_vpc/cloudwatch.tf @@ -12,6 +12,7 @@ module "lambda_app_cloudwatch" { tags_cost_center = "${var.tags_cost_center}" description = "${var.description}" retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function_vpc/cloudwatch.tf b/apps/lambda_function_vpc/cloudwatch.tf index 5744b965..a8da1883 100644 --- a/apps/lambda_function_vpc/cloudwatch.tf +++ b/apps/lambda_function_vpc/cloudwatch.tf @@ -12,6 +12,7 @@ module "lambda_app_cloudwatch" { tags_purpose = "${var.tags_purpose}" description = "${var.description}" retention_days = "${var.retention_days}" + enable_cloudwatch_alarms = "${var.enable_cloudwatch_alarms}" providers = { aws = "aws" } diff --git a/apps/lambda_function_vpc/variables.tf b/apps/lambda_function_vpc/variables.tf index ec90db31..02107be3 100644 --- a/apps/lambda_function_vpc/variables.tf +++ b/apps/lambda_function_vpc/variables.tf @@ -149,3 +149,6 @@ variable "alarm_action_arn" { variable "reserved_concurrent_executions" { default = -1 } +variable "enable_cloudwatch_alarms" { + default = 1 +} \ No newline at end of file