Skip to content

ECR: add repository permission/policy #582

@maust

Description

@maust

Is your feature request related to a problem?
Each of our environments are separated into AWS accounts, as part of the staging process we copy the needed docker images from the development account into the production account. Therefore we currently add a read permission on the ECR repository in the development account to the production AWS account.

Currently this is done using terraform, but we would like to remove the ECR repositories in terraform and use the ECR controller, example:

resource "aws_ecr_repository_policy" "policy" {
  repository = "REPOSITORY_NAME"
  policy = <<EOF
{
  "Version": "2008-10-17",
  "Statement": [
    {
      "Sid": "AllowCrossAccountRead",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::AWS_ACCOUNT_PRODUCTION:root"
      },
      "Action": [
        "ecr:BatchGetImage",
        "ecr:BatchCheckLayerAvailability",
        "ecr:GetDownloadUrlForLayer",
        "ecr:ListImages"
      ]
    }
  ]
}
EOF
}

Describe the solution you'd like
Allow managing ECR repository policies/permission. In our case the policy is always the same for all ECR repositories (e.g. could be stored as configmap).

Describe alternatives you've considered
As a workaround we will just use a cron job adding the policy for all our ECR repositories.

Metadata

Metadata

Assignees

Labels

kind/enhancementCategorizes issue or PR as related to existing feature enhancements.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions