Skip to content

Commit 426999a

Browse files
authored
change the department name to snake case to meet the role name (#2121)
* change the department name to snake case to make the role name * update * revert the department ecs role * keep the department_ecs_role as snake case as well
1 parent d5fb086 commit 426999a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

terraform/modules/department/50-aws-iam-policies.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -933,10 +933,8 @@ data "aws_iam_policy_document" "department_ecs_passrole" {
933933
"iam:PassRole"
934934
]
935935
resources = [
936-
aws_iam_role.department_ecs_role.arn,
937-
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${local.department_identifier}-ecs-execution-role",
938-
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/dap-ecs-execution-role",
939-
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/dap-ecs-task-role"
936+
aws_iam_role.department_ecs_role.arn, # Defined in 50-aws-iam-roles.tf
937+
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${replace(local.department_identifier, "-", "_")}-ecs-execution-role", # Defined in ecs repo.
940938
]
941939
condition {
942940
test = "StringEquals"

terraform/modules/department/50-aws-iam-roles.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ resource "aws_secretsmanager_secret_version" "airflow_user_secret_version" {
143143

144144
# Department ECS
145145
resource "aws_iam_role" "department_ecs_role" {
146-
name = lower("${var.identifier_prefix}-ecs-${local.department_identifier}")
146+
name = lower("${var.identifier_prefix}-ecs-${replace(local.department_identifier, "-", "_")}")
147147
assume_role_policy = data.aws_iam_policy_document.ecs_assume_role_policy.json
148148
tags = var.tags
149149
}

0 commit comments

Comments
 (0)