Created
April 4, 2020 18:52
-
-
Save blogumi/4776154be1219656a77d026331e30e05 to your computer and use it in GitHub Desktop.
The below is an example IAM role and policy to allow the EKS service to manage or retrieve data from other AWS services.
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-node" { | |
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