Skip to content

Commit

Permalink
Feature/enable container insight option (#7)
Browse files Browse the repository at this point in the history
* (add): container insight toggle mode

* (add): container insight toggle mode
  • Loading branch information
xshot9011 committed May 27, 2022
1 parent 284f22a commit 752c46f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
args:
- "--args=--only=terraform_deprecated_interpolation"
- "--args=--only=terraform_deprecated_index"
# - "--args=--only=terraform_unused_declarations"
- "--args=--only=terraform_unused_declarations"
- "--args=--only=terraform_comment_syntax"
- "--args=--only=terraform_documented_outputs"
- "--args=--only=terraform_documented_variables"
Expand Down
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ locals {
resource "aws_ecs_cluster" "this" {
name = format("%s-cluster", local.cluster_name)

dynamic "setting" {
for_each = var.is_enable_container_insights ? [true] : []
content {
name = "containerInsights"
value = "enabled"
}
}

tags = merge(
local.tags,
{ "Name" = format("%s-cluster", local.cluster_name) }
Expand Down
11 changes: 10 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ variable "tags" {
}

/* -------------------------------------------------------------------------- */
/* SEcurity Group */
/* ECS Cluster */
/* -------------------------------------------------------------------------- */
variable "is_enable_container_insights" {
description = "Whether to be used to enable CloudWatch Container Insights for a cluster."
type = bool
default = true
}

/* -------------------------------------------------------------------------- */
/* Security Group */
/* -------------------------------------------------------------------------- */
variable "additional_security_group_ingress_rules" {
description = "Map of ingress and any specific/overriding attributes to be created"
Expand Down

0 comments on commit 752c46f

Please sign in to comment.