-
Notifications
You must be signed in to change notification settings - Fork 422
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: Tag association v1 readiness #3210
base: main
Are you sure you want to change the base?
Changes from 6 commits
6f06e25
624a07d
a547fac
8aa6ea6
f97b0e8
818d00b
7751436
4e5d39a
b53d7c5
c856aa8
71cb0e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,61 @@ across different versions. | |
|
||
## v0.98.0 ➞ v0.99.0 | ||
|
||
### snowflake_tag_association resource changes | ||
#### *(behavior change)* new id format | ||
In order to provide more functionality for tagging objects, we have changed the resource id from `"TAG_DATABASE"."TAG_SCHEMA"."TAG_NAME"` to `"TAG_DATABASE"."TAG_SCHEMA"."TAG_NAME"|TAG_VALUE|OBJECT_TYPE`. This allows to group tags associations per tag ID, tag value and object type in one resource. | ||
``` | ||
resource "snowflake_tag_association" "gold_warehouses" { | ||
object_identifiers = [snowflake_warehouse.w1.fully_qualified_name, snowflake_warehouse.w2.fully_qualified_name] | ||
object_type = "WAREHOUSE" | ||
tag_id = snowflake_tag.tier.fully_qualified_name | ||
tag_value = "gold" | ||
} | ||
resource "snowflake_tag_association" "silver_warehouses" { | ||
object_identifiers = [snowflake_warehouse.w3.fully_qualified_name] | ||
object_type = "WAREHOUSE" | ||
tag_id = snowflake_tag.tier.fully_qualified_name | ||
tag_value = "silver" | ||
} | ||
resource "snowflake_tag_association" "silver_databases" { | ||
object_identifiers = [snowflake_database.d1.fully_qualified_name] | ||
object_type = "DATABASE" | ||
tag_id = snowflake_tag.tier.fully_qualified_name | ||
tag_value = "silver" | ||
} | ||
``` | ||
|
||
The state is migrated automatically. There is no need to adjust configuration files, unless you use resource id like `snowflake_tag_association.example.id`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this part: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rephrased.
sfc-gh-asawicki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### *(behavior change)* changed fields | ||
Behavior of some fields was changed: | ||
- `object_identifier` was renamed to `object_identifiers` and it is now a set of fully qualified names. Change your configurations from | ||
``` | ||
resource "snowflake_tag_association" "table_association" { | ||
object_identifier { | ||
name = snowflake_table.test.name | ||
database = snowflake_database.test.name | ||
schema = snowflake_schema.test.name | ||
} | ||
object_type = "TABLE" | ||
tag_id = snowflake_tag.test.fully_qualified_name | ||
tag_value = "engineering" | ||
} | ||
``` | ||
to | ||
``` | ||
resource "snowflake_tag_association" "table_association" { | ||
object_identifiers = [snowflake_table.test.fully_qualified_name] | ||
object_type = "TABLE" | ||
tag_id = snowflake_tag.test.fully_qualified_name | ||
tag_value = "engineering" | ||
} | ||
``` | ||
- `tag_id` has now suppressed identifier quoting to prevent issues with Terraform showing permament differences, like [this one](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/2982) | ||
- `object_type` and `tag_id` are now marked as ForceNew | ||
|
||
The state is migrated automatically. Please adjust your configuration files. | ||
|
||
### snowflake_tag_masking_policy_association deprecation | ||
`snowflake_tag_masking_policy_association` is now deprecated in favor of `snowflake_tag` with a new `masking_policy` field. It will be removed with the v1 release. Please adjust your configuration files. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ description: |- | |
Resource used to manage authentication policy objects. For more information, check authentication policy documentation https://docs.snowflake.com/en/sql-reference/sql/create-authentication-policy. | ||
--- | ||
|
||
-> **Note** According to Snowflake [docs](https://docs.snowflake.com/en/sql-reference/sql/drop-authentication-policy#usage-notes), an authentication policy cannot be dropped successfully if it is currently assigned to another object. Currently, the provider does not unassign such objects automatically. Before dropping the resource, list the assigned objects with `SELECT * from table(information_schema.policy_references(policy_name=>'<string>'));` and unassign them manually with `ALTER ...` or with updated Terraform configuration, if possible. | ||
sfc-gh-asawicki marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's suggest going through terraform config changes in two steps and manual SQL as an alternative. Also, let's add example to In guide let's show:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change was merged in #3226. I'll add such a guide in a next PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will keep it open then. |
||
|
||
# snowflake_authentication_policy (Resource) | ||
|
||
Resource used to manage authentication policy objects. For more information, check [authentication policy documentation](https://docs.snowflake.com/en/sql-reference/sql/create-authentication-policy). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
# format is dbName.schemaName.tagName or dbName.schemaName.tagName | ||
terraform import snowflake_tag_association.example 'dbName.schemaName.tagName' | ||
terraform import snowflake_tag_association.example '"TAG_DATABASE"."TAG_SCHEMA"."TAG_NAME"|TAG_VALUE|OBJECT_TYPE' |
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.
so it means that if I want to add the same tag, same value to the same object type, then I have to put all of them in one resource, right? (here it would mean that changing silver to gold in the second resource is not permitted because both these resources would have the same id)
If I understand this correctly, then I think it would be good to add this info, directly to the resource docs, and here too.
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.
Yes, added more explanation.
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.
Is the operation deterministic if done in one go? I mean it's possible that value will be first added in the first resource and later removed as part of second resource removal, right?
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 unset does not take the value)
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, true. Added more instructions here and in the resource docs.