-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Get error when updating SG embedded ingress rules with description #2069
Comments
Weird. |
Looks like it is related to the lenght of the description field content. |
Potentially related? #1959 |
No, it is not the lenght. |
Yes, #1959 may be related. |
@takeda-joao good catch |
Same issue experienced here. |
Just tested AWS Provider 1.2 and issue still persists. |
Any update on this issue? Im also facing this issue in my implementation. |
it was fixed in #1959 and released as part of v1.3.1 |
Same issue here. Waiting for v1.3.1 to test. |
I believe this issue still exists. I created new security groups with terraform and when i re-run apply, terraform complains with
setting the trace flag and looking at the aws call, terraform is passing the wrong description to aws:
terraform is trying to remove the rule for CIDR 172.16.0.0/16 and description RDP, but the description for that CIDR block is actually RDP from Workspaces. There is a rule for a separate CIDR block whose description is RDP Here's a snippet from my security group:
From the
Terraform version:
|
Problem persists. |
I'm seeing this problem as well. If I go ahead and delete the description in the console then delete the description field in tf state then terraform apply will run. But if I try to run apply again without changing anything, it will fail. |
@reznet tnx for feedback, confirmed. Separate declaration of the group and rules works as expected and is more preferred way to do it.
Could we mention @radeksimko wdyt? |
Same issue here. |
Seeing this too. tf v.0.11.2 |
Source of issue has been found - it's data struct returned by resourceAwsSecurityGroupIPPermGather() Consider following TF resource:
Local / Remote structs comparison (collapsed)LOCAL:
REMOTE:
So remote struct has only 1 item with detached I'm going to work on the fix in the next days. |
What's the best workaround for this in the meantime? |
@kenske, use dedicated |
It's a little bit more complex that I thought before. @radeksimko @Ninir need ur advice. Data structure of
wdyt? Tnx |
any updates? |
@kenske I hit this same problem recently and worked around it by simply removing the descriptions from the similar port/protocol inline rules. After working around it, I found this open issue. I didn't want to go with the suggestion from @jaymecd since we use Terraform to ensure the SG rules exactly match what's in the definition. I don't think that's possible with I did need to enable debugging/tracing to figure out exactly what was being called (and failing) via RevokeSecurityGroupIngress, then I manually set the description on those rules in AWS so the next time |
@ScottSorrentino It was kinda painful, but I did follow @jaymecd 's suggestion and it worked. It even worked for the scenario you are suggesting, clearing rules that were manually added. |
Since the business-case for inline rules seems to be missing, here it is in detail. Inline-style declarations are a way of saying only these rules, where separate resource style says at least these rules. From a compliance point of view, only these rules is a policy enforcement mechanism, where at least these rules merely ensures approved functionality is present. This has very big impacts when it comes time for an audit. When the auditors ask us:
The use of inline style allows us to avoid having to build a complicated system of CloudTrail event ingestion and correlation with our change-request system to show that only approved changes are implemented and that change-drift is both detected and alarmed, if not outright prevented. Instead, we can give them the commit-log for our terraform repo. The auditors understand git-repos and merge-request approval flows. They have said, in essence:
And that makes the whole process go so much easier. This is one of the biggest value-adds Terraform gives us in our infrastructure. |
I just hit this issue today as well.
I can't use Any other solution? |
Hi again, I have the below resource declaration (note
Applying that the first time works fine and I see the expected changes in the security group. Strangely terraform deletes and recreates the first ingress rule. But it applies successfully. Below is the result of the apply action:
Now, if I apply again without changing anything in the resources, it will fail:
Where is the issue..? And like that isn't enough, I can't get out of this situation even if I comment out the description from the ingress rule. It will still fail with the same error. And I suspect that's because the state file now is in an inconsistent state since it doesn't rollback. I have to manually delete the security group resource from the state file, do a refresh, import it back and then create one by one the ingress and egress rules without the description. Can't really say where the bug is here, but I'd suggest to anyone else not providing a description for nested ingress and egress rules if you don't want to get in this situation. I am running Terraform v0.11.5 Thanks, |
Got bit by this tonight. Even if I commented out the description it still triggered the bug. Only after completely deleting the line did things start to work as expected. Terraform v0.11.5 |
Bug reintroduced again in
|
Was the bug actually ever fixed? I'm still seeing it too, although I can't figure out how to update my AWS provider (I'm on 1.6 and running |
@ibrahima still haven't seen any updates about the bug. |
Ah okay, I actually figured that out after posting the comment (kinda counterintuitive, because the |
To update the provider, you run |
Experiencing this as well.
|
Just wanted to note that this also happens for the |
I face a similar issue when updating security group rules, it has nothing to do with description, it seems that the tf state file becomes out of sync with with the security group rules at apply time, it first removes/modifies the security rule then tries to add new properties. $ terraform -version
|
This is still present, i had manually delete all descriptions in aws and rerun the terraform script. |
@Caspain I also had the same issue today. Deleting descriptions and applying again worked fine |
Hi folks 👋 Sorry this has been a longstanding issue with the AWS provider. The fix for this should be contained in #4416 which will be released with v1.19.0 of the AWS provider, likely middle of next week. Shout outs to @loivis (and @svanharmelen who submitted an earlier, likely correct PR, which I admittedly should have reviewed and merged sooner: #3628) Given there were so many various issues surrounding this bug, I will be locking this issue (amongst all the others) to encourage any lingering issues/discussion to be fully described in new issue(s) for consolidation. Thanks for your understanding. |
Hi,
I am using terraform v0.10.8 and aws provider 1.1.0 and I am getting the following error when updating a security group ingress rules adding description field.
I am able to update the SG, but needed to remove all rules manually. Then terraform works and updates the SG. When I try to update the SG again, the error happens.
This error does not happen if the SG does not have any rules with description field.
terraform command line
$ terraform apply -target
=== output of terraform
Error: Error applying plan:
1 error(s) occurred:
aws_security_group.client-demo-sg-devops: 1 error(s) occurred:
aws_security_group.****: Error revoking security group ingress rules: InvalidPermission.NotFound: The specified rule does not exist in this security group.
status code: 400, request id: 2bfe24f7-a980-4bbc-a58d-54e5935f57a6
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
The text was updated successfully, but these errors were encountered: