-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelm_release_cluster_autoscaler.tf
51 lines (47 loc) · 1.48 KB
/
helm_release_cluster_autoscaler.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
resource "helm_release" "cluster_autoscaler" {
name = "cluster-autoscaler"
repository = "https://kubernetes.github.io/autoscaler"
chart = "cluster-autoscaler"
namespace = "cluster-autoscaler-namespace"
version = "9.37.0"
set {
name = "image.tag"
value = var.cluster_autoscaler_image_tag # Match the version with the chart version
}
values = [
file("${path.module}/values/cluster-autoscaler-values.yaml")
]
depends_on = [kubernetes_namespace.cluster-autoscaler-namespace]
}
resource "aws_iam_policy" "cluster_autoscaler_policy" {
name = "ClusterAutoscalerPolicy"
description = "Allows Cluster Autoscaler to manage Auto Scaling groups"
policy = jsonencode({
Version = "2012-10-17"
"Statement" : [
{
"Effect" : "Allow",
"Action" : [
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeAutoScalingInstances",
"autoscaling:DescribeLaunchConfigurations",
"autoscaling:DescribeScalingActivities",
"ec2:DescribeImages",
"ec2:DescribeInstanceTypes",
"ec2:DescribeLaunchTemplateVersions",
"ec2:GetInstanceTypesFromInstanceRequirements",
"eks:DescribeNodegroup"
],
"Resource" : ["*"]
},
{
"Effect" : "Allow",
"Action" : [
"autoscaling:SetDesiredCapacity",
"autoscaling:TerminateInstanceInAutoScalingGroup"
],
"Resource" : ["*"]
}
]
})
}