-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
39 lines (33 loc) · 994 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
data "aws_subnets" "all" {
filter {
name = "vpc-id"
values = [aws_vpc.eks_vpc.id]
}
depends_on = [
aws_subnet.eks_public_subnets,
aws_subnet.eks_private_subnets
]
}
resource "aws_eks_cluster" "eks" {
name = "${var.eks_name}"
role_arn = aws_iam_role.eks.arn
version = "1.25"
vpc_config {
subnet_ids = data.aws_subnets.all.ids
endpoint_private_access = true
endpoint_public_access = true
public_access_cidrs = ["0.0.0.0/0"]
}
depends_on = [
aws_iam_role_policy_attachment.eks_AmazonEKSClusterPolicy,
aws_iam_role_policy_attachment.eks_AmazonEKSVPCResourceController
]
}
data "tls_certificate" "cert" {
url = aws_eks_cluster.eks.identity[0].oidc[0].issuer
}
resource "aws_iam_openid_connect_provider" "oidc" {
client_id_list = ["sts.amazonaws.com"]
thumbprint_list = [data.tls_certificate.cert.certificates[0].sha1_fingerprint]
url = aws_eks_cluster.eks.identity[0].oidc[0].issuer
}