{"record":{"id":"354eaa0d51593702","repo":"hashicorp/terraform","slug":"error-unsupported-resource-s","errorCode":null,"errorMessage":"Error: unsupported resource %s","messagePattern":"Error: unsupported resource (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/builtin/providers/terraform/provider.go","lineNumber":213,"sourceCode":"\n// ImportResourceState requests that the given resource be imported.\nfunc (p *Provider) ImportResourceState(req providers.ImportResourceStateRequest) providers.ImportResourceStateResponse {\n\tif req.TypeName == \"terraform_data\" {\n\t\treturn importDataStore(req)\n\t}\n\n\tpanic(\"unimplemented: cannot import resource type \" + req.TypeName)\n}\n\n// MoveResourceState requests that the given resource be moved.\nfunc (p *Provider) MoveResourceState(req providers.MoveResourceStateRequest) providers.MoveResourceStateResponse {\n\tswitch req.TargetTypeName {\n\tcase \"terraform_data\":\n\t\treturn moveDataStoreResourceState(req)\n\tdefault:\n\t\tvar resp providers.MoveResourceStateResponse\n\n\t\tresp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf(\"Error: unsupported resource %s\", req.TargetTypeName))\n\n\t\treturn resp\n\t}\n}\n\n// ValidateResourceConfig is used to to validate the resource configuration values.\nfunc (p *Provider) ValidateResourceConfig(req providers.ValidateResourceConfigRequest) providers.ValidateResourceConfigResponse {\n\treturn validateDataStoreResourceConfig(req)\n}\n\nfunc (p *Provider) ValidateEphemeralResourceConfig(req providers.ValidateEphemeralResourceConfigRequest) providers.ValidateEphemeralResourceConfigResponse {\n\tvar resp providers.ValidateEphemeralResourceConfigResponse\n\tresp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf(\"unsupported ephemeral resource type %q\", req.TypeName))\n\treturn resp\n}\n\n// OpenEphemeralResource implements providers.Interface.\nfunc (p *Provider) OpenEphemeralResource(req providers.OpenEphemeralResourceRequest) providers.OpenEphemeralResourceResponse {","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/builtin/providers/terraform/provider.go#L195-L231","documentation":"Returned by `MoveResourceState` (provider.go:213) when `req.TargetTypeName` is not `terraform_data`. The built-in provider's only managed resource is `terraform_data`, so any other move target is unsupported. Unlike the data-source guards, this can be hit legitimately via a `moved` block targeting the wrong resource type.","triggerScenarios":"A configuration uses a `moved` block whose destination address points to a `terraform_*` resource type other than `terraform_data`, e.g. `moved { from = ... ; to = terraform_legacy.x }`, or a `MoveResourceStateRequest` is dispatched with an unrecognised `TargetTypeName`.","commonSituations":"Migrating state into the built-in provider with a typo'd or renamed resource type; tooling that auto-generates `moved` blocks using a stale type name; attempting to move to a removed/deprecated resource type.","solutions":["Target `terraform_data` for any move into the built-in terraform provider.","Confirm `TargetTypeName` is present in `GetProviderSchema().ResourceTypes` (only `terraform_data`).","If the destination resource lives in another provider, point the `moved` block at that provider's address.","Update state-migration scripts that hard-code an old resource type."],"exampleFix":"// before\nmoved {\n  from = aws_instance.old\n  to   = terraform_placeholder.x\n}\n\n// after\nmoved {\n  from = aws_instance.old\n  to   = terraform_data.x\n}","handlingStrategy":"validation","validationCode":"schema := provider.GetProviderSchema()\nif _, ok := schema.ResourceTypes[req.TargetTypeName]; !ok {\n    return fmt.Errorf(\"cannot move to %s: not a managed resource of the terraform provider\", req.TargetTypeName)\n}","typeGuard":"func providerSupportsResource(schema providers.GetProviderSchemaResponse, name string) bool {\n    _, ok := schema.ResourceTypes[name]\n    return ok\n}","tryCatchPattern":null,"preventionTips":["For moves into the built-in provider, always target terraform_data.","Lint moved-block destinations against the destination provider's schema.","Regenerate moved blocks from current resource addresses, not stale names."],"tags":["terraform","builtin-provider","resource","move-state","moved-block","provider-interface"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}