Skip to content

Commit ca3d5d3

Browse files
authored
Restrict autoscaling privileges to AWSBatch* resources (#12)
1 parent 3e620d3 commit ca3d5d3

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

modules/computation/iam-batch-execution.tf

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,7 @@ data "aws_iam_policy_document" "custom_access_policy" {
7575
"autoscaling:DescribeAutoScalingGroups",
7676
"autoscaling:DescribeLaunchConfigurations",
7777
"autoscaling:DescribeAutoScalingInstances",
78-
"autoscaling:CreateLaunchConfiguration",
79-
"autoscaling:CreateAutoScalingGroup",
80-
"autoscaling:UpdateAutoScalingGroup",
81-
"autoscaling:SetDesiredCapacity",
82-
"autoscaling:DeleteLaunchConfiguration",
83-
"autoscaling:DeleteAutoScalingGroup",
8478
"autoscaling:CreateOrUpdateTags",
85-
"autoscaling:SuspendProcesses",
86-
"autoscaling:PutNotificationConfiguration",
87-
"autoscaling:TerminateInstanceInAutoScalingGroup",
8879
"ecs:DescribeClusters",
8980
"ecs:DescribeContainerInstances",
9081
"ecs:DescribeTaskDefinition",
@@ -117,6 +108,37 @@ data "aws_iam_policy_document" "custom_access_policy" {
117108
"*"
118109
]
119110
}
111+
112+
statement {
113+
actions = [
114+
"autoscaling:CreateLaunchConfiguration",
115+
"autoscaling:DeleteLaunchConfiguration",
116+
]
117+
118+
effect = "Allow"
119+
120+
resources = [
121+
"arn:aws:autoscaling:*:*:launchConfiguration:*:launchConfigurationName/AWSBatch*"
122+
]
123+
}
124+
125+
statement {
126+
actions = [
127+
"autoscaling:CreateAutoScalingGroup",
128+
"autoscaling:UpdateAutoScalingGroup",
129+
"autoscaling:SetDesiredCapacity",
130+
"autoscaling:DeleteAutoScalingGroup",
131+
"autoscaling:SuspendProcesses",
132+
"autoscaling:PutNotificationConfiguration",
133+
"autoscaling:TerminateInstanceInAutoScalingGroup",
134+
]
135+
136+
effect = "Allow"
137+
138+
resources = [
139+
"arn:aws:autoscaling:*:*:autoScalingGroup:*:autoScalingGroupName/AWSBatch*"
140+
]
141+
}
120142
}
121143

122144
data "aws_iam_policy_document" "iam_custom_policies" {

0 commit comments

Comments
 (0)