From ad3f988fbeb4c97e2d32bc9cec78dac8ab2fe4c0 Mon Sep 17 00:00:00 2001 From: Ronaldo Macapobre Date: Mon, 29 Jul 2024 17:07:50 +0000 Subject: [PATCH] - Renamed resources - Enabled public ip --- infrastructure/cloud/modules/container/ecr.tf | 2 +- infrastructure/cloud/modules/container/ecs.tf | 10 +++++----- infrastructure/cloud/modules/networking/elb.tf | 2 +- infrastructure/cloud/modules/networking/vpc.tf | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/infrastructure/cloud/modules/container/ecr.tf b/infrastructure/cloud/modules/container/ecr.tf index 922006c4..ee076325 100644 --- a/infrastructure/cloud/modules/container/ecr.tf +++ b/infrastructure/cloud/modules/container/ecr.tf @@ -8,6 +8,6 @@ resource "aws_ecr_repository" "ecr_repository" { } tags = { - name = "${var.app_name}-repo-${var.environment}" + name = "${var.app_name}-ecr-repo-${var.environment}" } } diff --git a/infrastructure/cloud/modules/container/ecs.tf b/infrastructure/cloud/modules/container/ecs.tf index 96e56f4f..de9a2d58 100644 --- a/infrastructure/cloud/modules/container/ecs.tf +++ b/infrastructure/cloud/modules/container/ecs.tf @@ -1,14 +1,14 @@ resource "aws_ecs_cluster" "ecs_cluster" { - name = "${var.app_name}-cluster-${var.environment}" + name = "${var.app_name}-ecs-cluster-${var.environment}" tags = { - name = "${var.app_name}-cluster-${var.environment}" + name = "${var.app_name}-ecs-cluster-${var.environment}" } } # Web resource "aws_ecs_task_definition" "ecs_web_task_definition" { - family = "${var.app_name}-web-task-${var.environment}" + family = "${var.app_name}-web-task-definition-${var.environment}" network_mode = "awsvpc" requires_compatibilities = ["FARGATE"] cpu = 256 @@ -33,7 +33,7 @@ resource "aws_ecs_task_definition" "ecs_web_task_definition" { } resource "aws_ecs_service" "ecs_web_service" { - name = "${var.app_name}-service-${var.environment}" + name = "${var.app_name}-ecs-web-service-${var.environment}" cluster = aws_ecs_cluster.ecs_cluster.id task_definition = aws_ecs_task_definition.ecs_web_task_definition.arn launch_type = "FARGATE" @@ -42,7 +42,7 @@ resource "aws_ecs_service" "ecs_web_service" { network_configuration { subnets = var.subnet_id security_groups = [var.ecs_sg_id] - assign_public_ip = false + assign_public_ip = true } load_balancer { diff --git a/infrastructure/cloud/modules/networking/elb.tf b/infrastructure/cloud/modules/networking/elb.tf index 203efb50..1e8a6cfc 100644 --- a/infrastructure/cloud/modules/networking/elb.tf +++ b/infrastructure/cloud/modules/networking/elb.tf @@ -14,7 +14,7 @@ resource "aws_lb" "lb" { resource "aws_lb_target_group" "lb_target_group" { - name = "${var.app_name}-tg-${var.environment}" + name = "${var.app_name}-lb-tg-${var.environment}" port = 80 protocol = "HTTP" vpc_id = aws_vpc.vpc.id diff --git a/infrastructure/cloud/modules/networking/vpc.tf b/infrastructure/cloud/modules/networking/vpc.tf index c701e975..e6bbeb68 100644 --- a/infrastructure/cloud/modules/networking/vpc.tf +++ b/infrastructure/cloud/modules/networking/vpc.tf @@ -29,7 +29,7 @@ resource "aws_route_table_association" "route_table_association" { } resource "aws_security_group" "ecs_security_group" { - name = "${var.app_name}-sg-${var.environment}" + name = "${var.app_name}-ecs-sg-${var.environment}" vpc_id = aws_vpc.vpc.id ingress { @@ -47,6 +47,6 @@ resource "aws_security_group" "ecs_security_group" { } tags = { - Name = "${var.app_name}-sg-${var.environment}" + Name = "${var.app_name}-ecs-sg-${var.environment}" } }