terraform-provider-snowflake
terraform-provider-snowflake copied to clipboard
Terraform plan show changes for columns using datatypes that are synonyms after a successful deployment
Provider Version
0.25.22
Terraform Version
1.0.11
Describe the bug
A subsequent terraform plan after a successfuly deployment sees changes for columns that are using data types with multiple naming variations (e.g. VARCHAR/STRING/TEXT).
In the initial terraform plan and terraform apply, the column was stated using TEXT(length). e.g.
module.table["STAGE.UNIT"].snowflake_table.table will be created
+ resource "snowflake_table" "table" {
+ change_tracking = false
+ comment = "Some comment"
+ data_retention_days = 1
+ database = "SOME_TARGET_DATABASE"
+ id = (known after apply)
+ name = "UNIT"
+ owner = (known after apply)
+ schema = "STAGE"
+ column {
+ comment = "Some other comment"
+ name = "ADDRESS_LINE_ONE"
+ nullable = true
+ type = "TEXT(200)"
}
...
+ primary_key {
+ keys = []
+ name = "PK_STAGE_UNIT"
}
}
It was created sucessfully.
Running terraform apply even afterwards, without changing anything about the column, will generate the following change:
# module.table["STAGE.UNIT"].snowflake_table.table will be updated in-place
~ resource "snowflake_table" "table" {
id = "SOME_TARGET_DATABASE|STAGE|UNIT"
name = "UNIT"
# (7 unchanged attributes hidden)
~ column {
name = "ADDRESS_LINE_ONE"
~ type = "VARCHAR(200)" -> "TEXT(200)"
# (2 unchanged attributes hidden)
}
This is likely because Snowflake stores VARCHAR(200) in the information schema, and the provider uses the information schema to retrieve the current state of the target. When comparing the two, the provider should consider that VARCHAR and TEXT are synonyms in Snowflake (together with STRING as well).
Expected behavior
I expect terraform plan to output no planned changes after successful execution of terraform apply.
Code samples and commands
Above.
Additional context
Seems to be from the a similar class of problems with https://github.com/chanzuckerberg/terraform-provider-snowflake/issues/494
This is also impacted by spacing e.g. the following change is shown by terraform plan that is executed right afterwards a successful terraform apply:
# module.table["STAGE.UNIT"].snowflake_table.table will be updated in-place
~ resource "snowflake_table" "table" {
id = "SOME_TARGET_DATABASE|STAGE|UNIT"
name = "UNIT"
# (7 unchanged attributes hidden)
~ column {
name = "SOME_NUMBER_COLUMN"
~ type = "NUMBER(38,10)" -> "NUMBER(38, 10)"
# (2 unchanged attributes hidden)
}
Team,
Anything that can be done here?
Any updates here?
We are closing this issue as part of a cleanup described in announcement. If you believe that the issue is still valid in v0.89.0, please open a new ticket.