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

Added input validation for authentication elements on schema #24154

Conversation

AdamTylerLynch
Copy link
Collaborator

@AdamTylerLynch AdamTylerLynch commented Apr 8, 2022

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" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Bug confirmed, and reproduced. This bug manifests itself as a casting error and a panic, but it is due to improper input validation on the schema.

As per AWS API docs, all credentials used for different types of authentication have a min length of 1.

Added input validation for authentication elements as per AWS API Docs.

Closes #24061

Output from acceptance testing:

$ make testacc TESTS=TestAccEventsConnection PKG=events ACCTEST_PARALLELISM=2 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/events/... -v -count 1 -parallel 2 -run='TestAccEventsConnection'  -timeout 180m
=== RUN   TestAccEventsConnectionDataSource_Connection_basic
=== PAUSE TestAccEventsConnectionDataSource_Connection_basic
=== RUN   TestAccEventsConnection_apiKey
=== PAUSE TestAccEventsConnection_apiKey
=== RUN   TestAccEventsConnection_basic
=== PAUSE TestAccEventsConnection_basic
=== RUN   TestAccEventsConnection_oAuth
=== PAUSE TestAccEventsConnection_oAuth
=== RUN   TestAccEventsConnection_invocationHTTPParameters
=== PAUSE TestAccEventsConnection_invocationHTTPParameters
=== RUN   TestAccEventsConnection_disappears
=== PAUSE TestAccEventsConnection_disappears
=== CONT  TestAccEventsConnectionDataSource_Connection_basic
=== CONT  TestAccEventsConnection_oAuth
--- PASS: TestAccEventsConnectionDataSource_Connection_basic (19.91s)
=== CONT  TestAccEventsConnection_disappears
--- PASS: TestAccEventsConnection_disappears (13.08s)
=== CONT  TestAccEventsConnection_basic
=== CONT  TestAccEventsConnection_apiKey
--- PASS: TestAccEventsConnection_oAuth (51.74s)
--- PASS: TestAccEventsConnection_basic (45.86s)
=== CONT  TestAccEventsConnection_invocationHTTPParameters
--- PASS: TestAccEventsConnection_apiKey (47.42s)
--- PASS: TestAccEventsConnection_invocationHTTPParameters (43.53s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/events	126.158s

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. size/XS Managed by automation to categorize the size of a PR. service/events Issues and PRs that pertain to the events service. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 8, 2022
@AdamTylerLynch AdamTylerLynch added the bug Addresses a defect in current functionality. label Apr 8, 2022
@AdamTylerLynch AdamTylerLynch force-pushed the b-aws_cloudwatch_connection_input_validation-24061 branch from 6859303 to 6fe0273 Compare April 8, 2022 16:52
Copy link
Collaborator

@DrFaust92 DrFaust92 left a comment

Choose a reason for hiding this comment

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

LGTM albeit the use of all is too verbose IMO and can always be added if actually needed.

@ewbankkit ewbankkit added the crash Results from or addresses a Terraform crash or kernel panic. label Apr 12, 2022
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTS=TestAccEventsConnection_ PKG=events ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/events/... -v -count 1 -parallel 2 -run='TestAccEventsConnection_'  -timeout 180m
=== RUN   TestAccEventsConnection_apiKey
=== PAUSE TestAccEventsConnection_apiKey
=== RUN   TestAccEventsConnection_basic
=== PAUSE TestAccEventsConnection_basic
=== RUN   TestAccEventsConnection_oAuth
=== PAUSE TestAccEventsConnection_oAuth
=== RUN   TestAccEventsConnection_invocationHTTPParameters
=== PAUSE TestAccEventsConnection_invocationHTTPParameters
=== RUN   TestAccEventsConnection_disappears
=== PAUSE TestAccEventsConnection_disappears
=== CONT  TestAccEventsConnection_apiKey
=== CONT  TestAccEventsConnection_oAuth
--- PASS: TestAccEventsConnection_apiKey (57.00s)
=== CONT  TestAccEventsConnection_basic
--- PASS: TestAccEventsConnection_oAuth (63.48s)
=== CONT  TestAccEventsConnection_disappears
--- PASS: TestAccEventsConnection_disappears (18.09s)
=== CONT  TestAccEventsConnection_invocationHTTPParameters
--- PASS: TestAccEventsConnection_basic (52.38s)
--- PASS: TestAccEventsConnection_invocationHTTPParameters (49.97s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/events	138.577s

@ewbankkit
Copy link
Contributor

@AdamTylerLynch Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit b58489c into hashicorp:main Apr 12, 2022
@github-actions github-actions bot added this to the v4.10.0 milestone Apr 12, 2022
@github-actions
Copy link

This functionality has been released in v4.10.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. Thank you!

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2022
@justinretzolk justinretzolk added the partner Contribution from a partner. label May 16, 2024
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. crash Results from or addresses a Terraform crash or kernel panic. partner Contribution from a partner. service/events Issues and PRs that pertain to the events service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
4 participants