-
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
aws_security_group with separate aws_security_group_rule rules for both IPv4 and IPv6 gets confused and can't find the rules, completes with errors, even though the results are correct #21574
Comments
Oh, by the way, when I had separate rules for IPv4 and IPv6, TF also became confused, thinking they were duplicate rules. Again, it seemed to accomplish the right thing, but with errors/loooooong timeouts reported by TF. |
Hey @buchs 👋 Thank you for taking the time to file this issue! So that we have all of the necessary information in order to investigate this, can you add the Terraform configuration to the issue description as well? |
The terraform configuration is in the attached file - separate-rules.tf.txt. See note about it being edited to remove some non-relevant information that I wanted to keep private. |
Hey @buchs - sorry for the confusion there - I'd failed to scroll down all the way 🙃. |
I think this issue is related to ipv6. ipv6 can be compressed (https://iplocation.io/ipv6-compress) in either terraform configuration or aws responses, making hashes or comparison fail in some cases. |
I just workaround the issue by applying this snippet to ipv6 retrieved with http provider from https://betteruptime.com/ips.txt. Note that those adresses was causing the issue because there's a
should be
use replace function to compress ipv6 adresses // replace(ip, "/:0+/", ":")
// My use case is to grab ips from this online list
data "http" "betteruptime_ips" {
url = "https://betteruptime.com/ips.txt"
}
betteruptime_cidr_blocks = compact([for ip in split("\n", data.http.betteruptime_ips.body) : (can(regex("::", ip)) ? "" : "${ip}/32")])
betteruptime_ipv6_cidr_blocks = compact([for ip in split("\n", data.http.betteruptime_ips.body) : (can(regex("::", ip)) ? "${replace(ip, "/:0+/", ":")}/128" : "")]) |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
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. |
Community Note
Terraform CLI and Terraform AWS Provider Version
This is the apply transcript where some parts I don't want to share, not related to the security group rules, are omitted.
Funny thing is that the Security Group turns out to be as designed. So apparently the errors are decoys.
separate-rules.tf.txt
Related issue: #21573
The text was updated successfully, but these errors were encountered: