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

Error: Failed to decode resource from state #1419

Closed
jooel-korpi-caruna opened this issue Dec 13, 2022 · 5 comments
Closed

Error: Failed to decode resource from state #1419

jooel-korpi-caruna opened this issue Dec 13, 2022 · 5 comments
Assignees
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:task Issue connected to the snowflake_task resource

Comments

@jooel-korpi-caruna
Copy link

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.

@jooel-korpi-caruna jooel-korpi-caruna added the bug Used to mark issues with provider's incorrect behavior label Dec 13, 2022
@funes79
Copy link
Contributor

funes79 commented Dec 19, 2022

good to know, before we upgrade to the latest and greatest :-)

@jamiekt
Copy link
Contributor

jamiekt commented Apr 21, 2023

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?

@jacobRiehl
Copy link

I am having the same issue in 0.89.0

@sfc-gh-asawicki
Copy link
Collaborator

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.

@sfc-gh-jcieslak sfc-gh-jcieslak added category:resource resource:task Issue connected to the snowflake_task resource labels May 20, 2024
@sfc-gh-jcieslak sfc-gh-jcieslak self-assigned this Nov 25, 2024
@sfc-gh-jcieslak
Copy link
Collaborator

Hi all 👋
Closing due to long inactivity and very old provider version. In the upcoming provider's v0.99.0 version, the tasks will be reworked and should not contain any of the reported issues and should be feature-complete (except for newly added parameters that appeared in the documentation a few days ago). In case of any problems, please create another issue (we are currently more responsive and try to fix or categorize the issues for future improvements as soon as possible).

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:task Issue connected to the snowflake_task resource
Projects
None yet
Development

No branches or pull requests

6 participants