Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jmichalak committed Dec 3, 2024
1 parent c856aa8 commit 71cb0e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resource "snowflake_tag_association" "silver_databases" {
}
```

Note that if you want to promote silver instances to gold, you can not simply change `tag_value` in `silver_warehouses`. Instead, you should merge `object_identifiers` from `silver_warehouses` and `gold_warehouses`, and use them only in `gold_warehouses`, like this (note that `silver_warehouses` resource was deleted):
Note that if you want to promote silver instances to gold, you can not simply change `tag_value` in `silver_warehouses`. Instead, you should first remove `object_identifiers` from `silver_warehouses`, run `terraform apply`, and then add the relevant `object_identifiers` in `gold_warehouses`, like this (note that `silver_warehouses` resource was deleted):
```
resource "snowflake_tag_association" "gold_warehouses" {
object_identifiers = [snowflake_warehouse.w1.fully_qualified_name, snowflake_warehouse.w2.fully_qualified_name, snowflake_warehouse.w3.fully_qualified_name]
Expand All @@ -42,6 +42,9 @@ resource "snowflake_tag_association" "gold_warehouses" {
tag_value = "gold"
}
```
and run `terraform apply` again.

Note that the order of operations is not deterministic in this case, and if you do these operations in one step, it is possible that the tag value will be changed first, and unset later because of removing the resource with old value.

The state is migrated automatically. There is no need to adjust configuration files, unless you use resource id `snowflake_tag_association.example.id` as a reference in other resources.

Expand Down
2 changes: 2 additions & 0 deletions docs/resources/tag_association.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ description: |-

-> **Note** Tag association resource ID has the following format: `"TAG_DATABASE"."TAG_SCHEMA"."TAG_NAME"|TAG_VALUE|OBJECT_TYPE`. This means that a tuple of tag ID, tag value and object type should be unique across the resources. If you want to specify this combination for more than one object, you should use only one `tag_association` resource with specified `object_identifiers` set.

-> **Note** If you want to change tag value to a value that has already present in another resource, first remove needed `object_identifiers` from the resource with the old value, run `terraform apply`, then add the relevant `object_identifiers` in the resource with new value, and run `terrafrom apply` once again.

# snowflake_tag_association (Resource)

Resource used to manage tag associations. For more information, check [object tagging documentation](https://docs.snowflake.com/en/user-guide/object-tagging).
Expand Down
2 changes: 2 additions & 0 deletions templates/resources/tag_association.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ description: |-

-> **Note** Tag association resource ID has the following format: `"TAG_DATABASE"."TAG_SCHEMA"."TAG_NAME"|TAG_VALUE|OBJECT_TYPE`. This means that a tuple of tag ID, tag value and object type should be unique across the resources. If you want to specify this combination for more than one object, you should use only one `tag_association` resource with specified `object_identifiers` set.

-> **Note** If you want to change tag value to a value that is already present in another `tag_association` resource, first remove the relevant `object_identifiers` from the resource with the old value, run `terraform apply`, then add the relevant `object_identifiers` in the resource with new value, and run `terrafrom apply` once again.

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}
Expand Down

0 comments on commit 71cb0e5

Please sign in to comment.