Skip to content

Commit 93c13b2

Browse files
committed
Sanitize invalid cluster name (i.e. starts with aws, ecs, or fargate).
1 parent a5c8415 commit 93c13b2

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 0.2.1 (Mar 19, 2025)
2+
* Sanitize invalid cluster name (i.e. starts with `aws`, `ecs`, or `fargate`).
3+
14
# 0.2.0 (Mar 19, 2025)
25
* Upgrade `aws_launch_configuration` to `aws_launch_template`.
36

ecs.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
locals {
22
cluster_name = local.resource_name
3+
valid_cluster_name = (
4+
can(regex("^(aws|ecs|fargate)", local.cluster_name))
5+
? "_${local.cluster_name}"
6+
: local.cluster_name
7+
)
38
}
49

510
resource "aws_ecs_cluster" "this" {
6-
name = local.cluster_name
11+
name = local.valid_cluster_name
712
tags = local.tags
813

914
// TODO: Enable execute command with encryption configured on logging

0 commit comments

Comments
 (0)