Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions cluster/terraform/eks.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
data "aws_caller_identity" "current" {}

data "aws_iam_role" "current_role" {
name = element(split("/", data.aws_caller_identity.current.arn), 1)
}

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.0"
Expand Down Expand Up @@ -53,4 +59,20 @@ module "eks" {
tags = merge(local.tags, {
"karpenter.sh/discovery" = var.cluster_name
})
}

resource "aws_eks_access_entry" "cloud9_role" {
cluster_name = var.cluster_name
principal_arn = data.aws_iam_role.current_role.arn
type = "STANDARD"
}

resource "aws_eks_access_policy_association" "cloud9_role_policy" {
cluster_name = var.cluster_name
policy_arn = "arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy"
principal_arn = data.aws_iam_role.current_role.arn

access_scope {
type = "cluster"
}
}