Skip to content

Migrate to v5 when remote state contains incompatible v4 schema #4982

@peterhirn

Description

@peterhirn

Migrating this very simple terraform setup: phi-ag/rvt-app#175

I'm unable to plan/apply because the state obviously contains the old schema.

terraform apply

Running apply in HCP Terraform. Output will stream here. Pressing Ctrl-C
will cancel the remote apply if it's still pending. If the apply started it
will stop streaming the logs, but will not stop the apply running remotely.

Preparing the remote apply...

To view this run in a browser, visit:
https://app.terraform.io/app/phi/rvt-app/runs/run-tLNtwbNfm8Roz1WG

Waiting for the plan to start...

Terraform v1.9.8
on linux_amd64
Initializing plugins and modules...
╷
│ Error: no schema available for cloudflare_record.production while reading state; this is a bug in Terraform and should be reported
│
│
╵
╷
│ Error: no schema available for cloudflare_record.preview while reading state; this is a bug in Terraform and should be reported
│
│
╵
╷
│ Error: Unable to Read Previously Saved State for UpgradeResourceState
│
│   with cloudflare_pages_project.page,
│   on main.tf line 59, in resource "cloudflare_pages_project" "page":
│   59: resource "cloudflare_pages_project" "page" {
│
│ There was an error reading the saved resource state using the current
│ resource schema.
│
│ If this resource state was last refreshed with Terraform CLI 0.11 and
│ earlier, it must be refreshed or applied with an older provider version
│ first. If you manually modified the resource state, you will need to
│ manually modify it to match the current resource schema. Otherwise, please
│ report this to the provider developer:
│
│ AttributeName("build_config"): invalid JSON, expected "{", got "["
╵
Failed generating plan JSON
Exit code: 1

Failed to marshal plan to json: error marshaling prior state: unsupported attribute "domain"
Operation failed: 2 errors occurred:
        * failed running terraform plan (exit 1)
        * failed generating plan JSON: failed running command (exit 1)

Any recommendations how to handle this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions