Skip to content

Commit

Permalink
chore: use null_resource for flyway ecs task trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellmueller committed Jan 27, 2025
1 parent e453cae commit 72fe664
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 0 additions & 4 deletions infrastructure/migration/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ data "aws_ecs_cluster" "ecs_cluster" {
cluster_name = "ecs-cluster-${var.app_name}"
}

resource "terraform_data" "trigger_deployment" {
input = "${timestamp()}"
}

module "flyway_task" {
source = "../modules/ecs-flyway-task"

Expand Down
8 changes: 7 additions & 1 deletion infrastructure/modules/ecs-flyway-task/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
resource "null_resource" "trigger_deployment" {
triggers = {
deployment_timestamp = timestamp()
}
}

resource "aws_ecs_task_definition" "flyway_task" {
family = "${var.app_name}-flyway-task"
network_mode = "awsvpc"
Expand Down Expand Up @@ -28,7 +34,7 @@ resource "aws_ecs_task_definition" "flyway_task" {
])

lifecycle {
replace_triggered_by = [terraform_data.trigger_deployment]
replace_triggered_by = [null_resource.trigger_deployment]
}

provisioner "local-exec" {
Expand Down
6 changes: 0 additions & 6 deletions infrastructure/modules/ecs-flyway-task/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ variable "flyway_image" {
type = string
}

variable "trigger_deployment" {
description = "Trigger for replacing the task definition"
type = any
default = null
}

variable "cpu" {
description = "Task CPU"
type = string
Expand Down

0 comments on commit 72fe664

Please sign in to comment.