Created
December 28, 2021 02:33
-
-
Save bhalothia/bb5a33f6ed2e4299e67c260a018f9c5a to your computer and use it in GitHub Desktop.
Revisions
-
bhalothia renamed this gist
Dec 28, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
bhalothia created this gist
Dec 28, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ module "iam_assumable_role_karpenter" { source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc" version = "4.7.0" create_role = true role_name = "karpenter-controller-${var.cluster_name}" provider_url = module.eks.cluster_oidc_issuer_url oidc_fully_qualified_subjects = ["system:serviceaccount:karpenter:karpenter"] } resource "aws_iam_role_policy" "karpenter_contoller" { name = "karpenter-policy-${var.cluster_name}" role = module.iam_assumable_role_karpenter.iam_role_name policy = jsonencode({ Version = "2012-10-17" Statement = [ { Action = [ "ec2:CreateLaunchTemplate", "ec2:CreateFleet", "ec2:RunInstances", "ec2:CreateTags", "iam:PassRole", "ec2:TerminateInstances", "ec2:DescribeLaunchTemplates", "ec2:DescribeInstances", "ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "ec2:DescribeInstanceTypes", "ec2:DescribeInstanceTypeOfferings", "ec2:DescribeAvailabilityZones", "ssm:GetParameter" ] Effect = "Allow" Resource = "*" }, ] }) }