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

[General Usage]: How to migrate from older provider version to latest without recreating tables #3363

Open
piyushbhojgude opened this issue Jan 29, 2025 · 1 comment
Labels
category:migration Issues connected with migration to v1.0.0. general-usage General help/usage questions

Comments

@piyushbhojgude
Copy link

piyushbhojgude commented Jan 29, 2025

Terraform CLI Version

No response

Terraform Provider Version

No response

Company Name

No response

We are trying to upgrade snowflake terraform provider from 0.69 to 1.0.1 version.
Would like to know if there are any basic guidelines on how we can successfully upgrade.
I have made the necessary code changes, to make sure every resource is modified as per latest release, and verified that fresh deployment works fine.
But now I need to take care of use-case where we already have all snowflake resources deployed and maintained using 0.69 version.
When I try to run terraform plan against existing deployment, I see below errors for certain resources:

  1. For views:
    Warning: Failed to decode resource from state

    │ Error decoding "module.services["workflow_name"].snowflake_view.wf_views["VIEW_NAME"]" from prior state: unsupported attribute "created_on"

  2. For tables:
    Warning: Failed to decode resource from state

    │ Error decoding "module.workflows["workflow_name"].snowflake_table.wf_tables["TABLE_NAME"]" from prior state: unsupported attribute "data_retention_days"

  3. For tasks:
    │ Warning: Failed to decode resource from state

    │ Error decoding "module.workflows["workflow_name"].snowflake_task.wf_tasks["TASK_NAME"]" from prior state: unsupported attribute "enabled"

Seeing below error for procedures, functions, file_format and all types of grants

│ Warning: Missing resource schema from provider

│ No resource schema found for snowflake_procedure when decoding prior state

We are okay with removing the older deprecated grant resources manually and then have them created via the new terraform provider.
But we would like to keep the tables as is and not re-create those.

I was going through this documentation: https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/technical-documentation/resource_migration.md

Do we need to import all existing table resources into new one, in order to avoid recreation?

Category

category:resource

Object type(s)

resource:table

Expected Behavior

NA

Actual Behavior

NA

Steps to Reproduce

Upgraded tf provider version from 0.69 to 1.0.1, and modified all resources accordingly.
Tried running terraform plan.

How much impact is this issue causing?

High

Logs

No response

Additional Information

No response

@piyushbhojgude piyushbhojgude added the general-usage General help/usage questions label Jan 29, 2025
@sfc-gh-asawicki sfc-gh-asawicki added the category:migration Issues connected with migration to v1.0.0. label Jan 29, 2025
@sfc-gh-asawicki
Copy link
Collaborator

Hey @piyushbhojgude. Thanks for reaching out to us.

Yes, basically to avoid recreation, the easiest way is to remove resources from the state and reimport them as described in the resource migration you linked.

Also, you are taking a huge leap from 0.69.0 to 1.0.1. These last 1.5 years were busy and there were lots of changes in the provider. Please make sure that you not only adjust the resources according to the newest docs but also that you went through the migration guide where all the important provider changes were listed version-by-version (starting at around 0.73 version).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:migration Issues connected with migration to v1.0.0. general-usage General help/usage questions
Projects
None yet
Development

No branches or pull requests

2 participants