Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
BATIAI-1443: Updating to create cluster by default (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
bushong1 authored Mar 17, 2023
1 parent 8ec4238 commit 9131f4a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [5.0.0] - 2023-03-17
### Breaking
- Now will create the ECS cluster for you unless disabled with `create_ecs_cluster = false`

## [4.0.0] - 2022-02-15
### Breaking
- Removing the unneeded var nat_gateway_public_ip_cidrs
Expand Down
18 changes: 17 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module "gatus" {

container_port = 8080

cluster_name = var.cluster_name
cluster_name = var.create_ecs_cluster ? aws_ecs_cluster.cluster[0].name : data.aws_ecs_cluster.cluster[0].cluster_name

iam_role_path = var.iam_role_path
iam_role_permissions_boundary = var.iam_role_permissions_boundary
Expand Down Expand Up @@ -182,3 +182,19 @@ resource "aws_security_group_rule" "allow_fargate_into_efs" {
security_group_id = aws_security_group.efs.id
source_security_group_id = module.gatus.security_group_id
}

# Create or fetch the ECS cluster
resource "aws_ecs_cluster" "cluster" {
count = var.create_ecs_cluster ? 1 : 0
name = var.cluster_name

setting {
name = "containerInsights"
value = "enabled"
}
}

data "aws_ecs_cluster" "cluster" {
count = var.create_ecs_cluster ? 0 : 1
cluster_name = var.cluster_name
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ variable "kms_key_id" {
description = "For encrypting the EFS drive; defaults to the aws managed efs key"
type = string
}

variable "create_ecs_cluster" {
default = true
type = bool
description = "Toggles either creating the ECS Cluster or looking up an existing one"
}

0 comments on commit 9131f4a

Please sign in to comment.