46 lines
1.3 KiB
Terraform
46 lines
1.3 KiB
Terraform
|
resource "aws_iam_role" "eks_role" {
|
||
|
name = "eks"
|
||
|
|
||
|
assume_role_policy = jsonencode({
|
||
|
Statement = [{
|
||
|
Action = "sts:AssumeRole"
|
||
|
Effect = "Allow"
|
||
|
Principal = {
|
||
|
Service = "eks.amazonaws.com"
|
||
|
}
|
||
|
},{
|
||
|
Action = "sts:AssumeRole"
|
||
|
Effect = "Allow"
|
||
|
Principal = {
|
||
|
Service = "ec2.amazonaws.com"
|
||
|
}
|
||
|
}]
|
||
|
Version = "2012-10-17"
|
||
|
})
|
||
|
}
|
||
|
|
||
|
resource "aws_iam_role_policy_attachment" "eks-AmazonEKSClusterPolicy" {
|
||
|
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
|
||
|
role = aws_iam_role.eks_role.name
|
||
|
}
|
||
|
|
||
|
resource "aws_iam_role_policy_attachment" "eks-AmazonEKSVPCResourceController" {
|
||
|
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSVPCResourceController"
|
||
|
role = aws_iam_role.eks_role.name
|
||
|
}
|
||
|
|
||
|
resource "aws_iam_role_policy_attachment" "eks-AmazonEKSWorkerNodePolicy" {
|
||
|
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy"
|
||
|
role = aws_iam_role.eks_role.name
|
||
|
}
|
||
|
|
||
|
resource "aws_iam_role_policy_attachment" "eks-AmazonEKS_CNI_Policy" {
|
||
|
policy_arn = "arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy"
|
||
|
role = aws_iam_role.eks_role.name
|
||
|
}
|
||
|
|
||
|
resource "aws_iam_role_policy_attachment" "eks-AmazonEC2ContainerRegistryReadOnly" {
|
||
|
policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
|
||
|
role = aws_iam_role.eks_role.name
|
||
|
}
|