hashicorp/terraform · error

Error: unsupported resource

Error message

Error: unsupported resource %s

What it means

MoveResourceState only handles moves whose TargetTypeName is "terraform_data", the single managed resource this provider ships. Any other target type is rejected with a diagnostic. This guards the moved-block / state-migration path.

Solutions

  1. Confirm the target type is terraform_data (the only movable resource this provider supports)
  2. Route the move to the external provider that owns the target type
  3. Check the resource address and type in the moved block for typos
Defensive patterns

Strategy: validation

Validate before calling

// Before calling MoveResourceState on the built-in terraform provider:
if req.TargetTypeName != "terraform_data" {
    // route to the external provider that owns req.TargetTypeName instead
}

Type guard

func isBuiltinTerraformMovableResource(name string) bool {
    return name == "terraform_data"
}

Prevention

When it happens

Trigger: A moved block whose target resolves to a type other than terraform_data under the built-in terraform provider; Core routing a MoveResourceStateRequest to this provider for an unsupported TargetTypeName.

Common situations: A moved block with a typo'd or wrong target address; Core address resolution pointing a state move at the built-in provider for a resource owned by an external provider; version skew where a renamed type is not yet registered.

Related errors


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

Appendix: source

Thrown at internal/builtin/providers/terraform/provider.go:213

// ImportResourceState requests that the given resource be imported.
func (p *Provider) ImportResourceState(req providers.ImportResourceStateRequest) providers.ImportResourceStateResponse {
	if req.TypeName == "terraform_data" {
		return importDataStore(req)
	}

	panic("unimplemented: cannot import resource type " + req.TypeName)
}

// MoveResourceState requests that the given resource be moved.
func (p *Provider) MoveResourceState(req providers.MoveResourceStateRequest) providers.MoveResourceStateResponse {
	switch req.TargetTypeName {
	case "terraform_data":
		return moveDataStoreResourceState(req)
	default:
		var resp providers.MoveResourceStateResponse

		resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("Error: unsupported resource %s", req.TargetTypeName))

		return resp
	}
}

// ValidateResourceConfig is used to to validate the resource configuration values.
func (p *Provider) ValidateResourceConfig(req providers.ValidateResourceConfigRequest) providers.ValidateResourceConfigResponse {
	return validateDataStoreResourceConfig(req)
}

func (p *Provider) ValidateEphemeralResourceConfig(req providers.ValidateEphemeralResourceConfigRequest) providers.ValidateEphemeralResourceConfigResponse {
	var resp providers.ValidateEphemeralResourceConfigResponse
	resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("unsupported ephemeral resource type %q", req.TypeName))
	return resp
}

// OpenEphemeralResource implements providers.Interface.
func (p *Provider) OpenEphemeralResource(req providers.OpenEphemeralResourceRequest) providers.OpenEphemeralResourceResponse {

View on GitHub (pinned to d32a084675)