Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore changes when deployment controller is codedeploy #127

Closed

Conversation

inhumantsar
Copy link

what

why

  • when deployment_controller is CODE_DEPLOY, network_configuration, task_definition, and desired_count must all be ignored.

references

@inhumantsar inhumantsar requested review from a team as code owners August 6, 2021 03:47
@inhumantsar inhumantsar requested a review from a team as a code owner August 6, 2021 03:47
@inhumantsar inhumantsar requested review from nitrocode and Benbentwo and removed request for a team August 6, 2021 03:47
@nitrocode
Copy link
Member

I don't think adding additional aws_ecs_service resources are a good idea. It's a lot to support and we were already pushing it with the last 2 additional resources.

See this PR #119 where the attempt is to output the information so you can construct your own aws_ecs_service outside of this repository.

@Nuru
Copy link
Contributor

Nuru commented Aug 24, 2021

I agree with @nitrocode , this module is already too repetitive, and it is a workaround for an upstream bug that has an approved PR fix. Let's see if we can wait it out.

We can reopen this in October 2021 for reconsideration if the upstream bug has still not been fixed.

@Nuru Nuru closed this Aug 24, 2021
@akramfstg
Copy link

akramfstg commented Aug 26, 2021

Hi,
I am encountering the same issue with my ECS service using Terraform 1.0.4. Here is a brief declaration of my resources:

resource "aws_ecs_service" "transcoder" {
  name            = local.prefix == "production" ? "transcoder" : "${local.prefix}-api"
  cluster         = aws_ecs_cluster.main.name
  task_definition = aws_ecs_task_definition.transcoder.family
  desired_count   = 1
  launch_type     = "FARGATE"
  #wait_for_steady_state = true

  # Type of deployment controller
  deployment_controller {
    type = "CODE_DEPLOY"
  }

And the code deployment group configuration is the following:

resource "aws_codedeploy_deployment_group" "transcoder_blue_green" {
  app_name               = aws_codedeploy_app.transcoder.name
  deployment_group_name  = "${local.prefix}-dg-transcoder"
  service_role_arn       = data.aws_iam_role.codedeploy.arn
  deployment_config_name = "CodeDeployDefault.ECSAllAtOnce"

  auto_rollback_configuration {
    enabled = true
    events  = ["DEPLOYMENT_FAILURE"]
  }

  blue_green_deployment_config {
    deployment_ready_option {
      action_on_timeout = "CONTINUE_DEPLOYMENT"
    }

    terminate_blue_instances_on_deployment_success {
      action                           = "TERMINATE"
      termination_wait_time_in_minutes = 5
    }
  }

  deployment_style {
    deployment_option = "WITH_TRAFFIC_CONTROL"
    deployment_type   = "BLUE_GREEN"
  }

  ecs_service {
    cluster_name = aws_ecs_cluster.main.name
    service_name = aws_ecs_service.transcoder.name
  }

  load_balancer_info {
    target_group_pair_info {

      prod_traffic_route {
        listener_arns = [aws_lb_listener.api.arn]
      }

      test_traffic_route {
        listener_arns = [aws_lb_listener.api.arn]
      }

      target_group {
        name = aws_lb_target_group.transcoder.name
      }

      target_group {
        name = aws_lb_target_group.green_transcoder.name
      }
    }
  }
}

I am unfortunately getting this exception that I could not understand or find a way out:

╷
│ Error: error updating ECS Service (arn:aws:ecs:eu-central-1:999618886922:service/1536-cluster/1536-api): InvalidParameterException: Unable to update task definition on services with a CODE_DEPLOY deployment controller. Use AWS CodeDeploy to trigger a new deployment.
│ 
│   with aws_ecs_service.transcoder,
│   on transcoder.tf line 59, in resource "aws_ecs_service" "transcoder":
│   59: resource "aws_ecs_service" "transcoder" {
````

Any suggestions please?

Thanks

@nitrocode
Copy link
Member

@akramdhiabii please see the messages above. We're working on it by allowing you to disable the ecs service so you can take advantage of only the iam roles and task definition. See #119

@akramfstg
Copy link

akramfstg commented Aug 30, 2021

@nitrocode Waiting for that would it be useful to taint the ECS service in addition to the above code deploy configuration in order perform the Blue/Green deployment?
Or is there any workaround available? that is actually impacting our deployments.
Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants