mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-29 10:21:01 -06:00
Revert "core: Ensure hasComputedSubKeys iterates over Sets and Lists properly"
This reverts commit 4d8208d840
.
This commit is contained in:
parent
f2fcf1494a
commit
0634aada69
@ -270,30 +270,12 @@ func (r *ConfigFieldReader) hasComputedSubKeys(key string, schema *Schema) bool
|
||||
switch t := schema.Elem.(type) {
|
||||
case *Resource:
|
||||
for k, schema := range t.Schema {
|
||||
addr := prefix + k
|
||||
if r.Config.IsComputed(addr) {
|
||||
if r.Config.IsComputed(prefix + k) {
|
||||
return true
|
||||
}
|
||||
|
||||
// We need to loop into sets and lists to ensure we pass the correct
|
||||
// address to the raw config - otherwise for sets we get something like
|
||||
// set.0.set.item instead of set.0.set.0.item, which renders an
|
||||
// inaccurate result.
|
||||
if schema.Type == TypeSet || schema.Type == TypeList {
|
||||
raw, err := readListField(&nestedConfigFieldReader{r}, strings.Split(addr, "."), schema)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("readListField failed when field was supposed to be list-like: %v", err))
|
||||
}
|
||||
// Just range into the address space here, we don't need the value.
|
||||
for i := range raw.Value.([]interface{}) {
|
||||
if r.hasComputedSubKeys(addr+"."+strconv.Itoa(i), schema) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if r.hasComputedSubKeys(addr, schema) {
|
||||
return true
|
||||
}
|
||||
if r.hasComputedSubKeys(prefix+k, schema) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user