Last active
August 16, 2020 11:21
-
-
Save arashkaffamanesh/d22d578bbe2a1518f733051856718d6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# taken and adapted from here to get it working: | |
# https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/autoscaling.md | |
resource "aws_iam_role_policy_attachment" "workers_autoscaling" { | |
policy_arn = aws_iam_policy.worker_autoscaling.arn | |
role = module.eks.worker_iam_role_name | |
} | |
resource "aws_iam_policy" "worker_autoscaling" { | |
name_prefix = "ClusterAutoScalingPolicy-${var.cluster_name}" | |
description = "EKS worker node autoscaling policy for cluster ${var.cluster_name}" | |
policy = data.aws_iam_policy_document.worker_autoscaling.json | |
path = var.iam_path | |
} | |
data "aws_iam_policy_document" "worker_autoscaling" { | |
statement { | |
sid = "eksWorkerAutoscalingAll" | |
effect = "Allow" | |
actions = [ | |
"autoscaling:DescribeAutoScalingGroups", | |
"autoscaling:DescribeAutoScalingInstances", | |
"autoscaling:DescribeLaunchConfigurations", | |
"autoscaling:DescribeTags", | |
"ec2:DescribeLaunchTemplateVersions", | |
"autoscaling:SetDesiredCapacity", | |
"autoscaling:TerminateInstanceInAutoScalingGroup", | |
"autoscaling:UpdateAutoScalingGroup", | |
] | |
resources = ["*"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment