Skip to content

Commit 41983bb

Browse files
committed
[BugFix] Explicitly set the policy for ECR private repo
to prevent policy removal on stack update, which is potentially impacting the PCUI Lambda function.
1 parent 5e935a7 commit 41983bb

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

infrastructure/parallelcluster-ui.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,30 @@ Resources:
562562
RepositoryName: !Sub
563563
- 'parallelcluster-ui-${StackIdSuffix}'
564564
- { StackIdSuffix: !Select [2, !Split ['/', !Ref 'AWS::StackId']] }
565+
RepositoryPolicyText:
566+
Version: 2012-10-17
567+
Statement:
568+
- Sid: ReadEcrImages
569+
Effect: Allow
570+
Principal:
571+
Service: lambda.amazonaws.com
572+
Action:
573+
- ecr:BatchGetImage
574+
- ecr:GetDownloadUrlForLayer
575+
Condition:
576+
StringLike:
577+
aws:SourceArn: !Sub arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:*
578+
- Sid: ReadWriteEcrPolicy
579+
Effect: Allow
580+
Principal:
581+
Service: lambda.amazonaws.com
582+
Action:
583+
- ecr:DeleteRepositoryPolicy
584+
- ecr:GetRepositoryPolicy
585+
- ecr:SetRepositoryPolicy
586+
Condition:
587+
StringLike:
588+
aws:SourceArn: !Sub arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:*
565589

566590
ImageBuilderInstanceRole:
567591
Type: AWS::IAM::Role

0 commit comments

Comments
 (0)