Skip to content

Commit

Permalink
Add dependency to ensure proper destruction order
Browse files Browse the repository at this point in the history
  • Loading branch information
barroco committed Dec 23, 2023
1 parent b8d3f34 commit ecb4901
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "aws_eks_cluster" "kubernetes_cluster" {
name = var.cluster_name
role_arn = aws_iam_role.dss-cluster.arn

vpc_config {
subnet_ids = aws_subnet.dss[*].id
endpoint_public_access = true
Expand All @@ -13,7 +13,11 @@ resource "aws_eks_cluster" "kubernetes_cluster" {
# Ensure that IAM Role permissions are created before and deleted after EKS Cluster handling.
# Otherwise, EKS will not be able to properly delete EKS managed EC2 infrastructure such as Security Groups.
depends_on = [
aws_iam_role.dss-cluster-node-group,
aws_iam_role_policy_attachment.dss-cluster-service,
aws_iam_role_policy_attachment.AmazonEKSWorkerNodePolicy,
aws_iam_role_policy_attachment.AmazonEKS_CNI_Policy,
aws_iam_role_policy_attachment.AWSLoadBalancerControllerPolicy,
aws_internet_gateway.dss
]

Expand All @@ -39,4 +43,9 @@ resource "aws_eks_node_group" "eks_node_group" {
lifecycle {
create_before_destroy = true
}

depends_on = [
aws_eip.gateway,
aws_eip.ip_crdb
]
}

0 comments on commit ecb4901

Please sign in to comment.