mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-19 09:48:32 -05:00
Fix nil pointer dereference in config filtering (#3553)
Signed-off-by: Toni Kangas <toni.kangas@upcloud.com>
This commit is contained in:
@@ -57,7 +57,7 @@ func (b *Block) Filter(filterAttribute FilterT[*Attribute], filterBlock FilterT[
|
||||
ret.Attributes[name] = &attr
|
||||
}
|
||||
|
||||
if attr.NestedType != nil {
|
||||
if ret.Attributes[name] != nil && attr.NestedType != nil {
|
||||
ret.Attributes[name].NestedType = filterNestedType((&attr).NestedType, filterAttribute)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +176,18 @@ func TestFilter(t *testing.T) {
|
||||
Nesting: NestingList,
|
||||
},
|
||||
},
|
||||
"read_only_nested": {
|
||||
NestedType: &Object{
|
||||
Attributes: map[string]*Attribute{
|
||||
"string": {
|
||||
Type: cty.String,
|
||||
Optional: true,
|
||||
},
|
||||
},
|
||||
Nesting: NestingList,
|
||||
},
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
|
||||
BlockTypes: map[string]*NestedBlock{
|
||||
|
||||
Reference in New Issue
Block a user