You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Fix using lowercased network policies in security integrations (#3867)
Fix setting network policies with lowercase characters in security
integrations
- Modify the SDK to properly quote network policy names in security
integrations
- Added integration tests to verify the fix works
- Remove the warning note from the documentation
- Updated the migration guide with information about the fix
- This fix contains a workaround, as the SDK doesn't support custom
quoting in identifiers nicely. Added a note to the generator readme.
- Adjust the def file with the required `oauth_redirect_uri`. The
generated code was already good, but only the def was updated. Fix the
example docs as well.
- Move some manually added code to an ext file.
## References
- #3229
- SNOW-1833593
-
https://docs.snowflake.com/en/sql-reference/sql/create-security-integration-oauth-snowflake
Copy file name to clipboardExpand all lines: MIGRATION_GUIDE.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,15 @@ Previously, this field was read-only. In this version, this field is an optional
29
29
30
30
Note that this resource is still in preview, and not officially supported. This change was requested and done by the community: [#3659](https://github.com/snowflakedb/terraform-provider-snowflake/pull/3659).
31
31
32
+
### *(bugfix)* Fix setting network policies with lowercase characters in security integrations
33
+
Previously, when the provider created or set a security integration (in `snowflake_oauth_integration_for_custom_clients` or `snowflake_scim_integration`) with a network policy containing lowercase letters, this could fail due to a different quoting used in Snowflake in these objects. Namely, despite using the `"` quotes, the referenced network name was uppercased in Snowflake. This means that the uppercased network policy was used instead.
34
+
Snowflake could return errors like `Network policy TEST does not exist or not authorized.`.
35
+
In this case, a special quoting needs to be used (see [docs](https://docs.snowflake.com/en/sql-reference/sql/create-security-integration-oauth-snowflake)). Instead of the usual `NETWORK_POLICY = "test"`, it needs to be `NETWORK_POLICY = '"test"'`.
36
+
37
+
In this version, this behavior is fixed. The provider always uses the mixed `'"name"'` notation, and the casing should match the name in Snowflake.
Copy file name to clipboardExpand all lines: docs/resources/oauth_integration_for_custom_clients.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,6 @@ description: |-
7
7
8
8
!> **Sensitive values** This resource's `oauth_redirect_uri` and `describe_output.oauth_redirect_uri` fields are not marked as sensitive in the provider. Ensure that no personal data, sensitive data, export-controlled data, or other regulated data is entered as metadata when using the provider. If you use one of these fields, they may be present in logs, so ensure that the provider logs are properly restricted. For more information, see [Sensitive values limitations](../#sensitive-values-limitations) and [Metadata fields in Snowflake](https://docs.snowflake.com/en/sql-reference/metadata).
9
9
10
-
!> **Note** Setting a network policy with lowercase letters does not work correctly in Snowflake (see [issue](https://github.com/snowflakedb/terraform-provider-snowflake/issues/3229)). As a workaround, set the network policy with uppercase letters only, or use [execute](./execute) with network policy ID wrapped in `'`.
11
-
12
10
!> **Note** The provider does not detect external changes on security integration type. In this case, remove the integration of wrong type manually with `terraform destroy` and recreate the resource. It will be addressed in the future.
13
11
14
12
~> **Missing fields** The `oauth_client_id` and `oauth_redirect_uri` fields are not present in the `describe_output` on purpose due to Terraform SDK limitations (more on that in the [migration guide](https://github.com/snowflakedb/terraform-provider-snowflake/blob/main/MIGRATION_GUIDE.md#removal-of-sensitive-fields)).
Copy file name to clipboardExpand all lines: pkg/sdk/poc/README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,6 +142,7 @@ find a better solution to solve the issue (add more logic to the templates ?)
142
142
- Add a possibility to generate a non-sql method with a custom implementation. Currently, it is done only in `ShowById...` functions with `newNoSqlOperation`.
143
143
- improve handling operations that return one row
144
144
- add more context to validated identifiers, so that error contains the affected field
145
+
- add custom identifier wrapping, like it's used in security integrations' network policies
145
146
146
147
##### Known issues
147
148
- generating two converts when Show and Desc use the same data structure
0 commit comments