-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
37 lines (33 loc) · 1.04 KB
/
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
resource "aws_eks_cluster" "this" {
name = "${local.prefix}-cluster"
role_arn = aws_iam_role.cluster_role.arn
vpc_config {
endpoint_private_access = var.is_endpoint_private_access
endpoint_public_access = var.is_endpoint_public_access
subnet_ids = var.subnets_ids
security_group_ids = [aws_security_group.cluster.id]
}
enabled_cluster_log_types = var.enabled_cluster_log_types
dynamic "encryption_config" {
for_each = local.cluster_encryption
content {
provider {
key_arn = encryption_config.value.provider_key_arn
}
resources = encryption_config.value.resources
}
}
version = var.eks_version
tags = merge(
{
"Name" = "${local.prefix}-cluster"
},
local.tags
)
# Ensure that IAM Role permissions are created before and deleted after EKS Cluster handling.
depends_on = [
aws_iam_role_policy_attachment.amazon_eks_cluster_policy,
aws_iam_role_policy_attachment.amazon_eks_vpc_resource_controller,
aws_cloudwatch_log_group.this
]
}