From dc462c00e3abd7b9789e7ce25cab98e0870d83aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Tobias=20Skjong-B=C3=B8rsting?= Date: Wed, 1 Mar 2023 16:03:01 +0100 Subject: [PATCH] Add optional task_definition variable, use it if non-empty (#61) * Add optional task_definition variable, use it if non-empty * Update main.tf --------- Co-authored-by: Sadri Gargouri <74971461+SadriG91@users.noreply.github.com> --- main.tf | 2 +- variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 690ec20..b5ccf61 100644 --- a/main.tf +++ b/main.tf @@ -212,7 +212,7 @@ resource "aws_ecs_service" "service" { ] name = var.name_prefix cluster = var.cluster_id - task_definition = aws_ecs_task_definition.task.arn + task_definition = var.task_definition != "" ? var.task_definition : aws_ecs_task_definition.task.arn desired_count = var.desired_count launch_type = "FARGATE" deployment_minimum_healthy_percent = var.deployment_minimum_healthy_percent diff --git a/variables.tf b/variables.tf index f3f4c5f..242c181 100644 --- a/variables.tf +++ b/variables.tf @@ -84,6 +84,12 @@ variable "task_container_protocol" { type = string } +variable "task_definition" { + description = "Provided task definition for the service." + default = "" + type = string +} + variable "task_definition_cpu" { description = "Amount of CPU to reserve for the task." default = 256