mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
core: NewResourceConfigShimmed not to crash without schema
Although there isn't really a good reason why there should be no schema in practice, it's better for us not to crash right now while we're still updating all of the callers (mostly tests) to make schema available.
This commit is contained in:
parent
c6b2799ee9
commit
153021dd08
@ -2,6 +2,7 @@ package terraform
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
@ -256,6 +257,11 @@ func newResourceConfigShimmedComputedKeys(obj cty.Value, schema *configschema.Bl
|
||||
var ret []string
|
||||
ty := obj.Type()
|
||||
|
||||
if schema == nil {
|
||||
log.Printf("[WARN] NewResourceConfigShimmed: can't identify computed keys because no schema is available")
|
||||
return nil
|
||||
}
|
||||
|
||||
for attrName := range schema.Attributes {
|
||||
if !ty.HasAttribute(attrName) {
|
||||
// Should never happen, but we'll tolerate it anyway
|
||||
|
Loading…
Reference in New Issue
Block a user