From ce0d747c930453a7e8e63db3f9bae25fffffac4d Mon Sep 17 00:00:00 2001 From: hutemai <45021809+hutemai@users.noreply.github.com> Date: Mon, 19 Jul 2021 23:04:47 +0300 Subject: [PATCH] added ability to enable/disable cw container insights (#18) Co-authored-by: rshved --- README.md | 1 + ecs-cluster.tf | 5 +++++ variables.tf | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 6f79c83..01f241b 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ EOF | autoscaling\_cpu\_low\_threshold | Autoscaling CPU threshold for scale-down | string | `40` | no | | availability\_zones | List of availability zones which will be provisined by autoscailing group | list | `[]` | yes | | vpc\_id | The ID of VPC | string | - | yes | +| container\_insights\_monitoring | Defines enable/disable Cloudwatch Container Insights monitoring | string | `disabled` | no | ### Container definitions default value diff --git a/ecs-cluster.tf b/ecs-cluster.tf index b07364e..03d7e4b 100644 --- a/ecs-cluster.tf +++ b/ecs-cluster.tf @@ -1,6 +1,11 @@ resource "aws_ecs_cluster" "this" { count = var.use_existant_cluster ? 0 : 1 name = "${var.project}-${var.environment}" + + setting { + name = "containerInsights" + value = var.container_insights_monitoring + } tags = merge(local.default_tags, var.tags) } diff --git a/variables.tf b/variables.tf index e8c9b67..faf74c4 100644 --- a/variables.tf +++ b/variables.tf @@ -159,3 +159,7 @@ variable "autoscaling_cpu_low_threshold" { default = "40" } +variable "container_insights_monitoring" { + description = "Defines enable/disable Cloudwatch Container Insights monitoring" + default = "disabled" +}