diff --git a/helper/schema/resource_data.go b/helper/schema/resource_data.go index 3e728389d..cdc0d82d2 100644 --- a/helper/schema/resource_data.go +++ b/helper/schema/resource_data.go @@ -349,10 +349,12 @@ func (d *ResourceData) getSet( var indexMap map[int]int if len(parts) > 0 { indexMap = make(map[int]int) + } - // Build the set from all the items using the given hash code - for i, v := range list { - code := s.add(v) + // Build the set from all the items using the given hash code + for i, v := range list { + code := s.add(v) + if indexMap != nil { indexMap[code] = i } }