builtin/terraform: provide empty config schema to avoid spurious ERROR log (#38183)

* builtin/terraform: provide empty config schema to avoid spurious ERROR log

The builtin terraform provider returned a nil Body in its provider config
schema, which caused AttachSchemaTransformer to emit an ERROR-level log
message ("No provider config schema available for provider[terraform.io/
builtin/terraform]") even though the provider works correctly. This is
confusing for users who filter logs by severity, especially in CI pipelines.

Set the provider config schema to an empty configschema.Block{} so that
AttachSchemaTransformer finds a valid (but empty) schema and skips the
error log. This matches the maintainer's suggested fix in #34207.

Fixes #34207

* Add changelog entry for builtin provider schema fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove changelog entry per reviewer feedback

Not an end-user facing change, so no changelog needed.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Varun Chawla 2026-02-17 03:47:28 -08:00 committed by GitHub
parent a3dc571150
commit 9cdf1ad3cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -10,6 +10,7 @@ import (
tfaddr "github.com/hashicorp/terraform-registry-address"
"github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/internal/configs/configschema"
"github.com/hashicorp/terraform/internal/providers"
)
@ -26,7 +27,7 @@ func NewProvider() providers.Interface {
// GetSchema returns the complete schema for the provider.
func (p *Provider) GetProviderSchema() providers.GetProviderSchemaResponse {
resp := providers.GetProviderSchemaResponse{
Provider: providers.Schema{},
Provider: providers.Schema{Body: &configschema.Block{}},
ServerCapabilities: providers.ServerCapabilities{
MoveResourceState: true,
},

View file

@ -67,3 +67,13 @@ func TestMoveResourceState_NonExistentResource(t *testing.T) {
t.Fatal("expected diagnostics")
}
}
func TestGetProviderSchema_ProviderConfigNotNil(t *testing.T) {
provider := &Provider{}
resp := provider.GetProviderSchema()
if resp.Provider.Body == nil {
t.Fatal("provider config schema body should not be nil; a nil body causes " +
"a spurious ERROR-level log message in AttachSchemaTransformer")
}
}