Skip to content

Replace hack with track_latest attribute #164

@bryantbiggs

Description

@bryantbiggs

Is your request related to a new offering from AWS?

Is this functionality available in the AWS provider for Terraform? See CHANGELOG.md, too.

  • No 🛑: please wait to file a request until the functionality is avaialble in the AWS provider
  • Yes ✅: please list the AWS provider version which introduced this functionality

Is your request related to a problem? Please describe.

  • This ugly hack
    # This allows us to query both the existing as well as Terraform's state and get
    # and get the max version of either source, useful for when external resources
    # update the container definition
    max_task_def_revision = local.create_task_definition ? max(aws_ecs_task_definition.this[0].revision, data.aws_ecs_task_definition.this[0].revision) : 0
    task_definition = local.create_task_definition ? "${aws_ecs_task_definition.this[0].family}:${local.max_task_def_revision}" : var.task_definition_arn
    }
    # This allows us to query both the existing as well as Terraform's state and get
    # and get the max version of either source, useful for when external resources
    # update the container definition
    data "aws_ecs_task_definition" "this" {
    count = local.create_task_definition ? 1 : 0
    task_definition = aws_ecs_task_definition.this[0].family
    depends_on = [
    # Needs to exist first on first deployment
    aws_ecs_task_definition.this
    ]
    }

Describe the solution you'd like.

Describe alternatives you've considered.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions