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: Optionally lookup for the latest task definition #163

Conversation

domcleal
Copy link
Contributor

Description

A data lookup for the latest task definition revision to be used in the
ECS service was enabled by default, which continually appeared in
plans/applies.

This is used when the task definition's updated by an external
deployment tool, so this is now disabled and requires enabling the
external_task_definition_updates variable so the default behaviour is
quiet.

Motivation and Context

A fix for #72 as an alternative to #124 which removed the functionality for external deployment tools.

I don't need the external tool support, but I am trying to make the default behaviour quieter and not show this update on every run.

Breaking Changes

Yes, for people using external deployment tools, they should set this new external_task_definition_updates variable to true. This feels like the exception as the default behaviour of the module is to deploy the task definition itself.

How Has This Been Tested?

Two tests, one with the default behaviour (external_task_definition_updates set to false) and verified with a plan that there are no proposed changes/noise:

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.

and again with it set to true shows the previous behaviour:

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place
 <= read (data resources)

Terraform will perform the following actions:

  # module.atlantis.data.aws_ecs_task_definition.atlantis[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_ecs_task_definition" "atlantis"  {
      + family          = (known after apply)
      + id              = (known after apply)
      + network_mode    = (known after apply)
      + revision        = (known after apply)
      + status          = (known after apply)
      + task_definition = "atlantis"
      + task_role_arn   = (known after apply)
    }

  # module.atlantis.aws_ecs_service.atlantis will be updated in-place
  ~ resource "aws_ecs_service" "atlantis" {
        cluster                            = "arn:aws:ecs:eu-west-1:...:cluster/atlantis"
        deployment_maximum_percent         = 200
        deployment_minimum_healthy_percent = 50
        desired_count                      = 1
        enable_ecs_managed_tags            = false
        health_check_grace_period_seconds  = 0
        iam_role                           = "aws-service-role"
        id                                 = "arn:aws:ecs:eu-west-1:...:service/atlantis/atlantis"
        launch_type                        = "FARGATE"
        name                               = "atlantis"
        platform_version                   = "LATEST"
        propagate_tags                     = "NONE"
        scheduling_strategy                = "REPLICA"
        tags                               = {
            "Name" = "atlantis"
        }
      ~ task_definition                    = "atlantis:3" -> (known after apply)

        deployment_controller {
            type = "ECS"
        }

        load_balancer {
            container_name   = "atlantis"
            container_port   = 4141
            target_group_arn = "arn:aws:elasticloadbalancing:eu-west-1:...:targetgroup/atlantis/5af07546b36138a7"
        }

        network_configuration {
            assign_public_ip = false
            security_groups  = [
                "sg-063b57edb4bf146f1",
            ]
            subnets          = [
                "subnet-03b28a46d19970c62",
                "subnet-0c1bf5c14d0d97232",
                "subnet-0fa2dd26cbd903e82",
            ]
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

…m-aws-modules#72)

A data lookup for the latest task definition revision to be used in the
ECS service was enabled by default, which continually appeared in
plans/applies.

This is used when the task definition's updated by an external
deployment tool, so this is now disabled and requires enabling the
`external_task_definition_updates` variable so the default behaviour is
quiet.
@domcleal domcleal force-pushed the 72-externally-updated-task-def branch from fbeb565 to 0993a8f Compare October 30, 2020 16:46
@tomwj
Copy link

tomwj commented Oct 30, 2020

Nice this looks like an elegant work around given the context.

@parmouraly
Copy link
Contributor

Hi @antonbabenko
Any chance we can get this merged?
Wanted to stop using our fork and this is one of the outstanding issues before we flip back to the using the latest release

@antonbabenko antonbabenko changed the title fix: Don't look up latest task definition by default (closes #72) fix: Don't look up latest task definition by default Mar 16, 2021
@antonbabenko antonbabenko changed the title fix: Don't look up latest task definition by default fix: Optionally lookup for the latest task definition Mar 16, 2021
@antonbabenko antonbabenko merged commit 0d84ed4 into terraform-aws-modules:master Mar 16, 2021
@antonbabenko
Copy link
Member

Thanks to everyone involved for this improvement.

Fixes #72. Fixes #124.

v2.36.0 has been just released.

@github-actions
Copy link

github-actions bot commented Nov 9, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants