From e54f982edf804dfe5c4d04d5f35ced9a532e63de Mon Sep 17 00:00:00 2001 From: Scott Winkler Date: Tue, 10 Jan 2023 13:14:13 -0800 Subject: [PATCH 1/2] remove unnecessary else statement --- pkg/resources/pipe_grant.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/resources/pipe_grant.go b/pkg/resources/pipe_grant.go index d34b5e18a0..4e029dd460 100644 --- a/pkg/resources/pipe_grant.go +++ b/pkg/resources/pipe_grant.go @@ -93,14 +93,14 @@ func CreatePipeGrant(d *schema.ResourceData, meta interface{}) error { pipeName string schemaName string ) + if name, ok := d.GetOk("pipe_name"); ok { pipeName = name.(string) } if name, ok := d.GetOk("schema_name"); ok { schemaName = name.(string) - } else { - schemaName = "" } + dbName := d.Get("database_name").(string) priv := d.Get("privilege").(string) onFuture := d.Get("on_future").(bool) @@ -108,10 +108,10 @@ func CreatePipeGrant(d *schema.ResourceData, meta interface{}) error { roles := expandStringList(d.Get("roles").(*schema.Set).List()) if (schemaName == "") && !onFuture { - return errors.New("schema_name must be set unless on_future is true.") + return errors.New("schema_name must be set unless on_future is true") } if (pipeName == "") && !onFuture { - return errors.New("pipe_name must be set unless on_future is true.") + return errors.New("pipe_name must be set unless on_future is true") } var builder snowflake.GrantBuilder From a8ab694a198205bdaf9d9e3c5ffcf6b813c92703 Mon Sep 17 00:00:00 2001 From: Scott Winkler Date: Tue, 10 Jan 2023 13:27:52 -0800 Subject: [PATCH 2/2] update readme --- README.md | 71 +++++++++++++------------------------------------------ 1 file changed, 17 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 1639a11748..118274bd7b 100644 --- a/README.md +++ b/README.md @@ -10,24 +10,27 @@ This is a terraform provider plugin for managing [Snowflake](https://www.snowfla ## Getting Help -If you need help, try the [discussions area](https://github.com/Snowflake-Labs/terraform-provider-snowflake/discussions) of this repo. +If you need help, try the [discussions area](https://github.com/Snowflake-Labs/terraform-provider-snowflake/discussions) of this repo. + +**Note**: If you are an enterprise customer, please file a support ticket with your Snowflake account representative. We prioritize support tickets over GitHub issues. Also it helps us with allocating additional engineering resources to supporting the provider. ## Install -The easiest way is to run this command: +You can install the provider using `terraform init`, all you need to do is include the following block in your Terraform settings configuration. Refer to [Explicit Provider Source Locations](https://www.terraform.io/upgrade-guides/0-13.html#explicit-provider-source-locations) for more information. -```shell -curl https://raw.githubusercontent.com/chanzuckerberg/terraform-provider-snowflake/main/download.sh | bash -s -- -b $HOME/.terraform.d/plugins +```hcl +terraform { + required_providers { + snowflake = { + source = "Snowflake-Labs/snowflake" + version = "~> 0.55.0" + } + } +} ``` -**Note that this will only work with recent releases, for older releases, use the version of download.sh that corresponds to that release (replace main in that curl with the version).** - -It runs a script generated by [godownloader](https://github.com/goreleaser/godownloader) which installs into the proper directory for terraform (~/.terraform.d/plugins). - -You can also just download a binary from our [releases](https://github.com/Snowflake-Labs/terraform-provider-snowflake/releases) and follow the [Terraform directions for installing 3rd party plugins](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins). - ### Upgrading from CZI Provider -As of (5/25/2022) to provider has been transferred from CZI to Snowflake-Labs. To upgrade from CZI, please run the following command: +As of (5/25/2022) to provider has been transferred from Chan Zuckerberg Initiative (CZI) to Snowflake-Labs. To upgrade from CZI, please run the following command: ```shell terraform state replace-provider chanzuckerberg/snowflake Snowflake-Labs/snowflake @@ -38,8 +41,6 @@ You should also update your lock file / Terraform provider version pinning. From ```hcl # deprecated source terraform { - required_version = ">= 1.1.7" - required_providers { snowflake = { source = "chanzuckerberg/snowflake" @@ -54,8 +55,6 @@ To new source: ```hcl # new source terraform { - required_version = ">= 1.1.7" - required_providers { snowflake = { source = "Snowflake-Labs/snowflake" @@ -64,31 +63,13 @@ terraform { } } ``` + If you are not pinning your provider versions, you may find it useful to forcefully upgrade providers using the command: ``` terraform init -upgrade ``` ->**Note**: 0.34 is the first version published after the transfer. When the provider was transferred over not all releases were transferred for some reason. Only versions 0.28 and newer were transferred. - -### For Terraform v0.13+ users - -> We are now (7/29/2021) using Terraform 0.13 for testing purposes due to an issue for data sources for versions <0.13. Related PR for this change [here](https://github.com/Snowflake-Labs/terraform-provider-snowflake/pull/622#issuecomment-888879621). - -You can use [Explicit Provider Source Locations](https://www.terraform.io/upgrade-guides/0-13.html#explicit-provider-source-locations). - -The following should be used for provider locking: - -```terraform -terraform { - required_providers { - snowflake = { - source = "Snowflake-Labs/snowflake" - version = "0.54.0" - } - } -} -``` +>**Note**: 0.34 is the first version published after the transfer. When the provider was transferred over not all of the older releases were transferred for some reason. Only versions 0.28 and newer were transferred. If you are using a version older than 0.28, it is highly recommended to upgrade to a newer version. ## Usage @@ -171,26 +152,8 @@ You will also need to generate a Github API token and add the secret: **Note: releases can only be done by those with keybase pgp keys allowed in the terraform registry.** -Releases will be performed once a week on **Monday around 11am PST**. If your change is more urgent and you need to use it sooner, use the commit hash. +Releases will be performed as needed, typically once every 1-2 weeks. If your change is more urgent and you need to use it sooner, use the commit hash. Releases are done by [goreleaser](https://goreleaser.com/) and run by our make files. There two goreleaser configs, `.goreleaser.yml` for regular releases and `.goreleaser.prerelease.yml` for doing prereleases (for testing). Releases are [published to the terraform registry](https://registry.terraform.io/providers/chanzuckerberg/snowflake/latest), which requires that releases by signed. - -## Adding a new releaser - -To set up a new person for releasing, there are a few steps– - -1. releaser: a [keybase account](https://keybase.io/) and a workstation set up with their [Keybase app](https://keybase.io/download). -2. releaser: a pgp key - `keybase pgp gen` -3. releaser: export public key. - 1. If you have a single key in keybase– - 1. `keybase pgp export` - 2. If you have more than one key– - 1. `keybase pgp export` to find id if key you want to export - 2. `keybase pgp export -q KEY_ID` -4. github admin for chanzuckerberg: take public key exported above and add it [in the registry](https://registry.terraform.io/settings/gpg-keys) -5. releaser: set `KEYBASE_KEY_ID` environment variable. Note that this is different from the previous id. Get this one from `keybase pgp list`. It should be like ~70 characters long. -6. set `GITHUB_TOKEN` environment variable with a personal access token -7. releaser: run `make release-prerelease` to test that releases are working correctly -8. releaser: run `make release` to release for real