Skip to content

Commit ebb605c

Browse files
author
jradtilbrook
committed
Fix template for lambda iam role
1 parent e97921c commit ebb605c

File tree

1 file changed

+52
-36
lines changed

1 file changed

+52
-36
lines changed

templates/aws-stack.yml

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -934,42 +934,58 @@ Resources:
934934
ManagedPolicyArns:
935935
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
936936
Policies:
937-
- PolicyName: AutoScalingGroups
938-
PolicyDocument:
939-
Version: '2012-10-17'
940-
Statement:
941-
- Effect: Allow
942-
Action:
943-
- autoscaling:DescribeAutoScalingGroups
944-
- autoscaling:SetDesiredCapacity
945-
Resource: '*'
946-
- !If
947-
- UseCustomerManagedKeyForParameterStore
948-
- - PolicyName: DecryptAgentToken
949-
PolicyDocument:
950-
Version: '2012-10-17'
951-
Statement:
952-
- Effect: Allow
953-
Action:
954-
- kms:Decrypt
955-
Resource: !Sub arn:aws:kms:${AWS::Region}:${AWS::AccountId}:key/${BuildkiteAgentTokenParameterStoreKMSKey}
956-
- PolicyName: ReadAgentToken
957-
PolicyDocument:
958-
Version: '2012-10-17'
959-
Statement:
960-
- Effect: Allow
961-
Action:
962-
- ssm:GetParameter
963-
Resource: !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${BuildkiteAgentTokenParameterStorePath}
964-
- !Ref 'AWS::NoValue'
965-
- PolicyName: WriteCloudwatchMetrics
966-
PolicyDocument:
967-
Version: '2012-10-17'
968-
Statement:
969-
- Effect: Allow
970-
Action:
971-
- cloudwatch:PutMetricData
972-
Resource: '*'
937+
!If
938+
- UseCustomerManagedKeyForParameterStore
939+
- - PolicyName: AutoScalingGroups
940+
PolicyDocument:
941+
Version: '2012-10-17'
942+
Statement:
943+
- Effect: Allow
944+
Action:
945+
- autoscaling:DescribeAutoScalingGroups
946+
- autoscaling:SetDesiredCapacity
947+
Resource: '*'
948+
- PolicyName: DecryptAgentToken
949+
PolicyDocument:
950+
Version: '2012-10-17'
951+
Statement:
952+
- Effect: Allow
953+
Action:
954+
- kms:Decrypt
955+
Resource: !Sub arn:aws:kms:${AWS::Region}:${AWS::AccountId}:key/${BuildkiteAgentTokenParameterStoreKMSKey}
956+
- PolicyName: ReadAgentToken
957+
PolicyDocument:
958+
Version: '2012-10-17'
959+
Statement:
960+
- Effect: Allow
961+
Action:
962+
- ssm:GetParameter
963+
Resource: !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${BuildkiteAgentTokenParameterStorePath}
964+
- PolicyName: WriteCloudwatchMetrics
965+
PolicyDocument:
966+
Version: '2012-10-17'
967+
Statement:
968+
- Effect: Allow
969+
Action:
970+
- cloudwatch:PutMetricData
971+
Resource: '*'
972+
- - PolicyName: AutoScalingGroups
973+
PolicyDocument:
974+
Version: '2012-10-17'
975+
Statement:
976+
- Effect: Allow
977+
Action:
978+
- autoscaling:DescribeAutoScalingGroups
979+
- autoscaling:SetDesiredCapacity
980+
Resource: '*'
981+
- PolicyName: WriteCloudwatchMetrics
982+
PolicyDocument:
983+
Version: '2012-10-17'
984+
Statement:
985+
- Effect: Allow
986+
Action:
987+
- cloudwatch:PutMetricData
988+
Resource: '*'
973989

974990
# This mirrors the group that would be created by the lambda, but enforces
975991
# a retention period and also ensures it's removed when the stack is removed

0 commit comments

Comments
 (0)