Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions templates/aws-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ Parameters:
Default: ""

RootVolumeType:
Description: Type of root volume to use
Description: Type of root volume to use. If you are specifying `io1` or `io2`, you will most likely want to specify `RootVolumeIOPS` as well.
Type: String
Default: "gp3"

Expand Down Expand Up @@ -651,11 +651,13 @@ Parameters:

ECRAccessPolicy:
Type: String
Description: ECR access policy to give container instances
Description: ECR access policy to give instances. The `-pullthrough` variants add ECR pull-through cache permissions (including `ecr:CreateRepository`, `ecr:BatchImportUpstreamImage`, `ecr:GetImageCopyStatus`, and upload permissions) to enable transparent upstream registry caching.
AllowedValues:
- none
- readonly
- readonly-pullthrough
- poweruser
- poweruser-pullthrough
- full
Default: "none"

Expand Down Expand Up @@ -1015,6 +1017,11 @@ Conditions:
UseECR:
!Not [ !Equals [ !Ref ECRAccessPolicy, "none" ] ]

AddECRPullThrough:
!Or
- !Equals [ !Ref ECRAccessPolicy, "readonly-pullthrough" ]
- !Equals [ !Ref ECRAccessPolicy, "poweruser-pullthrough" ]

UseCustomerManagedParameterPath:
!Not [ !Equals [ !Ref BuildkiteAgentTokenParameterStorePath, "" ] ]
UseCustomerManagedKeyForParameterStore:
Expand Down Expand Up @@ -1116,10 +1123,12 @@ Conditions:

Mappings:
ECRManagedPolicy:
none : { Policy: '' }
readonly : { Policy: 'arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly' }
poweruser : { Policy: 'arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser' }
full : { Policy: 'arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryFullAccess' }
none : { Policy: '' }
readonly : { Policy: 'arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly' }
readonly-pullthrough : { Policy: 'arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly' }
poweruser : { Policy: 'arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser' }
poweruser-pullthrough : { Policy: 'arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser' }
full : { Policy: 'arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryFullAccess' }

# Generated from Makefile via build/mappings.yml
AWSRegion2AMI: { linuxamd64: !Ref ImageId, linuxarm64: !Ref ImageId, windows: !Ref ImageId }
Expand Down Expand Up @@ -1283,6 +1292,23 @@ Resources:
- !Ref 'AWS::NoValue'
- !Ref 'AWS::NoValue'
Policies:
- !If
- AddECRPullThrough
- PolicyName: ECRPullThrough
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- ecr:CreateRepository
- ecr:BatchImportUpstreamImage
- ecr:GetImageCopyStatus
- ecr:InitiateLayerUpload
- ecr:UploadLayerPart
- ecr:CompleteLayerUpload
- ecr:PutImage
Resource: "*"
- !Ref 'AWS::NoValue'
- !If
- HasPipelineSigningKMSKey
- PolicyName: PipelineSigningKMSKeyAccess
Expand Down