-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaws.tf
36 lines (31 loc) · 1.03 KB
/
aws.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
resource "aws_iam_policy" "cluster_autoscaler" {
count = var.aws_create_iam_policy ? 1 : 0
name = var.aws_iam_policy_name
path = "/"
description = "Allows access to resources needed to run kubernetes cluster autoscaler."
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeAutoScalingInstances",
"autoscaling:DescribeLaunchConfigurations",
"autoscaling:DescribeTags",
"autoscaling:SetDesiredCapacity",
"autoscaling:TerminateInstanceInAutoScalingGroup",
"ec2:DescribeLaunchTemplateVersions"
],
"Resource": "*"
}
]
}
EOF
}
resource "aws_iam_role_policy_attachment" "cluster_autoscaler" {
# count = var.aws_create_iam_policy && var.aws_iam_role_for_policy != null ? 1 : 0
role = var.aws_iam_role_for_policy
policy_arn = aws_iam_policy.cluster_autoscaler.0.arn
}