-
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
resource/aws_security_group_rule: Support all non-zero from_port
and to_port
configurations with protocol
ALL/-1
#6423
Conversation
…d `to_port` configurations with `protocol` ALL/-1 This completely suppresses `from_port` and `to_port` differences when `protocol` is `ALL` or `-1`. The API ignores them in this scenario, so previously it was possible to specify whatever non-zero values you wished (-1 for both, 0 and 65535, etc), but previously the logic was not showing the difference. Previously: ``` --- FAIL: TestAccAWSSecurityGroupRule_Description_AllPorts_NonZeroPorts (16.96s) testing.go:538: Step 0 error: After applying this step and refreshing, the plan was not empty: DIFF: DESTROY/CREATE: aws_security_group_rule.test cidr_blocks.#: "1" => "1" cidr_blocks.0: "0.0.0.0/0" => "0.0.0.0/0" description: "description1" => "description1" from_port: "0" => "-1" (forces new resource) protocol: "-1" => "-1" security_group_id: "sg-04722579708a472f8" => "sg-04722579708a472f8" self: "false" => "false" source_security_group_id: "" => "<computed>" to_port: "0" => "-1" (forces new resource) type: "ingress" => "ingress" ``` Output from acceptance testing: ``` --- PASS: TestAccAWSSecurityGroupRule_ExpectInvalidTypeError (1.70s) --- PASS: TestAccAWSSecurityGroupRule_ExpectInvalidCIDR (1.84s) --- PASS: TestAccAWSSecurityGroupRule_MultiIngress (23.08s) --- PASS: TestAccAWSSecurityGroupRule_EgressDescription (23.84s) --- PASS: TestAccAWSSecurityGroupRule_Issue5310 (24.41s) --- PASS: TestAccAWSSecurityGroupRule_Ingress_Classic (24.04s) --- PASS: TestAccAWSSecurityGroupRule_MultipleRuleSearching_AllProtocolCrash (25.85s) --- PASS: TestAccAWSSecurityGroupRule_Ingress_VPC (27.91s) --- PASS: TestAccAWSSecurityGroupRule_IngressDescription (28.45s) --- PASS: TestAccAWSSecurityGroupRule_Description_AllPorts_NonZeroPorts (30.69s) --- PASS: TestAccAWSSecurityGroupRule_Egress (36.77s) --- PASS: TestAccAWSSecurityGroupRule_IngressDescription_updates (37.11s) --- PASS: TestAccAWSSecurityGroupRule_SelfSource (42.98s) --- PASS: TestAccAWSSecurityGroupRule_EgressDescription_updates (43.95s) --- PASS: TestAccAWSSecurityGroupRule_SelfReference (44.43s) --- PASS: TestAccAWSSecurityGroupRule_Ingress_Ipv6 (45.83s) --- PASS: TestAccAWSSecurityGroupRule_PartialMatching_Source (50.10s) --- PASS: TestAccAWSSecurityGroupRule_PartialMatching_basic (51.93s) --- PASS: TestAccAWSSecurityGroupRule_Description_AllPorts (52.00s) --- PASS: TestAccAWSSecurityGroupRule_PrefixListEgress (57.10s) --- PASS: TestAccAWSSecurityGroupRule_Ingress_Protocol (37.05s) --- PASS: TestAccAWSSecurityGroupRule_MultiDescription (89.38s) --- PASS: TestAccAWSSecurityGroupRule_Race (275.19s) ```
@@ -1922,7 +1921,7 @@ resource "aws_security_group_rule" "test" { | |||
`, rName, description) | |||
} | |||
|
|||
func testAccAWSSecurityGroupRuleConfigDescriptionAllPortsToPort65535(rName, description string) string { | |||
func testAccAWSSecurityGroupRuleConfigDescriptionAllPortsNonZeroPorts(rName, description string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-zero for both from_port
and to_port
also covers the previous scenario, which is why this was updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixed my issue, nice one! |
This has been released in version 1.44.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Reference: #6407 (comment)
This completely suppresses
from_port
andto_port
differences whenprotocol
isALL
or-1
. The API ignores them in this scenario, so previously it was possible to specify whatever non-zero values you wished (-1 for both, 0 and 65535, etc), but previously the logic was also not showing a difference.Previously:
Output from acceptance testing: