terraform-provider-snowflake
terraform-provider-snowflake copied to clipboard
Error: Failed to decode resource from state
Provider Version
0.53.0
Terraform Version
1.3.6
Describe the bug
After migrating from provider version 0.47.0 to 0.53.0, the resource "snowflake_task" "tasks"
started to give:
│ Error: Failed to decode resource from state
│
│ Error decoding "snowflake_task.tasks[\"...\"]" from previous state: missing expected [
and
│ Error: missing expected [
│
│ with snowflake_task.tasks["..."],
│ on tasks.tf line 1, in resource "snowflake_task" "tasks":
│ 1: resource "snowflake_task" "tasks" {
which seem like the same error.
Expected behavior
That terraform apply
would work as before and migration of state format was taken into account.
Code samples and commands
terraform apply
Additional context
Reason for updating version was adding warehouse type and there was changes. No changes to the task side.
good to know, before we upgrade to the latest and greatest :-)
I have stumbled across this same issue today. We have upgraded provider from 0.37.0 to 0.51.0 and as soon as I did so the output from terraform plan included 33 occurrences of:
│ Warning: Failed to decode resource from state │ │ Error decoding "snowflake_task.redacted" from prior │ state: missing expected [
│ Error: missing expected [ │ │ with snowflake_task.redacted, │ on file.tf line 95, in resource "snowflake_task" "redacted": │ 95: after = snowflake_task.redacted.name
Disappointed to stumble across this issue and discover that there is no-one assigned to it 4 months after it was first posted 😞
@jooel-korpi-caruna did you figure out a workaround?
I am having the same issue in 0.89.0
Hey @jooel-korpi-caruna @funes79 @jamiekt @jacobRiehl. Thanks for reaching out to us.
In the newer provider versions, we avoid such situations. We have also introduced the https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/MIGRATION_GUIDE.md#migration-guide to help with the transition in newer versions.
It's always possible to remove a resource from the state and reimport it (described in https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/technical-documentation/resource_migration.md) and it should be possible to treat it as a workaround in the ancient provider versions.
Please bear in mind that we are still in the pre-stable version (0.x.x; check the disclaimer in https://github.com/Snowflake-Labs/terraform-provider-snowflake?tab=readme-ov-file#snowflake-terraform-provider) and we do not provide backward bugfixes. We always recommend bumping to the newest version.
@jacobRiehl, please create a new issue with a proper description since your issue touches on the latest provider version.