terraform-provider-snowflake
terraform-provider-snowflake copied to clipboard
snowflake_schema errors when comment is changed to null (empty string)
Terraform CLI and Provider Versions
Terraform v1.5.5 snowflake-labs/snowflake v0.87.0
Terraform Configuration
resource "snowflake_schema" "sf_schema" {
for_each = local.database_schemas
database = each.value.database_name
name = each.value.schema_name
comment = each.value.schema_comment
is_transient = each.value.is_transient
is_managed = each.value.is_managed
data_retention_days = each.value.data_retention_days
depends_on = [
snowflake_database.sf_database
]
}
Expected Behavior
When a schema has a comment that was set previously, the comment should be able to be removed from the schema in a later apply since comments are not a requirement by Snowflake. This used to work in a previous version of the provider. I would expect that when a comment is changed from an existing comment to an empty string, the apply should run without error.
Actual Behavior
If a comment exists on the schema from a previous apply and in a subsequent apply you try to remove it by setting the comment value to an empty string, it's throwing the following error:
│ Error: error updating schema comment on SOME_DB|SOME_SCHEMA err = [schemas.go:195] at least one of SchemaSet fields [DataRetentionTimeInDays MaxDataExtensionTimeInDays DefaultDDLCollation Comment] must be set │ │ with snowflake_schema.sf_schema["SOME_DB|SOME_SCHEMA"], │ on main.tf line 143, in resource "snowflake_schema" "sf_schema": │ 143: resource "snowflake_schema" "sf_schema" {
Steps to Reproduce
- Set a comment on a schema
- Apply the comment
- Remove the comment on the same schema
- Apply the removal
How much impact is this issue causing?
High
Logs
No response
Additional Information
When we went to upgrade from v0.71.0 to 0.87.0 and were met with error above. We are basically making sure we don't remove any comments at this point.
Hey @Bryan-Meier. Thanks for reporting the issue.
This is an easy one, we should be able to add it to one of the other changes. We should have a fix with the next release.
Hey @Bryan-Meier. Fix released in v0.88.0.
Please check and close the issue if the problem is solved for you.
I will check it out. Thank you!
Problem fixed. Thank you @sfc-gh-asawicki!!