When the plan phase of a Destroy run completes, the run is errored and the last line of the plan output is:
Failed running command "cd '/terraform' && envdir /env terraform show -json /terraform/terraform.tfplan" (exit 1)
Output: Failed to marshal plan to json: error marshaling prior state: unsupported attribute "<some_attribute>"
- Terraform Enterprise
- Terraform Cloud
terraform showis run at Plan phase of every Run to create data used by other services such as Sentinel and Cost Estimation. When there's mismatch of provider version between the prior state and current provider specified in configuration file, above error could be thrown due to changes in resource schema of later provider version.
Update the state to newest schema prior to Destroy Run. Possible solutions are:
- Start a new Refresh-only plan. Refresh-only support is available in Terraform Enterprise
v202106-1or later and requires a workspace using at least Terraform CLI
- Update the config with no-op change, e.g.
Applya new Run successfully
- Update Terraform config to provider version used for existing state file
The Destroy Run should complete successfully. If the issue persists, please reach out to HashiCorp support for additional assistance.