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

Enable Snowflake as a Database Resource #983

Merged
merged 12 commits into from
Aug 31, 2021

Conversation

bjsemrad
Copy link
Contributor

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
To `vault_database_secret_backend_connection`, add support for the `snowflake-database-plugin`

Output from acceptance testing:

$make testacc TESTARGS='-run=TestAccDatabaseSecretBackendConnection_snowflake'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccDatabaseSecretBackendConnection_snowflake -timeout 120m
?       github.com/hashicorp/terraform-provider-vault   [no test files]
?       github.com/hashicorp/terraform-provider-vault/cmd/coverage      [no test files]
?       github.com/hashicorp/terraform-provider-vault/cmd/generate      [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/codegen   (cached) [no tests to run]
?       github.com/hashicorp/terraform-provider-vault/generated [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/datasources/transform/decode    (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/datasources/transform/encode    (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/resources/transform/alphabet    (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/resources/transform/role        (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/resources/transform/template    (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/resources/transform/transformation      (cached) [no tests to run]
?       github.com/hashicorp/terraform-provider-vault/schema    [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/util      (cached) [no tests to run]
=== RUN   TestAccDatabaseSecretBackendConnection_snowflake
hellow
--- PASS: TestAccDatabaseSecretBackendConnection_snowflake (2.80s)
PASS
ok      github.com/hashicorp/terraform-provider-vault/vault     2.847s
...

@bjsemrad
Copy link
Contributor Author

I can remove the dependency updates, but I ran suggested vendor commands (and those were updated).

@robbruce
Copy link

robbruce commented Jun 9, 2021

@bjsemrad - can you get this rebased with master?

@bjsemrad
Copy link
Contributor Author

@robbruce rebased, and updated mods/tidy sorry it took a bit.

@chriskuchin
Copy link

Would love to use this. Is there any plan to get this merged? Was just going to put this together basically the same and then found this one. Happy to look into the Conflicts if @bjsemrad is unable to at this point.

@bjsemrad
Copy link
Contributor Author

bjsemrad commented Aug 16, 2021

@chriskuchin I’ll rebase this again tonight. Sorry not actively watching it.

@chriskuchin
Copy link

No worries thanks appreciate that.

@robbruce once that is fixed is there anything else that is needed to get this merged?

@robbruce
Copy link

@chriskuchin - I’m not a code maintainer, just a consumer. Thanks for keeping it up to date though!

@chriskuchin
Copy link

ahh ok I will see if i can chase down looking at git history a maintainer after the conflicts are cleaned up and see if we can get this merged

@chriskuchin
Copy link

@tvoran you seem to be the only active maintainer on this repo. Once the conflicts are cleaned up do you need anything else to get this added to the provider? Happy to write up an issue or anything else you need to get this pulled into the provider.

Thanks

@bjsemrad
Copy link
Contributor Author

@chriskuchin PR was updated I'll try to watch this more closely.

@chriskuchin
Copy link

@bjsemrad awesome thanks.

@tvoran is there someone else I should be trying to coordinate this addition with? looking at the changelog and main branch commits seems like you are the only active maintainer. Happy to do whatever it takes to get this moved forward. Thanks!

@tvoran tvoran self-requested a review August 20, 2021 22:21
.test-env Outdated Show resolved Hide resolved
Comment on lines 282 to 286
"account": {
Type: schema.TypeString,
Required: true,
Description: "The Account Name for the snowflake connection. Formats <accountname> if in us-west-2, or <accountname>.<region> for any other region",
},
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious why this schema breaks the connection_url API parameter up into its components? Is it just for convenience?

What do you think about just following the API parameters, and including good examples in the docs for different types of connection_url's? It also looks like in order to support root credential rotation, we need to be able to specify the connection_url separately from the username and password.

Also this schema seems to be missing the max_open_connections, max_idle_connections, max_connection_lifetime, and username_template parameters.

Choose a reason for hiding this comment

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

I agree that just a connection_url makes sense.

The host name can be more than just account.region, depending if Snowflake organisations and/or PrivateLink is being used.

Copy link
Contributor Author

@bjsemrad bjsemrad Aug 26, 2021

Choose a reason for hiding this comment

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

Yea I was trying to simplify the configuration / allow parameterization for terraform to abstract away what might change. Thinking about it more just simplifying it will make this require less changes in the future. Will update tonight.

Not sure how I missed the max connections etc, might have just not committed it originally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tvoran please check the latest, this should cover it and use the additional api items added after the original PR.

@chriskuchin
Copy link

@bjsemrad sorry to be that guy... But if you don't have time i can fork off of your changes and address the comments above

Co-authored-by: Theron Voran <[email protected]>
Copy link

@chriskuchin chriskuchin left a comment

Choose a reason for hiding this comment

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

@bjsemrad this is awesome thanks so much for handling all this

@tvoran tvoran self-requested a review August 27, 2021 23:44
Copy link
Member

@tvoran tvoran left a comment

Choose a reason for hiding this comment

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

Almost there! Just one suggestion in the test, and there are a couple spacing issues that make fmt will fix.

vault/resource_database_secret_backend_connection.go Outdated Show resolved Hide resolved
website/docs/r/database_secret_backend_connection.md Outdated Show resolved Hide resolved
website/docs/r/database_secret_backend_connection.md Outdated Show resolved Hide resolved
vault/resource_database_secret_backend_connection_test.go Outdated Show resolved Hide resolved
Copy link
Member

@tvoran tvoran left a comment

Choose a reason for hiding this comment

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

Thanks!

@tvoran tvoran merged commit bb70eb5 into hashicorp:master Aug 31, 2021
@bjsemrad bjsemrad deleted the snowflakeEnablement branch August 31, 2021 15:34
@chriskuchin
Copy link

Thanks really appreciate all the work here!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants