Created
April 4, 2020 18:55
-
-
Save blogumi/bb0b3d243d062d9ae470bbea6061b195 to your computer and use it in GitHub Desktop.
The below is an example IAM role and policy to allow the worker nodes to manage or retrieve data from other AWS services. It is used by Kubernetes to allow worker nodes to join the cluster.
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
resource "aws_iam_role" "demo-cluster" { | |
name = "terraform-eks-demo-cluster" | |
assume_role_policy = <<POLICY | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { | |
"Service": "eks.amazonaws.com" | |
}, | |
"Action": "sts:AssumeRole" | |
} | |
] | |
} | |
POLICY | |
} | |
resource "aws_iam_role_policy_attachment" "demo-cluster-AmazonEKSClusterPolicy" { | |
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy" | |
role = aws_iam_role.demo-node.name | |
} | |
resource "aws_iam_role_policy_attachment" "demo-cluster-AmazonEKSServicePolicy" { | |
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSServicePolicy" | |
role = aws_iam_role.demo-node.name | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment