You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1012 B

resource "aws_ecs_service" "api_ecs" {
name = "${var.project}-api"
task_definition = aws_ecs_task_definition.api_task.arn
launch_type = "FARGATE"
}
resource "aws_ecs_task_definition" "api_task" {
family = "${var.project}-api"
cpu = 256
memory = 512
requires_compatibilities = ["FARGATE"]
network_mode = "awsvpc"
execution_role_arn = aws_iam_role.api_exec_role.arn
container_definitions = jsonencode([
{
name = "${var.project}-api",
image = var.container_image,
portMappings = [
{
containerPort = 3000
}
],
logConfiguration = {
logDriver = "awslogs",
options = {
awslogs-region = var.region,
awslogs-group = "/ecs/${var.project}-api",
awslogs-stream-prefix = "ecs"
}
}
}
])
}
resource "aws_cloudwatch_log_group" "log_group" {
name = "/ecs/${var.project}-api"
}