-
Notifications
You must be signed in to change notification settings - Fork 427
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: Connection and secret-datasource tests #3177
Conversation
…nowflake into fix-connection-resource
Integration tests failure for 509846ce74244475a8bdabb25b36125c020923b7 |
{ | ||
Name: "list without brackets", | ||
Value: "A.B, C.D", | ||
Result: []AccountIdentifier{NewAccountIdentifier("A", "B"), NewAccountIdentifier("C", "D")}, |
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 add some cases to test non-nil errors.
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.
Should be addressed in the next pr.
cc @sfc-gh-fbudzynski
@@ -216,11 +216,14 @@ func TestAcc_Secrets_WithGenericString(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func secretsData(secretResourceName string) string { | |||
func secretsData(secretResourceName string, inDatabaseName string) string { |
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: I think it should be an account object identifier and FullyQualifiedName should be inside this func.
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.
Should be addressed in the next pr (if needed).
cc @sfc-gh-fbudzynski
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.
we can pass the secret identifier (which is a schemaObjectIdentifier) and use secretId.DatabaseId().FullyQualifiedName()
inside the function and secretModel
to retrieve the resource name
docs/resources/primary_connection.md
Outdated
--- | ||
|
||
!> **V1 release candidate** This resource is a release candidate for the V1. It is on the list of remaining GA objects for V1. We do not expect significant changes in it before the V1. We will welcome any feedback and adjust the resource if needed. Any errors reported will be resolved with a higher priority. We encourage checking this resource out before the V1 release. Please follow the [migration guide](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/MIGRATION_GUIDE.md#v0970--v0980) to use it. | ||
|
||
# snowflake_primary_connection (Resource) | ||
|
||
Resource used to manage primary (not replicated) connections. For more information, check [connection documentation](https://docs.snowflake.com/en/sql-reference/sql/create-connection.html). | ||
Resource used to manage primary connections. For managing replicated connection check resource [snowflake_secondary_connection](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/resources/secondary_connection.md). For more information, check [connection documentation](https://docs.snowflake.com/en/sql-reference/sql/create-connection.html). |
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.
these paths should be relative instead of absolute (the given version of the provider should point to the given version) - example e.g. in the deprecated_resources.md
In all other places in this PR too
|
||
-> **Note** To demote [`snowflake_primary_connection`](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/primary_connection) to [`snowflake_secondary_connection`](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/secondary_connection), resources need to be migrated manually. For guidance on removing and importing resources into the state check [resource migration](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/technical-documentation/resource_migration.md). Remove the resource from the state, then recreate it in manually using: | ||
``` | ||
CREATE CONNECTION <name> AS REPLICA OF <organization_name>.<account_name>.<connection_name>; |
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: in such blocks, MD formatting is a bit different, and this gets inlined. This is fine; I just write for future reference.
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 checked in https://registry.terraform.io/tools/doc-preview and this is how you can include more than one line in the note block
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.
Hmm, strange. I checked the docs/issues some time ago and it was not possible to have newlines in these notes/warnings.
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.
From: https://developer.hashicorp.com/terraform/registry/providers/docs#callouts, You can't make multi-paragraph callouts.
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.
1511db1
1511db1
to
1251438
Compare
Integration tests cancelled for 12514387187e113e858d9e8f12753f47a26b3038 |
Integration tests failure for 1eb98166a435cf0acccc6c7fddea004b4b16c76f |
|
||
-> **Note** To demote [`snowflake_primary_connection`](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/primary_connection) to [`snowflake_secondary_connection`](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/secondary_connection), resources need to be migrated manually. For guidance on removing and importing resources into the state check [resource migration](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/technical-documentation/resource_migration.md). Remove the resource from the state, then recreate it in manually using: | ||
-> **Note** To demote [`snowflake_primary_connection`](./primary_connection) to [`snowflake_secondary_connection`](./secondary_connection), resources need to be migrated manually. For guidance on removing and importing resources into the state check [resource migration](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/technical-documentation/resource_migration.md). Remove the resource from the state, then recreate it in manually using: |
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 (for later): do we need a self reference here?
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 dont think the selfreference is needed, the reference to complementary resource would be enough. My thoughts only tho
@@ -28,9 +28,9 @@ resource "snowflake_secondary_connection" "complete" { | |||
} | |||
``` | |||
|
|||
-> **Note** Instead of using fully_qualified_name, you can reference objects managed outside Terraform by constructing a correct ID, consult [identifiers guide](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/guides/identifiers#new-computed-fully-qualified-name-field-in-resources). | |||
-> **Note** Instead of using fully_qualified_name, you can reference objects managed outside Terraform by constructing a correct ID, consult [identifiers guide](../guides/identifiers#new-computed-fully-qualified-name-field-in-resources). |
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.
not sure if this one will be correct
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's 404.
|
||
-> **Note** To demote [`snowflake_primary_connection`](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/primary_connection) to [`snowflake_secondary_connection`](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/secondary_connection), resources need to be migrated manually. For guidance on removing and importing resources into the state check [resource migration](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/technical-documentation/resource_migration.md). Remove the resource from the state, then recreate it in manually using: | ||
``` | ||
CREATE CONNECTION <name> AS REPLICA OF <organization_name>.<account_name>.<connection_name>; |
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.
Hmm, strange. I checked the docs/issues some time ago and it was not possible to have newlines in these notes/warnings.
Integration tests failure for 1511db144f4fd3a063c8f0c90d9e6664063b2fc8 |
## [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>
<!-- Feel free to delete comments as you fill this in --> <!-- summary of changes --> ## Changes * added `../` to `primary_connection` documentation * added invalid test cases for `ParseCommaSeparatedAccountIdentifierArray` * changed `secretsData()` function parameters ## Test Plan <!-- detail ways in which this PR has been tested or needs to be tested --> * [x] acceptance tests for secrets * [x] unit tests for parser ## References <!-- issues documentation links, etc --> references to comments: * #3177 (comment) * #3177 (comment)
Changes
ParseCommaSeparatedAccountIdentifierArray
Test Plan
References