Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion terraform/modules/ecs-service/ecs_task_definition.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ resource "aws_ecs_task_definition" "this" {
network_mode = var.network_mode
pid_mode = var.pid_mode

memory = var.container_memory_hard_limit
# TODO: Task-level cpu and memory values have been set using default/conservative values.
# They should be verified based on CloudWatch Container Insights or actual production metrics.
cpu = var.task_cpu != null ? var.task_cpu : 1024
memory = var.task_memory != null ? var.task_memory : var.container_memory_hard_limit

dynamic "placement_constraints" {
for_each = var.placement_constraints
Expand Down
12 changes: 12 additions & 0 deletions terraform/modules/ecs-service/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,15 @@ variable "use_load_balancer" {
type = bool
default = false
}

variable "task_cpu" {
description = "The number of cpu units used by the task. If not specified, a conservative default of 1024 is used."
type = number
default = null
}

variable "task_memory" {
description = "The amount (in MiB) of memory used by the task. If not specified, defaults to container_memory_hard_limit for backward compatibility."
type = number
default = null
}