terraform-provider-snowflake
terraform-provider-snowflake copied to clipboard
Inconsistency in table columns order
Provider Version
version 0.30.0
Terraform Version
version v1.1.0
Describe the bug
Newly added columns are not being placed in the correct order in the snowflake table (corresponding to their place in configuration). It leads to unexpected differences on ongoing plan
/apply
and breaks order-based queries, like ingesting csv/json data from stage;
Expected behavior
Newly added columns added exact in the same place as they in configuration. If new column added as the last one to the terraform configuration it should be added as the last one to the table.
Code samples and commands
I have the following initial configuration for snowflake table:
resource "snowflake_table" "energy" {
database = "LIVE_DB"
schema = "PUBLIC"
name = "ENERGY"
column {
name = "Date"
type = "TIMESTAMP_NTZ(9)"
}
column {
name = "Quantity"
type = "FLOAT"
}
column {
name = "BatchID"
type = "VARCHAR(16777216)"
}
column {
name = "AccountID"
type = "VARCHAR(16777216)"
}
}
When later I'm trying to add a new column Country
:
resource "snowflake_table" "energy" {
database = "LIVE_DB"
schema = "PUBLIC"
name = "ENERGY"
column {
name = "Date"
type = "TIMESTAMP_NTZ(9)"
}
column {
name = "Quantity"
type = "FLOAT"
}
column {
name = "BatchID"
type = "VARCHAR(16777216)"
}
column {
name = "AccountID"
type = "VARCHAR(16777216)"
}
// new column
column {
name = "Country"
type = "VARCHAR(16777216)"
}
}
In Snowflake schema new column is not added as last to table structure, but put somewhere randomly, for example between Quantity
and BatchID
.
This is probably related/cause-by/duplicated by what is reported in issue #753
Duplicates of https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/753