diff --git a/infrastructure/cloud/environments/sandbox/webapp.tf b/infrastructure/cloud/environments/sandbox/webapp.tf index f4149953..5e13706b 100644 --- a/infrastructure/cloud/environments/sandbox/webapp.tf +++ b/infrastructure/cloud/environments/sandbox/webapp.tf @@ -25,6 +25,7 @@ module "container" { source = "../../modules/container" environment = var.environment app_name = var.app_name + region = var.region ecs_web_task_execution_iam_role_arn = module.security.ecs_web_task_execution_iam_role_arn subnet_id = module.networking.subnet_id ecs_sg_id = module.networking.ecs_sg_id diff --git a/infrastructure/cloud/modules/container/ecs.tf b/infrastructure/cloud/modules/container/ecs.tf index de9a2d58..89485d61 100644 --- a/infrastructure/cloud/modules/container/ecs.tf +++ b/infrastructure/cloud/modules/container/ecs.tf @@ -25,6 +25,15 @@ resource "aws_ecs_task_definition" "ecs_web_task_definition" { hostPort = var.web_port } ] + logConfiguration = { + logDriver = "awslogs" + options = { + awslogs-create-group = "true" + awslogs-group = "/ecs/${var.app_name}" + awslogs-region = var.region + awslogs-stream-prefix = "ecs" + } + } } ]) diff --git a/infrastructure/cloud/modules/container/variables.tf b/infrastructure/cloud/modules/container/variables.tf index 1769a029..07f32f8a 100644 --- a/infrastructure/cloud/modules/container/variables.tf +++ b/infrastructure/cloud/modules/container/variables.tf @@ -8,6 +8,11 @@ variable "app_name" { type = string } +variable "region" { + description = "The AWS region" + type = string +} + variable "ecs_web_task_execution_iam_role_arn" { description = "ECS Task Execution IAM Role ARN for Web app" } @@ -43,5 +48,5 @@ variable "api_image_name" { variable "web_port" { description = "Port Number of the Web app" type = number - default = 80 + default = 8080 } diff --git a/infrastructure/cloud/modules/networking/vpc.tf b/infrastructure/cloud/modules/networking/vpc.tf index e6bbeb68..3ec3cfd4 100644 --- a/infrastructure/cloud/modules/networking/vpc.tf +++ b/infrastructure/cloud/modules/networking/vpc.tf @@ -33,8 +33,8 @@ resource "aws_security_group" "ecs_security_group" { vpc_id = aws_vpc.vpc.id ingress { - from_port = 80 - to_port = 80 + from_port = 8080 + to_port = 8080 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] }