Terraform resource: aws ecr repository policy

From wikieduonline
Revision as of 08:01, 17 May 2023 by Welcome (talk | contribs)
Jump to navigation Jump to search
  • aws_ecr_repository_policy ref


Example

resource "aws_ecr_repository_policy" "access_policy" {
 for_each   = toset(var.your-org_ecr_repos)
 repository = each.key

 policy = <<EOF
{
 "Version": "2008-10-17",
 "Statement": [
   {
     "Sid": "AllowPushPull",
     "Effect": "Allow",
     "Principal": {
       "AWS": [
         "arn:aws:iam::0123456789:root",
         "arn:aws:iam::9876543210:user/MyAdmin"
       ]
     },
     "Action": [
       "ecr:GetDownloadUrlForLayer",
       "ecr:BatchGetImage",
       "ecr:BatchCheckLayerAvailability",
       "ecr:PutImage",
       "ecr:InitiateLayerUpload",
       "ecr:UploadLayerPart",
       "ecr:CompleteLayerUpload"
     ]
   }
 ]
}
EOF

 depends_on = [aws_ecr_repository.your-org_repos]
}


Related

See also

Advertising: