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

Pull Latest #4

Merged
merged 24 commits into from
Aug 11, 2020
Merged

Pull Latest #4

merged 24 commits into from
Aug 11, 2020

Conversation

chriskuchin
Copy link
Owner

Test Plan

  • acceptance tests

References

chriskuchin and others added 24 commits June 3, 2020 14:26
Snowflake doesn't like the sql string returned by terraform because when it contains quotes. It escapes the quotes by default. This PR removes `\` and unescapes the sql.
<!-- Feel free to delete comments as you fill this in -->
Adds OAuth access token support as requested [in this ticket](#37).

Note this does not add logic around renewing the access token. If the access token is not valid, the user is presented with the Snowflake error.

We at Flexport have a potential use case where we would like to generate short-lived OAuth tokens and distribute to an application or user for a brief period of time.

<!-- summary of changes -->

## Test Plan
<!-- detail ways in which this PR has been tested or needs to be tested -->
* [x] Manual acceptance test: Generated valid oauth access token from Snowflake account with the correct roles, and verified that the roles are correct
* [x] Manual acceptance test: Verified that when an empty access token is used, Snowflake reports "missing password"
* [x] Unit test: DSN unit test corresponding to tests above

## References
<!-- issues documentation links, etc  -->
* [Snowflake OAuth Flow for Custom Clients](https://docs.snowflake.com/en/user-guide/oauth-custom.html#configure-snowflake-oauth-for-custom-clients)
Refactor to make it easier to have consistent test results when testing
our DSN generation.

Previously the approach we were using would implicitly read environment
variables, which means that if you had any relevant ones set (like
`SNOWFLAKE_USER`) the test code would use that.

## Test Plan
<!-- detail ways in which this PR has been tested or needs to be tested -->
* [x] acceptance tests

## References
*
Publish this provider to the terraform registry.

In terraform 0.13 third party providers can be published to the terraform registry. This PR implements the necessary pieces, including signing all releases.

## Test Plan
* [x] pushed 0.13.0+b2a3596 to the registry at https://registry.terraform.io/providers/chanzuckerberg/snowflake/latest?pollNotifications=true

## References
* https://docs.google.com/document/d/1J4p5KFH129wZbSF0XUioDbHSB7uZA-l2o1psLa-3YS4/edit
Fix download.sh by specifying .zip and fixing the path to the checksums
file.

This broke with our changes to support releasing to the registry and
this should fix #215.

## Test Plan
* [x] acceptance tests
* [x] reproduce the problem with: `curl https://raw.githubusercontent.com/chanzuckerberg/terraform-provider-snowflake/master/download.sh | bash -s -- -d -b $HOME/.terraform.d/plugins v0.13.2
` and test the fix with `curl https://raw.githubusercontent.com/chanzuckerberg/terraform-provider-snowflake/ryanking/update_download.sh/download.sh | bash -s -- -d -b $HOME/.terraform.d/plugins v0.13.2`

## References
* Fixes #215
The h1 renders with a line under it, so we get to horizontal lines in a row.
Update to latest version of go-misc and make use of the refactored version code, which fixes the version syntax for prerelease versions.

## Test Plan
* [x] acceptance tests

## References
* chanzuckerberg/go-misc#74
* https://semver.org/#spec-item-9
Move docs to a spot where the Terraform registry can pick them up.

Once we do another release, the docs should show up
[here](https://registry.terraform.io/providers/chanzuckerberg/snowflake/latest).
We won't be able to test this completely until a release is done.

Docs for the docs -
https://www.terraform.io/docs/registry/providers/docs.html.

## Test Plan
* [ ] CI

## References
* https://www.terraform.io/docs/registry/providers/docs.html
The new go language server really likes to complain about these.

## Test Plan
* [x] acceptance tests

## References
* microsoft/vscode#97406
Updated the snowflake website
Snowflake appears to have changed something which is now causing this
test to fail. Skipping it for now while I find someone who can address
the problem.

cc @henriblancke  and @chriskuchin  who worked on this originally. Any chance one of you could look at this?

## Test Plan
* [ ] acceptance tests

## References
* #196
Escape comments and other string fields that are not currently escaped in our query builders.

## Test Plan
<!-- detail ways in which this PR has been tested or needs to be tested -->
* [ ] acceptance tests

## References
* Fixes #127
@chriskuchin chriskuchin merged commit d75c940 into chriskuchin:master Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants