File tree Expand file tree Collapse file tree 3 files changed +47
-3
lines changed Expand file tree Collapse file tree 3 files changed +47
-3
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "Effect" : " Allow" ,
3
+ "Action" : [
4
+ " ec2:DescribeInstances*" ,
5
+ " ec2:DescribeTags" ,
6
+ " ec2:CreateTags" ,
7
+ " ec2:TerminateInstances"
8
+ ],
9
+ "Resource" : [" *" ]
10
+ },
11
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "Effect" : " Allow" ,
3
+ "Action" : [
4
+ " ec2:DescribeInstances" ,
5
+ " ec2:DescribeTags" ,
6
+ " ec2:CreateTags" ,
7
+ " ec2:RunInstances" ,
8
+ ],
9
+ "Resource" : [" *" ]
10
+ },
11
+ {
12
+ "Effect" : " Allow" ,
13
+ "Action" : " iam:PassRole" ,
14
+ "Resource" : " ${arn_runner_instance_role}"
15
+ }
16
+ }
Original file line number Diff line number Diff line change @@ -59,17 +59,34 @@ resource "aws_iam_policy_attachment" "scale_runners_lambda_logging" {
59
59
policy_arn = aws_iam_policy. lambda_logging . arn
60
60
}
61
61
62
- resource "aws_iam_policy" "scale_runners_lambda " {
62
+ resource "aws_iam_policy" "scale_runners_lambda_sqs " {
63
63
name = " ${ var . environment } -lamda-scale-runners-sqs-receive-policy"
64
- description = " Lambda webhook policy"
64
+ description = " Lambda scale up sqs policy"
65
65
66
66
policy = templatefile (" ${ path . module } /policies/lambda-scale-runners.json" , {
67
67
sqs_arn = var.sqs.arn
68
68
})
69
69
}
70
70
71
+ resource "aws_iam_policy_attachment" "scale_runners_lambda_sqs" {
72
+ name = " ${ var . environment } -scale-up-sqs"
73
+ roles = [aws_iam_role . scale_runners_lambda . name ]
74
+ policy_arn = aws_iam_policy. scale_runners_lambda_sqs . arn
75
+ }
76
+
77
+
78
+ resource "aws_iam_policy" "scale_runners_lambda" {
79
+ name = " ${ var . environment } -lamda-scale-up-policy"
80
+ description = " Lambda scale up policy"
81
+
82
+ policy = templatefile (" ${ path . module } /policies/lambda-scale-up.json" , {
83
+ arn_runner_instance_role = aws_iam_role.runner.arn
84
+ })
85
+ }
86
+
71
87
resource "aws_iam_policy_attachment" "scale_runners_lambda" {
72
- name = " ${ var . environment } -scale-runners "
88
+ name = " ${ var . environment } -scale-up "
73
89
roles = [aws_iam_role . scale_runners_lambda . name ]
74
90
policy_arn = aws_iam_policy. scale_runners_lambda . arn
75
91
}
92
+
You can’t perform that action at this time.
0 commit comments