@@ -110,6 +110,11 @@ Parameters:
110
110
Type : String
111
111
Default : " "
112
112
113
+ BuildkiteAgentTokenParameterStoreKMSKey :
114
+ Description : AWS KMS key ID used to encrypt the SSM parameter (if encrypted)
115
+ Type : String
116
+ Default : " "
117
+
113
118
BuildkiteAgentTags :
114
119
Description : Additional tags seperated by commas to provide to the agent. E.g os=linux,llamas=always
115
120
Type : String
@@ -272,11 +277,6 @@ Parameters:
272
277
Description : Optional - Comma separated list of managed IAM policy ARNs to attach to the instance role
273
278
Default : " "
274
279
275
- LambdaManagedPolicyARN :
276
- Type : CommaDelimitedList
277
- Description : Optional - Comma separated list of managed IAM policy ARNs to attach to the autoscaling lambda
278
- Default : " "
279
-
280
280
InstanceRoleName :
281
281
Type : String
282
282
Description : Optional - A name for the IAM Role attached to the Instance Profile
@@ -426,15 +426,15 @@ Conditions:
426
426
UseManagedPolicyARN :
427
427
!Not [ !Equals [ !Join [ "", !Ref ManagedPolicyARN ], "" ] ]
428
428
429
- UseLambdaManagedPolicyARN :
430
- !Not [ !Equals [ !Join [ "", !Ref LambdaManagedPolicyARN ], "" ] ]
431
-
432
429
UseECR :
433
430
!Not [ !Equals [ !Ref ECRAccessPolicy, "none" ] ]
434
431
435
432
UseSSMAgentToken :
436
433
!Not [ !Equals [ !Ref BuildkiteAgentTokenParameterStorePath, "" ] ]
437
434
435
+ AgentTokenEncrypted :
436
+ !Not [ !Equals [ !Ref BuildkiteAgentTokenParameterStoreKMSKey, "" ] ]
437
+
438
438
HasVariableSize :
439
439
!Not [ !Equals [ !Ref MaxSize, !Ref MinSize ] ]
440
440
@@ -916,15 +916,7 @@ Resources:
916
916
Action :
917
917
- sts:AssumeRole
918
918
ManagedPolicyArns : !Split
919
- - ' ,'
920
- - !Join
921
- - ' ,'
922
- - - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
923
- - !If
924
- - UseLambdaManagedPolicyARN
925
- - !Ref ' AWS::NoValue'
926
- - !Join [ ',', !Ref LambdaManagedPolicyARN ] ]
927
- - !Ref ' AWS::NoValue'
919
+ - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
928
920
Policies :
929
921
- PolicyName : AutoScalingGroups
930
922
PolicyDocument :
@@ -935,6 +927,25 @@ Resources:
935
927
- autoscaling:DescribeAutoScalingGroups
936
928
- autoscaling:SetDesiredCapacity
937
929
Resource : ' *'
930
+ - !If
931
+ - AgentTokenEncrypted
932
+ - - PolicyName : DecryptAgentToken
933
+ PolicyDocument :
934
+ Version : ' 2012-10-17'
935
+ Statement :
936
+ - Effect : Allow
937
+ Action :
938
+ - kms:Decrypt
939
+ Resource : !Sub arn:aws:kms:${AWS::Region}:${AWS::AccountId}:key/${BuildkiteAgentTokenParameterStoreKMSKey}
940
+ - PolicyName : ReadAgentToken
941
+ PolicyDocument :
942
+ Version : ' 2012-10-17'
943
+ Statement :
944
+ - Effect : Allow
945
+ Action :
946
+ - ssm:GetParameter
947
+ Resource : !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${BuildkiteAgentTokenParameterStorePath}
948
+ - !Ref ' AWS::NoValue'
938
949
- PolicyName : WriteCloudwatchMetrics
939
950
PolicyDocument :
940
951
Version : ' 2012-10-17'
0 commit comments