hashicorp/terraform · error

The builtin provider does not support provider upgrades…

Error message

The builtin provider does not support provider upgrades since it has not changed the identity schema yet.

What it means

The terraform_data resource's identity schema version is 0 and has never changed, so UpgradeResourceIdentity unconditionally returns an error. Terraform Core should never call this method because the schema version matches; receiving this error means Core's upgrade path was triggered against a resource whose identity schema version is somehow below the current version, which is impossible with this provider.

Solutions

  1. If you manually edited the state file, revert the identity schema version to 0 for terraform_data resources.
  2. If this is a development build, update upgradeDataStoreResourceIdentity to handle the new version or bump the IdentitySchema Version field accordingly.
  3. Run 'terraform refresh' after restoring a known-good state backup to resynchronize.
Defensive patterns

Strategy: try-catch

Validate before calling

// Before calling UpgradeResourceIdentity, check the schema version
identitySchemas := provider.GetResourceIdentitySchemas()
if schema, ok := identitySchemas.IdentityTypes["terraform_data"]; ok && schema.Version == 0 {
    // No upgrade needed; current version is 0
    return providers.UpgradeResourceIdentityResponse{}
}

Try / catch

// Wrap identity upgrade in a recovery to handle the unconditional error
defer func() {
    if r := recover(); r != nil {
        // log and continue with original identity
    }
}()
resp := provider.UpgradeResourceIdentity(req)
if resp.Diagnostics.HasErrors() {
    // identity schema version is 0; no upgrade possible, use original
    log.Printf("[WARN] identity upgrade not supported, using original state")
}

Prevention

When it happens

Trigger: Calling upgradeDataStoreResourceIdentity (resource_data.go:108-111). The method has no conditional logic and always returns the error. This can only happen if Terraform Core's state migration logic invokes the identity upgrade path for a terraform_data resource instance whose stored identity schema version is less than 0.

Common situations: Manually editing state file to set a non-zero or future identity schema version. Running a development or custom build of Terraform that has bumped the identity schema version without updating the upgrade function. State file corruption causing an unexpected version mismatch.

Related errors


AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11). Data as JSON: /api/errors/63443c5fe9bb71d1. Report an issue: GitHub.

Appendix: source

Thrown at internal/builtin/providers/terraform/resource_data.go:109

	}
	return resp
}

func upgradeDataStoreResourceState(req providers.UpgradeResourceStateRequest) (resp providers.UpgradeResourceStateResponse) {
	// We've only added new nullable block attributes, so unmarshaling from json
	// will complete the data structure correctly.
	val, err := ctyjson.Unmarshal(req.RawStateJSON, dataStoreResourceSchema().Body.ImpliedType())
	if err != nil {
		resp.Diagnostics = resp.Diagnostics.Append(err)
		return resp
	}

	resp.UpgradedState = val
	return resp
}

func upgradeDataStoreResourceIdentity(providers.UpgradeResourceIdentityRequest) (resp providers.UpgradeResourceIdentityResponse) {
	resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("The builtin provider does not support provider upgrades since it has not changed the identity schema yet."))
	return resp
}

func readDataStoreResourceState(req providers.ReadResourceRequest) (resp providers.ReadResourceResponse) {
	resp.NewState = req.PriorState
	resp.Private = req.Private
	return resp
}

func planDataStoreResourceChange(req providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse) {
	resp.PlannedState = req.ProposedNewState

	if req.ProposedNewState.IsNull() {
		// destroy op
		return resp
	}

	planned := req.ProposedNewState.AsValueMap()

View on GitHub (pinned to d32a084675)