-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
aws_security_group_rule resource ERROR after trying to create the rule on each apply #5396
Comments
This error does not appear when specified protocol is "-1"(all). However it is saved uncorrectly causing the rule to be recreated at each apply. |
Hi @kristjanelias! Thanks for opening this issue. Did you take a look at the steps in #2376 for resolving this class of issue? If that did not work this is likely something we need to dig deeper into. |
@jen20
|
I'm being affected by this issue too. Running v0.6.12. If I create an
..And apply it to a group, it applies successfully for the first run. If I manually delete that egress rule from the group, then first terraform run following that adds it back in, and then all subsequent runs work as expected. |
I've now run into this as well -- it seems that you can reproduce this by creating a |
I have a fix in #7377. The bug was a poorly handled error case where any error (including spurious network issues) would result in a duplicate security group rule being created. I suspect that the people who commented saying they were able to reproduce the issue reliably were running Terraform with the AuthorizeSecurityGroupIngress and/or AuthorizeSecurityGroupEgress permissions but not the DescribeSecurityGroups permission. That results in the first |
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. |
Terraform version:
terraform --version Terraform v0.6.13-dev (1448b84b37524eb2f22826dc90ffed65df68e27d)
When creating aws_security_group_rule resource and running more than 1 apply i get an error:
Each time
terraform apply
is executed the rule is created again.Rules are not recorded in terraform.tfstate
Code to reproduce (main.tf):
main.txt
Terraform apply output:
terraform_apply.txt
tfstate file after apply:
terraform_tfstate.txt
The text was updated successfully, but these errors were encountered: