Skip to content

Commit

Permalink
Fix hazard during autoscaling task replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Kossakowski committed Dec 4, 2023
1 parent 137a02c commit d6a7aad
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ locals {
role_arn = length(var.execution_role_arn) > 0 ? var.execution_role_arn : aws_iam_role.execution_role[0].arn
}

resource "null_resource" "always_run" {
triggers = {
timestamp = "${timestamp()}"
}
}

resource "aws_ecs_task_definition" "task" {
family = "${var.name}-task"
requires_compatibilities = ["FARGATE"]
Expand Down Expand Up @@ -44,6 +50,12 @@ resource "aws_ecs_task_definition" "task" {
ephemeral_storage {
size_in_gib = var.ephemeral_storage_gib
}

lifecycle {
replace_triggered_by = [
null_resource.always_run
]
}
}

resource "aws_security_group" "service_security_group" {
Expand Down

0 comments on commit d6a7aad

Please sign in to comment.