Skip to content
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

r/aws_security_group: Support ampersand in rule description #9528

Merged
merged 1 commit into from
Dec 10, 2019
Merged

r/aws_security_group: Support ampersand in rule description #9528

merged 1 commit into from
Dec 10, 2019

Conversation

stefansundin
Copy link
Contributor

@stefansundin stefansundin commented Jul 27, 2019

The official API documentation is not accurate (here and here). User guides have their code on GitHub, but I wasn't able to find the API reference on GitHub. I'm sure some HashiCorp employees have better communications channels and can report this upstream.

If you try to use a character that is actually not allowed (e.g. %), then the error response will reveal the pattern that they are actually using, which is: a-zA-Z0-9. _-:/()#,@[]+=&;{}!$*.

Screenshot from console:

Screen Shot 2019-07-27 at 12 24 04 PM

Searching for ._-:/()#,@[]+=;{}!$* on https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/ reveals two other locations where this regex is documented. Perhaps these two also support &? It is worth asking the AWS people.

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Closes #2278

Release note for CHANGELOG:

- resource/aws_security_group: Support ampersand (`&`) in `description` field in `ingress` and `egress` rules.
- resource/aws_security_group_rule: Support ampersand (`&`) in `description` field.

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestValidateSecurityGroupRuleDescription'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestValidateSecurityGroupRuleDescription -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestValidateSecurityGroupRuleDescription
--- PASS: TestValidateSecurityGroupRuleDescription (0.00s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	0.045s

@stefansundin stefansundin requested a review from a team July 27, 2019 19:42
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jul 27, 2019
…he official API documentation is not accurate.

Making an request that includes an invalid character (e.g. %) reveals the actual pattern to be: a-zA-Z0-9. _-:/()#,@[]+=&;{}!$*
@stefansundin
Copy link
Contributor Author

As there was no assistance on this matter, I opened a support ticket with AWS and they have now corrected the API documentation. I rebased this PR on the latest master.

@bflad I think this is good to be merged now.

@bflad bflad added bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. labels Dec 10, 2019
@bflad bflad added this to the v2.42.0 milestone Dec 10, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, @stefansundin 🚀 Thanks for this fix and working with AWS to ensure the API documentation was updated to match reality.

Output from acceptance testing:

--- PASS: TestAccAWSSecurityGroupRule_ExpectInvalidTypeError (4.39s)
--- PASS: TestAccAWSSecurityGroupRule_ExpectInvalidCIDR (6.05s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_VPC (22.71s)
--- PASS: TestAccAWSSecurityGroupRule_Issue5310 (24.65s)
--- PASS: TestAccAWSSecurityGroupRule_EgressDescription (25.59s)
--- PASS: TestAccAWSSecurityGroupRule_Egress (26.07s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Protocol (29.01s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Ipv6 (29.61s)
--- PASS: TestAccAWSSecurityGroupRule_MultiIngress (30.80s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Classic (32.44s)
--- PASS: TestAccAWSSecurityGroupRule_Description_AllPorts (32.90s)
--- PASS: TestAccAWSSecurityGroupRule_SelfReference (33.67s)
--- PASS: TestAccAWSSecurityGroupRule_MultipleRuleSearching_AllProtocolCrash (27.50s)
--- PASS: TestAccAWSSecurityGroupRule_PartialMatching_Source (39.47s)
--- PASS: TestAccAWSSecurityGroupRule_Description_AllPorts_NonZeroPorts (36.77s)
--- PASS: TestAccAWSSecurityGroupRule_IngressDescription (44.12s)
--- PASS: TestAccAWSSecurityGroupRule_PartialMatching_basic (47.17s)
--- PASS: TestAccAWSSecurityGroupRule_SelfSource (51.75s)
--- PASS: TestAccAWSSecurityGroup_namePrefix (13.82s)
--- PASS: TestAccAWSSecurityGroup_basic (33.31s)
--- PASS: TestAccAWSSecurityGroupRule_IngressDescription_updates (63.09s)
--- PASS: TestAccAWSSecurityGroupRule_PrefixListEgress (68.45s)
--- PASS: TestAccAWSSecurityGroup_IPRangeAndSecurityGroupWithSameRules (44.10s)
--- PASS: TestAccAWSSecurityGroup_IPRangesWithSameRules (51.92s)
--- PASS: TestAccAWSSecurityGroup_sourceSecurityGroup (57.09s)
--- PASS: TestAccAWSSecurityGroup_ipv6 (44.63s)
--- PASS: TestAccAWSSecurityGroup_vpcProtoNumIngress (28.98s)
--- PASS: TestAccAWSSecurityGroup_self (47.37s)
--- PASS: TestAccAWSSecurityGroup_invalidCIDRBlock (4.10s)
--- PASS: TestAccAWSSecurityGroup_defaultEgressClassic (15.20s)
--- PASS: TestAccAWSSecurityGroup_generatedName (31.57s)
--- PASS: TestAccAWSSecurityGroup_drift (19.16s)
--- PASS: TestAccAWSSecurityGroup_vpc (56.41s)
--- PASS: TestAccAWSSecurityGroup_ingressConfigMode (75.06s)
--- PASS: TestAccAWSSecurityGroupRule_EgressDescription_updates (109.86s)
--- PASS: TestAccAWSSecurityGroup_vpcNegOneIngress (59.83s)
--- PASS: TestAccAWSSecurityGroup_multiIngress (51.68s)
--- PASS: TestAccAWSSecurityGroup_change (51.87s)
--- PASS: TestAccAWSSecurityGroup_ruleGathering (85.11s)
--- PASS: TestAccAWSSecurityGroup_egressConfigMode (91.98s)
--- PASS: TestAccAWSSecurityGroup_ingressWithCidrAndSGsClassic (20.33s)
--- PASS: TestAccAWSSecurityGroup_driftComplex (43.27s)
--- PASS: TestAccAWSSecurityGroupRule_MultiDescription (126.10s)
--- PASS: TestAccAWSSecurityGroup_failWithDiffMismatch (37.42s)
--- PASS: TestAccAWSSecurityGroup_egressWithPrefixList (48.98s)
--- PASS: TestAccAWSSecurityGroup_ingressWithCidrAndSGsVPC (51.62s)
--- PASS: TestAccAWSSecurityGroup_ingressWithPrefixList (46.90s)
--- PASS: TestAccAWSSecurityGroup_CIDRandGroups (56.23s)
--- PASS: TestAccAWSSecurityGroup_ruleLimitCidrBlockExceededAppend (42.03s)
--- PASS: TestAccAWSSecurityGroup_tags (61.81s)
--- PASS: TestAccAWSSecurityGroup_allowAll (133.28s)
--- PASS: TestAccAWSSecurityGroup_ipv4andipv6Egress (54.33s)
--- PASS: TestAccAWSSecurityGroup_ruleLimitExceededAppend (54.51s)
--- PASS: TestAccAWSSecurityGroup_ruleDescription (105.04s)
--- PASS: TestAccAWSSecurityGroup_ruleLimitExceededAllNew (51.53s)
--- PASS: TestAccAWSSecurityGroup_rulesDropOnError (52.22s)
--- PASS: TestAccAWSSecurityGroup_ruleLimitExceededPrepend (61.32s)
--- PASS: TestAccAWSSecurityGroupRule_Race (196.68s)
--- PASS: TestAccAWSSecurityGroup_defaultEgressVPC (116.28s)
--- PASS: TestAccAWSSecurityGroup_forceRevokeRulesTrue (661.37s)
--- PASS: TestAccAWSSecurityGroup_forceRevokeRulesFalse (664.65s)

@bflad bflad merged commit 72964ee into hashicorp:master Dec 10, 2019
bflad added a commit that referenced this pull request Dec 10, 2019
@ghost
Copy link

ghost commented Dec 13, 2019

This has been released in version 2.42.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Mar 28, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. size/XS Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support & character - aws_security_group into ingress/egress description
2 participants