From f3992caf5d1008223c33bbad282d539ff27c7c2a Mon Sep 17 00:00:00 2001 From: abbas-khan10 Date: Mon, 16 Sep 2024 16:46:44 +0100 Subject: [PATCH] update resource names --- infrastructure/ecs.tf | 4 ++-- infrastructure/modules/ecs/main.tf | 6 +++--- infrastructure/modules/ecs/service.tf | 2 +- infrastructure/variable.tf | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/infrastructure/ecs.tf b/infrastructure/ecs.tf index 662e5111..03b8ee6f 100644 --- a/infrastructure/ecs.tf +++ b/infrastructure/ecs.tf @@ -35,13 +35,13 @@ module "ndr-ecs-container-port-ssm-parameter" { module "ndr-ecs-fargate-ods-update" { count = local.is_sandbox ? 0 : 1 source = "./modules/ecs" - ecs_cluster_name = "ods-weekly-update" + ecs_cluster_name = "ods-weekly-update-cluster" vpc_id = module.ndr-vpc-ui.vpc_id public_subnets = module.ndr-vpc-ui.public_subnets private_subnets = module.ndr-vpc-ui.private_subnets sg_name = "${terraform.workspace}-ods-weekly-update-sg" ecs_launch_type = "FARGATE" - ecs_cluster_service_name = "${terraform.workspace}-ods-weekly-update" + ecs_cluster_service_name = "${terraform.workspace}-ods-weekly-update-service" ecr_repository_url = module.ndr-docker-ecr-weekly-ods-update[0].ecr_repository_url environment = var.environment owner = var.owner diff --git a/infrastructure/modules/ecs/main.tf b/infrastructure/modules/ecs/main.tf index 04f25042..52ab74ea 100644 --- a/infrastructure/modules/ecs/main.tf +++ b/infrastructure/modules/ecs/main.tf @@ -1,5 +1,5 @@ resource "aws_ecs_task_definition" "ndr_ecs_task" { - family = "${terraform.workspace}-task-${var.ecs_cluster_name}" + family = "${terraform.workspace}-${var.ecs_cluster_name}-task" execution_role_arn = aws_iam_role.task_exec.arn task_role_arn = var.task_role network_mode = "awsvpc" @@ -9,7 +9,7 @@ resource "aws_ecs_task_definition" "ndr_ecs_task" { container_definitions = jsonencode([ { - name = "${terraform.workspace}-container-${var.ecs_cluster_name}" + name = "${terraform.workspace}-${var.ecs_cluster_name}-container" image = var.ecr_repository_url cpu = var.ecs_container_definition_cpu memory = var.ecs_container_definition_memory @@ -35,5 +35,5 @@ resource "aws_ecs_task_definition" "ndr_ecs_task" { } resource "aws_cloudwatch_log_group" "awslogs-ndr-ecs" { - name = "${terraform.workspace}-ecs-task-${var.ecs_cluster_name}" + name = "${terraform.workspace}-${var.ecs_cluster_name}-ecs-task" } diff --git a/infrastructure/modules/ecs/service.tf b/infrastructure/modules/ecs/service.tf index 67e97c11..4941748b 100644 --- a/infrastructure/modules/ecs/service.tf +++ b/infrastructure/modules/ecs/service.tf @@ -16,7 +16,7 @@ resource "aws_ecs_service" "ndr_ecs_service" { for_each = var.is_lb_needed ? toset([1]) : toset([]) content { target_group_arn = aws_lb_target_group.ecs_lb_tg[0].arn - container_name = "${terraform.workspace}-container-${var.ecs_cluster_name}" + container_name = "${terraform.workspace}-${var.ecs_cluster_name}-container" container_port = var.container_port } } diff --git a/infrastructure/variable.tf b/infrastructure/variable.tf index 64a50179..eae0207e 100644 --- a/infrastructure/variable.tf +++ b/infrastructure/variable.tf @@ -218,7 +218,7 @@ variable "cloudwatch_alarm_evaluation_periods" {} locals { is_sandbox = contains(["ndra", "ndrb", "ndrc", "ndrd"], terraform.workspace) - is_production = contains(["pre-prod", "prod"], terraform.workspace) + is_production = contains(["ndrb", "pre-prod", "prod"], terraform.workspace) is_force_destroy = contains(["ndr-dev", "ndra", "ndrb", "ndrc", "ndrd", "ndr-test"], terraform.workspace) is_sandbox_or_test = contains(["ndra", "ndrb", "ndrc", "ndrd", "ndr-test"], terraform.workspace)