EKS Control Plane Security Group not getting cleaned up #20925
Labels
bug
Addresses a defect in current functionality.
service/eks
Issues and PRs that pertain to the eks service.
Milestone
Community Note
Terraform CLI and Terraform AWS Provider Version
TF: v0.13.7
hashicorp/aws v3.58.0
Affected Resource(s)
EKS Cluster with Fargate Type and Ec2 NodeGroup
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Debug Output
Panic Output
Error deleting VPC: DependencyViolation: The vpc 'vpc-025bfcbeeeeeeddddf22' has dependencies and cannot be deleted
Expected Behavior
TF should delete SG associated with EKS
Actual Behavior
SG is not getting deleted
Steps to Reproduce
We are using Terraform to provision EKS Cluster. Creation of cluster is going smooth but deletion of it SG is not happening.
Below policies are being used in EKS Cluster and I can confirm that these policy attachments are only getting deleted post cluster deletion so here there is no case of policy deletion happening first and then cluster.
AmazonEKSClusterPolicy
AmazonEKSServicePolicy
AmazonEKSVPCResourceController and
Custom Policy: {
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"elasticloadbalancing:",
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup",
"ec2:Describe"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
All the above policies are being used in eks cluster role_arn. While performing terraform delete operations all the resources are getting destroyed successfully but SG ( EKS created security group applied to ENI that is attached to EKS Control Plane master nodes, as well as any managed workloads.) is not getting deleted.
PS: Consulted AWS Support team for the same and they conclude that SG deletion call was received but at that time SG was attached with ENI of the master plane so call was not successful. TF didn't even send 2nd call to check its existence.
Also seen EKS Cluster destroy is happening in 30s-1m and then this error is coming.
The text was updated successfully, but these errors were encountered: