snowflake_tag_association resource unexpected behavior and error on Snowflake column object with "." in name #1926
Labels
bug
Used to mark issues with provider's incorrect behavior
category:resource
resource:tag_association
Issue connected to the snowflake_tag_association resource
Provider Version
v0.64.0
Terraform Version
v1.1.6
Describe the bug
When trying to create a snowflake_tag_association resource for a Snowflake column name with "." (e.g. "test.column1") in the "name" section of "object_identifier" in the resource, an error is seen as shown below:
│ Error: error associating tag to object: ["".""."
.'test.column1'"] with command: [ALTER TABLE "".""."│
│ with snowflake_tag_association.<resource_name>,
│ on tag_associate.tf line 1, in resource "snowflake_tag_association" "<resource_name>":
│ 1: resource "snowflake_tag_association" "<resource_name>" {
│
The ALTER TABLE command being executed when the snowflake_tag_association resource is applied, does not consider the entire Snowflake column name, but stops before "." character. For example "test.column1" is taken as just "test" in the alter query
Expected behavior
The ALTER table query should be as follows:
ALTER TABLE "<database>"."<schema>"."<table>" MODIFY COLUMN "**test.column1**" SET TAG "<database>"."<schema>"."<tag_name>" = '<tag_value>'], tag_id [<database>|<schema>|<tag_name>]
Code samples and commands
The snowflake_tag_association sample being used is:
resource "snowflake_tag_association" "tag_column_association" {
provider = snowflake.sysadmin
tag_id = snowflake_tag.<tag_resource_name>.id
object_type = "COLUMN"
tag_value = "<tag_value>"
object_identifier {
database = "test_db"
schema = "test_schema"
name = "test_table.'test.column1'"
}
}
Additional context
Other variations of the column name in the object_identifier were also tested as listed below but the error wasn't resolved:
The text was updated successfully, but these errors were encountered: