Data Source: aws_ecr_lifecycle_policy_document

Generates an ECR lifecycle policy document in JSON format. Can be used with resources such as the aws_ecr_lifecycle_policy resource.

Example Usage

data "aws_ecr_lifecycle_policy_document" "example" {
  rule {
    priority    = 1
    description = "This is a test."

    selection {
      tag_status      = "tagged"
      tag_prefix_list = ["prod"]
      count_type      = "imageCountMoreThan"
      count_number    = 100
    }
  }
}

resource "aws_ecr_lifecycle_policy" "example" {
  repository = aws_ecr_repository.example.name

  policy = data.aws_ecr_lifecycle_policy_document.example.json
}

Argument Reference

This data source supports the following arguments:

Each document configuration may have one or more rule blocks, which each accept the following arguments:

Attribute Reference

This data source exports the following attributes in addition to the arguments above: