mirror of
https://github.com/hashicorp/terraform.git
synced 2026-02-18 18:29:44 -05:00
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:
parent
a3dc571150
commit
9cdf1ad3cd
2 changed files with 12 additions and 1 deletions
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue