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

fix: handle external change of secret type #3141

Merged
merged 17 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
57f2dde
Proper handling of externally change atribute secret_type
sfc-gh-fbudzynski Oct 17, 2024
9a2e33d
add tests for external type changes
sfc-gh-fbudzynski Oct 17, 2024
e82413b
Fix for proper handling of externally changed secret_type
sfc-gh-fbudzynski Oct 17, 2024
309a39c
Change of show_and_describe_handlers to get rid of code duplication
sfc-gh-fbudzynski Oct 17, 2024
510df15
self-review small fixes
sfc-gh-fbudzynski Oct 17, 2024
7d90d7b
resource models re-generated
sfc-gh-fbudzynski Oct 18, 2024
dd38109
fix secret with authorization code grant parameters order
sfc-gh-fbudzynski Oct 18, 2024
90721b4
Merge branch 'main' into secret-type-external-change
sfc-gh-fbudzynski Oct 21, 2024
887507f
add detect secret type change for client_credentials_flow to auth_cod…
sfc-gh-fbudzynski Oct 21, 2024
b05ad4d
Merge branch 'secret-type-external-change' of github.com:Snowflake-La…
sfc-gh-fbudzynski Oct 21, 2024
36c16a0
proper comments to tests and assertions before external change
sfc-gh-fbudzynski Oct 21, 2024
97e7aae
Merge branch 'main' into secret-type-external-change
sfc-gh-fbudzynski Oct 21, 2024
83317e8
docs check fix
sfc-gh-fbudzynski Oct 21, 2024
49dc3b8
Merge branch 'secret-type-external-change' of github.com:Snowflake-La…
sfc-gh-fbudzynski Oct 21, 2024
cf8b7e4
resolved comments for review
sfc-gh-fbudzynski Oct 22, 2024
9cbbca0
Merge branch 'main' into secret-type-external-change
sfc-gh-fbudzynski Oct 23, 2024
55ee85b
conflicts resolved
sfc-gh-fbudzynski Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/resources/secret_with_authorization_code_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ resource "snowflake_secret_with_authorization_code_grant" "test" {
- `describe_output` (List of Object) Outputs the result of `DESCRIBE SECRET` for the given secret. (see [below for nested schema](#nestedatt--describe_output))
- `fully_qualified_name` (String) Fully qualified name of the resource. For more information, see [object name resolution](https://docs.snowflake.com/en/sql-reference/name-resolution).
- `id` (String) The ID of this resource.
- `secret_type` (String) Specifies a type for the secret. This field is used for checking external changes and recreating the resources if needed.
- `show_output` (List of Object) Outputs the result of `SHOW SECRETS` for the given secret. (see [below for nested schema](#nestedatt--show_output))

<a id="nestedatt--describe_output"></a>
Expand Down
1 change: 1 addition & 0 deletions docs/resources/secret_with_basic_authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "snowflake_secret_with_basic_authentication" "test" {
- `describe_output` (List of Object) Outputs the result of `DESCRIBE SECRET` for the given secret. (see [below for nested schema](#nestedatt--describe_output))
- `fully_qualified_name` (String) Fully qualified name of the resource. For more information, see [object name resolution](https://docs.snowflake.com/en/sql-reference/name-resolution).
- `id` (String) The ID of this resource.
- `secret_type` (String) Specifies a type for the secret. This field is used for checking external changes and recreating the resources if needed.
- `show_output` (List of Object) Outputs the result of `SHOW SECRETS` for the given secret. (see [below for nested schema](#nestedatt--show_output))

<a id="nestedatt--describe_output"></a>
Expand Down
1 change: 1 addition & 0 deletions docs/resources/secret_with_client_credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "snowflake_secret_with_client_credentials" "test" {
- `describe_output` (List of Object) Outputs the result of `DESCRIBE SECRET` for the given secret. (see [below for nested schema](#nestedatt--describe_output))
- `fully_qualified_name` (String) Fully qualified name of the resource. For more information, see [object name resolution](https://docs.snowflake.com/en/sql-reference/name-resolution).
- `id` (String) The ID of this resource.
- `secret_type` (String) Specifies a type for the secret. This field is used for checking external changes and recreating the resources if needed.
- `show_output` (List of Object) Outputs the result of `SHOW SECRETS` for the given secret. (see [below for nested schema](#nestedatt--show_output))

<a id="nestedatt--describe_output"></a>
Expand Down
1 change: 1 addition & 0 deletions docs/resources/secret_with_generic_string.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ resource "snowflake_secret_with_generic_string" "test" {
- `describe_output` (List of Object) Outputs the result of `DESCRIBE SECRET` for the given secret. (see [below for nested schema](#nestedatt--describe_output))
- `fully_qualified_name` (String) Fully qualified name of the resource. For more information, see [object name resolution](https://docs.snowflake.com/en/sql-reference/name-resolution).
- `id` (String) The ID of this resource.
- `secret_type` (String) Specifies a type for the secret. This field is used for checking external changes and recreating the resources if needed.
- `show_output` (List of Object) Outputs the result of `SHOW SECRETS` for the given secret. (see [below for nested schema](#nestedatt--show_output))

<a id="nestedatt--describe_output"></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,20 @@ var allResourceSchemaDefs = []ResourceSchemaDef{
name: "StreamOnExternalTable",
schema: resources.StreamOnExternalTable().Schema,
},
{
name: "SecretWithAuthorizationCodeGrant",
schema: resources.SecretWithAuthorizationCodeGrant().Schema,
},
{
name: "SecretWithBasicAuthentication",
schema: resources.SecretWithBasicAuthentication().Schema,
},
{
name: "SecretWithClientCredentials",
schema: resources.SecretWithClientCredentials().Schema,
},
{
name: "SecretWithGenericString",
schema: resources.SecretWithGenericString().Schema,
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert"
)

func (s *SecretWithAuthorizationCodeResourceAssert) HasOauthRefreshTokenExpiryTimeNotEmpty() *SecretWithAuthorizationCodeResourceAssert {
func (s *SecretWithAuthorizationCodeGrantResourceAssert) HasOauthRefreshTokenExpiryTimeNotEmpty() *SecretWithAuthorizationCodeGrantResourceAssert {
s.AddAssertion(assert.ValuePresent("oauth_refresh_token_expiry_time"))
return s
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package model

import tfconfig "github.com/hashicorp/terraform-plugin-testing/config"

func (s *SecretWithClientCredentialsModel) WithOauthScopes(oauthScopes []string) *SecretWithClientCredentialsModel {
oauthScopesStringVariables := make([]tfconfig.Variable, len(oauthScopes))
for i, v := range oauthScopes {
oauthScopesStringVariables[i] = tfconfig.StringVariable(v)
}

s.OauthScopes = tfconfig.SetVariable(oauthScopesStringVariables...)
return s
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading