terraform-aws-ecs-fargate-scheduled-task icon indicating copy to clipboard operation
terraform-aws-ecs-fargate-scheduled-task copied to clipboard

Unable to hold deployed task definition

Open Jatin3708 opened this issue 2 years ago • 0 comments
trafficstars

Hi Team,

I have used this module to create scheduled task. When i am deploying scheduled task using terraform its working fine. Post this activity we are deploying new code via Jenkins pipeline into scheduled task so accordingly task definition getting updated in scheduled task.

Now at some instance if i am updating something in scheduled task for having some new feature and execute terraform pipeline then this pipeline execution reverting back latest task definition from scheduled task and its bringing back task definition to older one which is stored in state file, this is causing application break.

Similar pipeline i am using for normal ecs service deployment where i haven't seen this type of behaviour.

Can you let me know if i am doing something wrong here?

My code snippet :

module "scheduled-task" {
  source                                      = "cn-terraform/ecs-fargate-scheduled-task/aws"
  version                                     = "~> 1.0.22"
  ecs_cluster_arn                             = var.cluster_arn
  ecs_execution_task_role_arn                 = var.ecs_task_execution_role_arn
  ecs_task_role_arn                           = var..ecs_task_role_arn
  event_rule_description                      = "This event rule will trigger ECS Task "
  event_rule_name                             = var.eventrulename
  event_rule_schedule_expression              = "rate(1 hour)"
  event_target_ecs_target_subnets             = var.vpc.private_subnets
  event_target_ecs_target_security_groups     = var.security_group_id
  event_target_ecs_target_task_definition_arn = var.ecs_task_definition_arn
  event_target_ecs_target_assign_public_ip    = true
  name_prefix                                 = var.nameprefix
  event_target_target_id                      = "1"
}

Thanks.

Jatin3708 avatar Nov 28 '22 14:11 Jatin3708