diff --git a/terraform/modules/service/main.tf b/terraform/modules/service/main.tf index 210904b0..3e90eb3f 100644 --- a/terraform/modules/service/main.tf +++ b/terraform/modules/service/main.tf @@ -68,7 +68,7 @@ resource "aws_ecs_service" "this" { task_definition = aws_ecs_task_definition.this.arn desired_count = var.desired_count launch_type = "FARGATE" - platform_version = "1.4.0" + platform_version = var.fargate_version force_new_deployment = var.force_new_deployment propagate_tags = "SERVICE" @@ -88,7 +88,7 @@ resource "aws_ecs_service" "this" { } deployment_minimum_healthy_percent = 100 - health_check_grace_period_seconds = 300 + health_check_grace_period_seconds = var.health_check_grace_period_seconds } data "aws_iam_policy_document" "execution" { diff --git a/terraform/modules/service/variables.tf b/terraform/modules/service/variables.tf index a2831464..f1cc3d68 100644 --- a/terraform/modules/service/variables.tf +++ b/terraform/modules/service/variables.tf @@ -26,9 +26,9 @@ variable "cpu" { type = number } -# reference: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size -variable "memory" { - description = "Amount (in MiB) of memory used by the task." +variable "health_check_grace_period_seconds" { + default = null + description = "Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 2147483647. Only valid for services configured to use load balancers." type = number } @@ -65,6 +65,12 @@ variable "load_balancers" { default = [] } +# reference: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size +variable "memory" { + description = "Amount (in MiB) of memory used by the task." + type = number +} + variable "mount_points" { description = "The mount points for data volumes in your container" type = list(object({ @@ -87,6 +93,12 @@ variable "platform" { }) } +variable "fargate_version" { + default = "1.4.0" + description = "Platform version on which to run your service. Only applicable for launch_type set to FARGATE." + type = string +} + variable "port_mappings" { description = "The list of port mappings for the container. Port mappings allow containers to access ports on the host container instance to send or receive traffic. For task definitions that use the awsvpc network mode, only specify the containerPort. The hostPort can be left blank or it must be the same value as the containerPort" type = list(object({