-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to update cluster_endpoint_private_access_cidrs #984
Comments
For some reason terraform is performing a create then destroy of the security group rule. This won't work as the rules must be deleted then created. Why is Terraform doing this? There is no lifecycle set on the resource that would be causing this. I managed to reproduce this. There's the single change to make:
Happens under TF 0.12.29 and 0.13.0. With both aws 2.70.0 and 3.3.0. Upgrading isn't an easy escape. Will need more investigation. |
At the end, here is what I did to get a consistency on this rule: resource "aws_security_group_rule" "cluster_private_access" {
for_each = var.create_eks && var.cluster_endpoint_private_access ? toset(var.cluster_endpoint_private_access_cidrs) : []
type = "ingress"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = [each.value]
security_group_id = aws_eks_cluster.this[0].vpc_config[0].cluster_security_group_id
} This will let Terraform manage each CIDR within its own SG rule, making updates and removals really easy. But the downside of this method is the AWS limit (I think AWS limit to 50 inbound rules per SG). |
The default 50 rule limit applies whether you're creating them in a single Would have been nice if hashicorp hadn't broken "working" plans |
I have a related issue I think
Getting rid of the inbound rule manually obvisouly fixed it. |
I still think that this the only way (at least for now) to make this change consistent. See also https://discuss.hashicorp.com/t/security-group-rules-destroyed-instead-of-added/7528/6.
I don't think that there is a big difference in API calls, in both case, the provider loop over CIDR blocks and make an API call for each of them https://github.com/hashicorp/terraform-provider-aws/blob/master/aws/resource_aws_security_group_rule.go#L691 |
@CyrilPeponnet your issue is different from @wolstena's. The issue we're discussing here is about the Terraform AWS Provider trying to recreate a SG rule which already exists : |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity since being marked as stale. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Folks, please, look into #1549 which implements @barryib suggestions #984 (comment). |
#1549 was merged so this issue seems be solved |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I have issues
I'm submitting a...
What is the current behavior?
I am unable to update the cluster_endpoint_private_access_cidrs. The security group is initially created without an issue. However, when modify the definition of the cidr array it errors out. It is related to #hashicorp/terraform#2376. But, I have not been able to resolve the issues using the suggesting in the other ticket.
If this is a bug, how to reproduce? Please include a code sample if relevant.
Orginial Setting
cluster_endpoint_private_access_cidrs = ["104.145.4.34/32", "64.114.102.2/32", "172.21.224.0/24", "172.20.224.0/24", "172.21.226.0/24", "172.20.226.0/24"]
==> Updated Setting
cluster_endpoint_private_access_cidrs = ["104.145.4.34/32", "64.114.102.2/32", "172.21.224.0/24", "172.20.224.0/24", "172.21.226.0/24", "172.20.226.0/24", "10.142.8.0/21", "10.142.72.0/21"]
terragrunt plan
terragrunt apply
What's the expected behavior?
Update the security group rules cidr blocks. I tried some of the suggestions in #hashicorp/terraform#2376 such as tainting the security groups with no luck.
Are you able to fix this problem and submit a PR? Link here if you have already.
No
Environment details
Terraform v0.12.29
Any other relevant info
Initializing provider plugins...
The text was updated successfully, but these errors were encountered: