Skip to content

Commit

Permalink
update resource names
Browse files Browse the repository at this point in the history
  • Loading branch information
abbas-khan10 committed Sep 16, 2024
1 parent eedfbec commit f3992ca
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions infrastructure/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions infrastructure/modules/ecs/main.tf
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand All @@ -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"
}
2 changes: 1 addition & 1 deletion infrastructure/modules/ecs/service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f3992ca

Please sign in to comment.