@@ -18,17 +18,21 @@ resource "aws_eks_cluster" "eks" {
1818 endpoint_public_access = true
1919
2020 # Must be in at least two different availability zones
21- subnet_ids = [" subnet-0c6265a3df91b7b61" ," subnet-0f9c4ff10c3526a4d" ," subnet-04919de8d00a175f3" ," subnet-080af72a4f9415d55" ]
21+ subnet_ids = var. subnet_ids
22+ # subnet_ids = [
23+ # aws_subnet.public_1.id,
24+ # aws_subnet.public_2.id,
25+ # aws_subnet.private_1.id,
26+ # aws_subnet.private_2.id
27+ # ]
2228 }
2329
2430 # Ensure that IAM Role permissions are created before and deleted after EKS Cluster handling.
2531 # Otherwise, EKS will not be able to properly delete EKS managed EC2 infrastructure such as Security Groups.
2632 depends_on = [
2733 aws_iam_role_policy_attachment . amazon_eks_cluster_policy
2834 ]
29- tags = {
30- " Name" = " demo-cluster"
31- }
35+ tags = var. tags
3236}
3337
3438resource "aws_iam_role" "eks_cluster" {
@@ -66,12 +70,3 @@ resource "aws_iam_role_policy_attachment" "AmazonEC2ContainerRegistryReadOnly-EK
6670 policy_arn = " arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
6771 role = aws_iam_role. eks_cluster . name
6872}
69-
70-
71- output "eks_cluster_name" {
72- value = aws_eks_cluster. eks . name
73- }
74-
75- variable "eks_cluster_name" {
76- default = " demo-cluster1"
77- }
0 commit comments