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

feat: Add support for third-party connection types to aws_glue_connection #37731

Merged

Conversation

acwwat
Copy link
Contributor

@acwwat acwwat commented May 28, 2024

Description

This PR is to add support for the following connection types: AZURECOSMOS, AZURESQL, BIGQUERY, OPENSEARCH, SNOWFLAKE. These types were confirmed by AWS support to be supported but not fully documented. They are also not available in types and enums in various SDKs, including the AWS Go SDK v2 which the Terraform AWS Provider uses.

The approach to add these connection types is to check whether they are in the SDK enum, and add them if they are not. This provides some level of compatibility for when the enum eventually gets updated before the code is removed for good. In addition, a new value SparkProperties is needed for the enum for connection_properties. It is also not documented but supported by the API. Each connection type make require different properties within a JSON object that is provided as the value for SparkProperties. I am not sure how to best document them, so I've added a full example for each type in the documentation.

Relations

Closes #37233
Closes #34575
Closes #32663

References

Examined network traces for CreateConnection requests made in the Console to determine what properties are needed in the JSON object for SparkProperties.

Output from Acceptance Testing

$ make testacc TESTS=TestAccGlueConnection_ PKG=glue
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.2 test ./internal/service/glue/... -v -count 1 -parallel 20 -run='TestAccGlueConnection_'  -timeout 360m
=== RUN   TestAccGlueConnection_basic
=== PAUSE TestAccGlueConnection_basic
=== RUN   TestAccGlueConnection_tags
=== PAUSE TestAccGlueConnection_tags
=== RUN   TestAccGlueConnection_mongoDB
=== PAUSE TestAccGlueConnection_mongoDB
=== RUN   TestAccGlueConnection_kafka
=== PAUSE TestAccGlueConnection_kafka
=== RUN   TestAccGlueConnection_network
=== PAUSE TestAccGlueConnection_network
=== RUN   TestAccGlueConnection_description
=== PAUSE TestAccGlueConnection_description
=== RUN   TestAccGlueConnection_matchCriteria
=== PAUSE TestAccGlueConnection_matchCriteria
=== RUN   TestAccGlueConnection_physicalConnectionRequirements
=== PAUSE TestAccGlueConnection_physicalConnectionRequirements
=== RUN   TestAccGlueConnection_disappears
=== PAUSE TestAccGlueConnection_disappears
=== RUN   TestAccGlueConnection_azureCosmos
=== PAUSE TestAccGlueConnection_azureCosmos
=== RUN   TestAccGlueConnection_azureSQL
=== PAUSE TestAccGlueConnection_azureSQL
=== RUN   TestAccGlueConnection_bigQuery
=== PAUSE TestAccGlueConnection_bigQuery
=== RUN   TestAccGlueConnection_openSearch
=== PAUSE TestAccGlueConnection_openSearch
=== RUN   TestAccGlueConnection_snowflake
=== PAUSE TestAccGlueConnection_snowflake
=== CONT  TestAccGlueConnection_basic
=== CONT  TestAccGlueConnection_physicalConnectionRequirements
=== CONT  TestAccGlueConnection_network
=== CONT  TestAccGlueConnection_matchCriteria
=== CONT  TestAccGlueConnection_mongoDB
=== CONT  TestAccGlueConnection_description
=== CONT  TestAccGlueConnection_kafka
=== CONT  TestAccGlueConnection_tags
=== CONT  TestAccGlueConnection_bigQuery
=== CONT  TestAccGlueConnection_disappears
=== CONT  TestAccGlueConnection_snowflake
=== CONT  TestAccGlueConnection_azureCosmos
=== CONT  TestAccGlueConnection_openSearch
=== CONT  TestAccGlueConnection_azureSql
--- PASS: TestAccGlueConnection_disappears (23.74s)
--- PASS: TestAccGlueConnection_basic (27.32s)
--- PASS: TestAccGlueConnection_mongoDB (28.18s)
--- PASS: TestAccGlueConnection_kafka (28.81s)
--- PASS: TestAccGlueConnection_snowflake (28.84s)
--- PASS: TestAccGlueConnection_azureCosmos (29.83s)
--- PASS: TestAccGlueConnection_azureSQL (30.09s)
--- PASS: TestAccGlueConnection_openSearch (30.13s)
--- PASS: TestAccGlueConnection_bigQuery (30.13s)
--- PASS: TestAccGlueConnection_network (34.80s)
--- PASS: TestAccGlueConnection_description (38.89s)
--- PASS: TestAccGlueConnection_matchCriteria (47.44s)
--- PASS: TestAccGlueConnection_tags (47.58s)
--- PASS: TestAccGlueConnection_physicalConnectionRequirements (1352.11s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/glue       1352.343s

Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/glue Issues and PRs that pertain to the glue service. labels May 28, 2024
@terraform-aws-provider terraform-aws-provider bot added needs-triage Waiting for first response or review from a maintainer. external-maintainer Contribution from a trusted external contributor. labels May 28, 2024
@acwwat acwwat force-pushed the f-aws_glue_connection-addl_conn_type_support branch 6 times, most recently from 2fd05c3 to 7c1dfc1 Compare May 28, 2024 08:50
@acwwat acwwat force-pushed the f-aws_glue_connection-addl_conn_type_support branch from 7c1dfc1 to 0037b05 Compare May 28, 2024 13:57
@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels May 28, 2024
@fshskadz
Copy link

fshskadz commented Jul 9, 2024

Hey @acwwat - Two things here.

a) You have conflicts, its in the documentation (I hand patched today)
b) It looks like there is still some validation broken:

│ Error: creating Glue Connection (Reporting - dev): InvalidInputException: Connection properties input is malformed: Unrecognized token 'foo': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') │ at [Source: (String)"foo"; line: 1, column: 4] │ { │ RespMetadata: { │ StatusCode: 400, │ RequestID: "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa" │ }, │ Message_: "Connection properties input is malformed: Unrecognized token 'foo': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n at [Source: (String)\"foo\"; line: 1, column: 4]" │ } │ │ with module.glue_dev.aws_glue_connection.reporting, │ on ../../../modules/glue/connection.tf line 20, in resource "aws_glue_connection" "reporting": │ 20: resource "aws_glue_connection" "reporting" { │

This doesn't work with any input. It works 100% fine when doing a JDBC connection, so I am guessing maybe something else needs to be added to the validation for connection properties. I tried looking though the code, but got dizzy :). Any help would be VERY VERY much appreciated.

@fshskadz
Copy link

fshskadz commented Jul 9, 2024

Yes, conflicts are there, but I missed the Spark Properties thing, going too fast. Seems to be good now. Thanks!

# Conflicts:
#	internal/service/glue/connection.go
#	internal/service/glue/connection_test.go
#	website/docs/r/glue_connection.html.markdown
@ewbankkit ewbankkit requested a review from a team as a code owner July 23, 2024 13:46
@ewbankkit ewbankkit self-assigned this Jul 23, 2024
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 TESTARGS='-run=TestAccGlueConnection_' PKG=glue ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/glue/... -v -count 1 -parallel 3  -run=TestAccGlueConnection_ -timeout 360m
=== RUN   TestAccGlueConnection_basic
=== PAUSE TestAccGlueConnection_basic
=== RUN   TestAccGlueConnection_tags
=== PAUSE TestAccGlueConnection_tags
=== RUN   TestAccGlueConnection_mongoDB
=== PAUSE TestAccGlueConnection_mongoDB
=== RUN   TestAccGlueConnection_kafka
=== PAUSE TestAccGlueConnection_kafka
=== RUN   TestAccGlueConnection_network
=== PAUSE TestAccGlueConnection_network
=== RUN   TestAccGlueConnection_description
=== PAUSE TestAccGlueConnection_description
=== RUN   TestAccGlueConnection_matchCriteria
=== PAUSE TestAccGlueConnection_matchCriteria
=== RUN   TestAccGlueConnection_physicalConnectionRequirements
=== PAUSE TestAccGlueConnection_physicalConnectionRequirements
=== RUN   TestAccGlueConnection_disappears
=== PAUSE TestAccGlueConnection_disappears
=== RUN   TestAccGlueConnection_azureCosmos
=== PAUSE TestAccGlueConnection_azureCosmos
=== RUN   TestAccGlueConnection_azureSQL
=== PAUSE TestAccGlueConnection_azureSQL
=== RUN   TestAccGlueConnection_bigQuery
=== PAUSE TestAccGlueConnection_bigQuery
=== RUN   TestAccGlueConnection_openSearch
=== PAUSE TestAccGlueConnection_openSearch
=== RUN   TestAccGlueConnection_snowflake
=== PAUSE TestAccGlueConnection_snowflake
=== CONT  TestAccGlueConnection_basic
=== CONT  TestAccGlueConnection_physicalConnectionRequirements
=== CONT  TestAccGlueConnection_network
--- PASS: TestAccGlueConnection_basic (11.67s)
=== CONT  TestAccGlueConnection_matchCriteria
--- PASS: TestAccGlueConnection_network (20.40s)
=== CONT  TestAccGlueConnection_bigQuery
--- PASS: TestAccGlueConnection_bigQuery (12.17s)
=== CONT  TestAccGlueConnection_description
--- PASS: TestAccGlueConnection_matchCriteria (24.07s)
=== CONT  TestAccGlueConnection_snowflake
--- PASS: TestAccGlueConnection_snowflake (12.38s)
=== CONT  TestAccGlueConnection_openSearch
--- PASS: TestAccGlueConnection_description (17.81s)
=== CONT  TestAccGlueConnection_mongoDB
--- PASS: TestAccGlueConnection_openSearch (12.12s)
=== CONT  TestAccGlueConnection_tags
--- PASS: TestAccGlueConnection_mongoDB (11.03s)
=== CONT  TestAccGlueConnection_azureCosmos
--- PASS: TestAccGlueConnection_azureCosmos (12.18s)
=== CONT  TestAccGlueConnection_azureSQL
--- PASS: TestAccGlueConnection_tags (24.75s)
=== CONT  TestAccGlueConnection_disappears
--- PASS: TestAccGlueConnection_azureSQL (12.47s)
=== CONT  TestAccGlueConnection_kafka
--- PASS: TestAccGlueConnection_disappears (9.32s)
--- PASS: TestAccGlueConnection_kafka (10.92s)
--- PASS: TestAccGlueConnection_physicalConnectionRequirements (1319.41s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/glue	1324.071s

@ewbankkit
Copy link
Contributor

@acwwat Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 3a37341 into hashicorp:main Jul 23, 2024
47 checks passed
@github-actions github-actions bot added this to the v5.60.0 milestone Jul 23, 2024
Copy link

This functionality has been released in v5.60.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!

@acwwat acwwat deleted the f-aws_glue_connection-addl_conn_type_support branch July 27, 2024 02:09
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 Aug 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. external-maintainer Contribution from a trusted external contributor. service/glue Issues and PRs that pertain to the glue service. size/XL 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
4 participants