Skip to content

Commit

Permalink
Added log groups and change port to 8080
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronaldo Macapobre committed Jul 29, 2024
1 parent 7b7ddc4 commit 6fdae6b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions infrastructure/cloud/environments/sandbox/webapp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions infrastructure/cloud/modules/container/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
])

Expand Down
7 changes: 6 additions & 1 deletion infrastructure/cloud/modules/container/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -43,5 +48,5 @@ variable "api_image_name" {
variable "web_port" {
description = "Port Number of the Web app"
type = number
default = 80
default = 8080
}
4 changes: 2 additions & 2 deletions infrastructure/cloud/modules/networking/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
Expand Down

0 comments on commit 6fdae6b

Please sign in to comment.