Skip to content
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

snowflake_tag_association resource unexpected behavior and error on Snowflake column object with "." in name #1926

Closed
sbhattacharjeeClearcover opened this issue Jul 5, 2023 · 2 comments
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:tag_association Issue connected to the snowflake_tag_association resource

Comments

@sbhattacharjeeClearcover

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 "".""."
" MODIFY COLUMN "'test" SET TAG "".""."<tag_name>" = '<tag_value>'], tag_id [||<tag_name>]

│ 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:

  • "test_table."test.column1""
  • "test_table.'test.column1'"
  • "'test_table'.'test.column1'"
  • ""'test_table'.'test.column1'""
@sbhattacharjeeClearcover sbhattacharjeeClearcover added the bug Used to mark issues with provider's incorrect behavior label Jul 5, 2023
@sfc-gh-swinkler
Copy link
Collaborator

Thank you for reporting this issue. I agree it is a problem, and we will look into it.

@VickyWinner
Copy link

same error while associating tags to a database.

│ Error: error associating tag to object: ["test_db"] with command: [ALTER DATABASE "test_db" SET TAG "DATABASE_TAGS"."SCHEMA_TAGS"."cost_center" = 'one'], tag_id [DATABASE_TAGS|SCHEMA_TAGS|cost_center]

@sfc-gh-jcieslak sfc-gh-jcieslak added category:resource resource:tag_association Issue connected to the snowflake_tag_association resource labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:tag_association Issue connected to the snowflake_tag_association resource
Projects
None yet
Development

No branches or pull requests

4 participants