From 03d6c029d79c4494fe654755d9b72db4dc89ac9f Mon Sep 17 00:00:00 2001 From: OMPRAKASH MISHRA Date: Wed, 25 Jun 2025 14:50:15 -0700 Subject: [PATCH] fix: few issues --- .github/scripts/resume.sh | 12 +++++++++++- infrastructure/api/ecs.tf | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/scripts/resume.sh b/.github/scripts/resume.sh index 2c364ce9..ddeeedd5 100644 --- a/.github/scripts/resume.sh +++ b/.github/scripts/resume.sh @@ -62,7 +62,17 @@ resume_ecs_service() { local service="${prefix}-node-api-${env}" echo "Resuming ECS service ${service} on cluster ${cluster}..." - + # Check if the ECS cluster exists + if ! aws ecs describe-clusters --clusters "${cluster}" --query 'clusters[0]' --output text &>/dev/null; then + echo "ECS cluster ${cluster} does not exist. Skipping service resume." + return 0 + fi + + # Check if the ECS service exists + if ! aws ecs describe-services --cluster "${cluster}" --services "${service}" --query 'services[0]' --output text &>/dev/null; then + echo "ECS service ${service} does not exist in cluster ${cluster}. Skipping service resume." + return 0 + fi # Update scaling policy aws application-autoscaling register-scalable-target \ --service-namespace ecs \ diff --git a/infrastructure/api/ecs.tf b/infrastructure/api/ecs.tf index e69f0c51..a23b06ce 100644 --- a/infrastructure/api/ecs.tf +++ b/infrastructure/api/ecs.tf @@ -108,7 +108,7 @@ resource "aws_ecs_task_definition" "flyway_task" { while [[ $attempt -le $max_attempts ]]; do echo "Starting Flyway task (attempt $attempt)..." task_arn=$(aws ecs run-task \ - --task-definition ${var.app_name}-flyway-task \ + --task-definition ${var.app_name}-flyway \ --cluster ${aws_ecs_cluster.ecs_cluster.id} \ --count 1 \ --network-configuration "{\"awsvpcConfiguration\":{\"subnets\":[\"${data.aws_subnets.app.ids[0]}\"],\"securityGroups\":[\"${data.aws_security_group.app.id}\"],\"assignPublicIp\":\"DISABLED\"}}" \