Skip to content

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

Closed
@piyushbhojgude

Description

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

Metadata

Assignees

No one assigned

    Labels

    category:migrationIssues connected with migration to v1.0.0.general-usageGeneral help/usage questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions