hashicorp/terraform · error
Error: unsupported data source
Error message
Error: unsupported data source %s
What it means
The built-in terraform provider exposes exactly one data source, terraform_remote_state. ValidateDataResourceConfig rejects any other TypeName as a defensive invariant — Terraform Core should never route a different data source here because GetProviderSchema advertises only terraform_remote_state.
Solutions
- Verify the caller dispatches only terraform_remote_state to this provider
- Check that GetProviderSchema.DataSources Core cached matches the single terraform_remote_state entry
- Route the request to the correct external provider address instead
Defensive patterns
Strategy: validation
Validate before calling
// Before calling Provider.ValidateDataResourceConfig, confirm the type is advertised.
schema := p.GetProviderProviderSchema() // cached elsewhere as needed
if _, ok := schema.DataSources[req.TypeName]; !ok {
// do not dispatch to this provider; route elsewhere or fail fast
} Type guard
// Type guard for the built-in terraform provider's single data source.
func isBuiltinTerraformDataSource(name string) bool {
return name == "terraform_remote_state"
} Prevention
- Always consult GetProviderSchema.DataSources before dispatching ValidateDataResourceConfig
- Keep Core's schema cache fresh to avoid routing external types to the built-in provider
- In tests, assert the type name matches terraform_remote_state before calling the built-in provider
When it happens
Trigger: A providers.ValidateDataResourceConfigRequest with TypeName other than "terraform_remote_state" reaching the built-in provider; a misrouted dispatch in Core that targets the built-in terraform address for an external data source.
Common situations: A bug in Terraform Core's provider routing or a stale schema cache; tests that wire the built-in provider to the wrong type name; provider address aliasing that collapses an external provider onto the built-in one.
Related errors
- Error: unsupported resource
- provider has no function named
- unsupported ephemeral resource type
- unsupported list resource type
- unsupported state store type
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/f518fa46a19c858d.
Report an issue: GitHub.
Appendix: source
Thrown at internal/builtin/providers/terraform/provider.go:109
}
}
// ValidateProviderConfig is used to validate the configuration values.
func (p *Provider) ValidateProviderConfig(req providers.ValidateProviderConfigRequest) providers.ValidateProviderConfigResponse {
// At this moment there is nothing to configure for the terraform provider,
// so we will happily return without taking any action
var res providers.ValidateProviderConfigResponse
res.PreparedConfig = req.Config
return res
}
// ValidateDataResourceConfig is used to validate the data source configuration values.
func (p *Provider) ValidateDataResourceConfig(req providers.ValidateDataResourceConfigRequest) providers.ValidateDataResourceConfigResponse {
var res providers.ValidateDataResourceConfigResponse
// This should not happen
if req.TypeName != "terraform_remote_state" {
res.Diagnostics = res.Diagnostics.Append(fmt.Errorf("Error: unsupported data source %s", req.TypeName))
return res
}
diags := dataSourceRemoteStateValidate(req.Config)
res.Diagnostics = diags
return res
}
func (p *Provider) ValidateListResourceConfig(req providers.ValidateListResourceConfigRequest) providers.ValidateListResourceConfigResponse {
var resp providers.ValidateListResourceConfigResponse
resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("unsupported list resource type %q", req.TypeName))
return resp
}
// Configure configures and initializes the provider.
func (p *Provider) ConfigureProvider(providers.ConfigureProviderRequest) providers.ConfigureProviderResponse {
// At this moment there is nothing to configure for the terraform provider,View on GitHub (pinned to d32a084675)