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

New Glue Data sources - Glue Connection and Glue Data Catalog Encryption Settings #18802

Conversation

danu165
Copy link
Contributor

@danu165 danu165 commented Apr 12, 2021

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

This PR adds new data sources for aws_glue_connection and aws_glue_data_catalog_encryption_settings.

Note: I was not able to test this due to odd behavior from make fmt. It modifies almost every file where it changes all instances of "%w" to "%s". I would appreciate it if someone else could test this for me.

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@danu165 danu165 requested a review from a team as a code owner April 12, 2021 18:02
@ghost ghost added size/L Managed by automation to categorize the size of a PR. provider Pertains to the provider itself, rather than any interaction with AWS. service/glue Issues and PRs that pertain to the glue service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 12, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 12, 2021
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @danu165 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@ghost ghost added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. and removed size/L Managed by automation to categorize the size of a PR. labels Apr 12, 2021
@YakDriver YakDriver assigned YakDriver and unassigned YakDriver Apr 14, 2021
@YakDriver YakDriver removed the needs-triage Waiting for first response or review from a maintainer. label Apr 15, 2021
@YakDriver
Copy link
Member

@danu165 This looks promising. Let us know when you're ready for us to look it over.

@YakDriver YakDriver added the waiting-response Maintainers are waiting on response from community or contributor. label Apr 15, 2021
@danu165 danu165 changed the title [WIP] New Glue Data sources - Glue Connection and Glue Data Catalog Encryption Settings New Glue Data sources - Glue Connection and Glue Data Catalog Encryption Settings Apr 15, 2021
@danu165
Copy link
Contributor Author

danu165 commented Apr 15, 2021

@YakDriver I think it's ready for review now. I put the WIP tag as I couldn't run a testacc due to weird behavior from my make fmt command. I've removed the tag if someone else can run that test for me.

@ghost ghost removed waiting-response Maintainers are waiting on response from community or contributor. labels Apr 15, 2021
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.

initial review

return &schema.Resource{
ReadContext: dataSourceAwsGlueDataCatalogEncryptionSettingsRead,
Schema: map[string]*schema.Schema{
"id": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

id attribute is implicit dont think we need this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it also implicitly required? The goal here is to make id a required argument, so just want to make sure that behavior would remain the same if I take this out.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You are right, my mistake i see this is the convention in data sources to keep "id" explicit. ill try to run tests soon. code wise looks good

@DrFaust92 DrFaust92 self-assigned this Apr 26, 2021
@DrFaust92
Copy link
Collaborator

DrFaust92 commented Apr 29, 2021

Getting this when trying to run tests:


    data_source_aws_glue_connection_test.go:18: Step 1/1 error: Error running apply: exit status 1
        
        Error: error creating Glue Connection (tf-testacc-glue-connection-mm9khn0lwzte1): InvalidInputException: PhysicalConnectionRequirements cannot be null
        


func testAccDataSourceAwsGlueConnectionConfig(rName string) string {
return fmt.Sprintf(`
resource "aws_glue_connection" "test" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

due to faling tests, lets change this to something that works on the resource accaptenece tests:

this is the basic config for connection resource tests

resource "aws_glue_connection" "test" {
  connection_properties = {
    JDBC_CONNECTION_URL = "jdbc:mysql://terraformacctesting.com/testdatabase"
    PASSWORD            = "testpassword"
    USERNAME            = "testusername"
  }

  name = "%s"
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, thank you. Just pushed a commit with this test.

resource.TestCheckResourceAttrPair(datasourceName, "creation_time", resourceName, "creation_time"),
resource.TestCheckResourceAttrPair(datasourceName, "connection_type", resourceName, "connection_type"),
resource.TestCheckResourceAttrPair(datasourceName, "name", resourceName, "name"),
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets also add connection_properties check here as we added it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have connection_properties as part of the schema in the data source. It doesn't appear for every type of connection so I thought it might be best to leave it out.

{
Config: testAccDataSourceAwsGlueDataCatalogEncryptionSettingsConfig(),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsGlueDataCatalogEncryptionSettingsCheck(datasourceName),
Copy link
Collaborator

Choose a reason for hiding this comment

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

from what i see in other datasource tests we don't need this check here. (the data source is not creating anything so there is nothing to check here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I based this from data_source_aws_kms_key_test.go. Could you point me to another file whose structure I should copy?

{
Config: testAccDataSourceAwsGlueConnectionConfig(rName),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsGlueConnectionCheck(datasourceName),
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above resource

@DrFaust92
Copy link
Collaborator

DrFaust92 commented Apr 29, 2021

Hi @danu165.

now im getting:

Error: error decoding Glue Connection : expected ID in format CATALOG-ID:NAME, provided: 

  on terraform_plugin_test.tf line 12, in data "aws_glue_connection" "test":
  12: data "aws_glue_connection" "test" {


    data_source_aws_glue_connection_test.go:18: Step 1/1 error: Error running apply: exit status 1
        
        Error: error decoding Glue Connection : expected ID in format CATALOG-ID:NAME, provided: 
        
          on terraform_plugin_test.tf line 12, in data "aws_glue_connection" "test":
          12: data "aws_glue_connection" "test" {

Are you able to verify tests on your end? ill keep digging meanwhile

@danu165
Copy link
Contributor Author

danu165 commented Apr 30, 2021

@DrFaust92 I haven't been able to get tests working locally. As a note, when I run make fmt it edits almost every file in the repo. It seems to change the line separators for some reason. I then run make testacc TESTARGS='-run=TestAccDataSourceAwsGlueConnection_basic'. That command returns this error:

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccDataSourceAwsGlueConnection_basic -timeout 180m
=== RUN   TestAccDataSourceAwsGlueConnection_basic
=== PAUSE TestAccDataSourceAwsGlueConnection_basic
=== CONT  TestAccDataSourceAwsGlueConnection_basic
    data_source_aws_glue_connection_test.go:18: failed to create new working directory: symlink C:\Users\danu165\development\terraform-providers\terraform-provider-aws\aws\internal C:\Users\danu165\AppData\Local\Temp\plugintest52906
1170\work132527849\internal: A required privilege is not held by the client.
--- FAIL: TestAccDataSourceAwsGlueConnection_basic (3.33s)
FAIL
FAIL    github.com/terraform-providers/terraform-provider-aws/aws       19.216s
FAIL
make: *** [GNUmakefile:28: testacc] Error 1

So it seems my profile doesn't have permissions to create symlinks.

@bflad
Copy link
Contributor

bflad commented Apr 30, 2021

I've created an issue upstream in the project that handles the provider acceptance testing framework: hashicorp/terraform-plugin-sdk#759

Until that is resolved, unfortunately create symbolic link permissions on Windows may be required (or using another OS, such as WSL).

@DrFaust92
Copy link
Collaborator

opened #19367 to address fixes with passing tests

@DrFaust92
Copy link
Collaborator

Closing in favor of #19367. Thanks so much for your work @danu165!

@DrFaust92 DrFaust92 closed this May 17, 2021
@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 Jun 17, 2021
@DrFaust92 DrFaust92 removed their assignment Jun 6, 2022
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. provider Pertains to the provider itself, rather than any interaction with AWS. 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
Development

Successfully merging this pull request may close these issues.

5 participants