-
Notifications
You must be signed in to change notification settings - Fork 428
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
feat: Secret resource #3110
feat: Secret resource #3110
Conversation
Integration tests failure for 9dea35cc44894aa14b7aee86e70ff75f166591b3 |
pkg/resources/secret_with_basic_authentication_acceptance_test.go
Outdated
Show resolved
Hide resolved
pkg/resources/secret_with_basic_authentication_acceptance_test.go
Outdated
Show resolved
Hide resolved
pkg/resources/secret_with_oauth_client_credentials_acceptance_test.go
Outdated
Show resolved
Hide resolved
pkg/resources/secret_with_oauth_authorization_code_grant_acceptance_test.go
Outdated
Show resolved
Hide resolved
)) | ||
}, | ||
Config: config.FromModel(t, secretModel), | ||
Config: config.FromModel(t, secretModelExternalChanges), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not quite sure about this test, why we alter both the config and externally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because i didnt correct this one after changes to handling token_expiry_time
field
I will correct that and use properly, it should test the external change
pkg/resources/secret_with_oauth_authorization_code_grant_acceptance_test.go
Outdated
Show resolved
Hide resolved
pkg/resources/secret_with_oauth_client_credentials_acceptance_test.go
Outdated
Show resolved
Hide resolved
…oint from 0.97 -> 0.98
Integration tests failure for 1a9a6db5d90a1aae584ad610aa61662257321624 |
|
||
//go:generate go run ./poc/main.go | ||
const ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: we usually have separated types for such groups of enum values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be added with the PR for externally changed secret_types
Integration tests failure for b202fdde49d84844251674844f50696e17315af8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update on main to have a longer timeout for acceptance tests
@@ -67,8 +67,9 @@ func TestAcc_SecretWithBasicAuthentication_BasicFlow(t *testing.T) { | |||
resource.TestCheckResourceAttr(secretName, "describe_output.0.name", name), | |||
resource.TestCheckResourceAttr(secretName, "describe_output.0.database_name", id.DatabaseName()), | |||
resource.TestCheckResourceAttr(secretName, "describe_output.0.schema_name", id.SchemaName()), | |||
resource.TestCheckResourceAttr(secretName, "describe_output.0.secret_type", "PASSWORD"), | |||
resource.TestCheckResourceAttr(secretName, "describe_output.0.secret_type", sdk.SecretTypePassword), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the separate type change you will have to do sdk.SecretTypePassword -> string(sdk.SecretTypePassword) in multiple tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be changed in a PR with the secret type change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I will keep this open then
@@ -43,6 +43,28 @@ type showMapping struct { | |||
normalizeFunc func(any) any | |||
} | |||
|
|||
// handleExternalValueChangesToObjectInDescribe assumes that describe output is kept in DescribeOutputAttributeName attribute | |||
func handleExternalValueChangesToObjectInDescribe(d *schema.ResourceData, mappings ...describeMapping) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is copy-paste of handleExternalChangesToObjectInShow, only the var names and attribute name changes. Please extract this as a common body (it may be done in a separate PR)
Integration tests failure for b202fdde49d84844251674844f50696e17315af8 |
<!-- Feel free to delete comments as you fill this in --> <!-- summary of changes --> ## Changes * Added secret_type computed filed to secret resources * Added CustomDiff for handling external change of secret_type * Refactored show_and_describe_handlers for flat describe_output and show_output * Tested external change of secret type for each resource ## Test Plan <!-- detail ways in which this PR has been tested or needs to be tested --> * [x] acceptance tests ## References <!-- issues documentation links, etc --> * #3110 (comment) * #3110 (comment)
## [0.98.0](v0.97.0...v0.98.0) (2024-11-08) Feature scope readiness for V1: [link](/~https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/v1-preparations/ESSENTIAL_GA_OBJECTS.MD) ([Roadmap reference](/~https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#wrap-up-the-functional-scope)). :exclamation: Migration guide: [v0.97.0 -> v0.98.0](/~https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/MIGRATION_GUIDE.md#v0970--v0980) ### 🎉 What's new - New resources: - authentication_policy ([#3098](#3098)), references [#2880](#2880) - external_volume ([#3106](#3106)), partially references [#2980](#2980) - stream_on_directory_table ([#3129](#3129)) - stream_on_view ([#3150](#3150)) - primary_connection, secondary_connection ([#3162](#3162)) - secret_with_basic_authentication, secret_with_generic_string, secret_with_oauth_authorization_code_grant, secret_with_oauth_client_credentials ([#3110](#3110)), ([#3141](#3141)) - New data sources: - connections ([#3155](#3155)), ([#3173](#3173)) - secrets ([#3131](#3131)) - Reworked: - provider configuration hierarchy ([#3166](#3166)), references [#1881](#1881), [#2145](#2145), [#2925](#2925), [#2983](#2983), [#3104](#3104) - provider configuration fields ([#3152](#3152)) streams data source ([#3151](#3151)) - SDK upgrades: - Upgrade tag SDK ([#3126](#3126)) - Recreate streams when they are stale ([#3129](#3129)) ### 🔧 Misc - Add object renaming research summary ([#3172](#3172)) - Test support for object renaming ([#3130](#3130)), ([#3147](#3147)), ([#3154](#3154)) - Add tests to issue [#3117](#3117) ([#3133](#3133)) - New roadmap entry ([#3158](#3158)) - Test more authentication methods ([#3178](#3178)) - Minor fixes ([#3174](#3174)) ### 🐛 Bug fixes - Apply various fixes ([#3176](#3176)), this addresses BCR 2024_08, references [#2717](#2717), [#3005](#3005), [#3125](#3125), [#3127](#3127), [#3153](#3153) - Connection and secret data sources tests ([#3177](#3177)) - Fix grant import docs ([#3183](#3183)), resolves [#3179](/~https://github.com/Snowflake-Labs/terraform-provider-snowflake/discussions/3179) - Fix user resource import ([#3181](#3181)) - Handle external type changes in stream resources ([#3164](#3164)) - Do not use OR REPLACE on initial creation in resources with copy_grants ([#3129](#3129)) - Address issue [#2201](#2201) by introducing new stream resources Co-authored-by: snowflake-release-please[bot] <105954990+snowflake-release-please[bot]@users.noreply.github.com>
Changes
snowflake_secret_with_client_credentials
resourcesnowflake_secret_with_authorization_code_grant
resourcesnowflake_secret_with_basic_authentication
resourcesnowflake_secret_with_generic_string
resourceParseCommaSeparatedStringArray()
Test Plan
References
https://docs.snowflake.com/en/sql-reference/sql/create-secret
TODO