Skip to content

Commit

Permalink
Fix policy grant on ECR resource policy (#2159)
Browse files Browse the repository at this point in the history
### Testing:
Validated the YAML output with `cdk synth`.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
  • Loading branch information
skmcgrail authored Feb 3, 2025
1 parent 6c613fa commit cc9c9f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
5 changes: 3 additions & 2 deletions tests/ci/cdk/cdk/ecr_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ class EcrStack(Stack):
def __init__(self, scope: Construct, id: str, repo_name: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)

ecr.Repository(scope=self, id=id, repository_name=repo_name).grant_pull_push(
iam.ServicePrincipal("codebuild.amazonaws.com"))
repo = ecr.Repository(scope=self, id=id, repository_name=repo_name)
repo.grant_pull_push(iam.ServicePrincipal("codebuild.amazonaws.com"))
repo.grant_pull(iam.ArnPrincipal("arn:aws:iam::222961743098:role/scrutini-ecr"))
11 changes: 0 additions & 11 deletions tests/ci/cdk/util/iam_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,6 @@ def ecr_power_user_policy_in_json(ecr_repo_names):
"ecr:PutImage"
],
"Resource": ecr_arns
},
{
"Sid": "scrutinice",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::222961743098:role/scrutini-ecr"
},
"Action": [
"ecr:BatchGetImage",
"ecr:GetDownloadUrlForLayer"
]
}
]
}
Expand Down

0 comments on commit cc9c9f0

Please sign in to comment.