@@ -35,22 +35,22 @@ func (plan *allocationResourceModel) toRequest(ctx context.Context) (allocation
3535 if d .HasError () {
3636 return
3737 }
38- createComponents := make ([]models.AllocationComponent , 0 )
39- allocation .Rule .Components = & []models. AllocationComponent {}
40- for _ , component := range planComponents {
38+ createComponents := make ([]models.AllocationComponent , len ( planComponents ) )
39+ allocation .Rule .Components = & createComponents
40+ for i := range planComponents {
4141 createComponent := models.AllocationComponent {
42- IncludeNull : component .IncludeNull .ValueBoolPointer (),
43- InverseSelection : component .InverseSelection .ValueBoolPointer (),
44- Key : component .Key .ValueString (),
45- Mode : models .AllocationComponentMode (component .Mode .ValueString ()),
46- Type : models .DimensionsTypes (component .ComponentsType .ValueString ()),
42+ IncludeNull : planComponents [ i ] .IncludeNull .ValueBoolPointer (),
43+ InverseSelection : planComponents [ i ] .InverseSelection .ValueBoolPointer (),
44+ Key : planComponents [ i ] .Key .ValueString (),
45+ Mode : models .AllocationComponentMode (planComponents [ i ] .Mode .ValueString ()),
46+ Type : models .DimensionsTypes (planComponents [ i ] .ComponentsType .ValueString ()),
4747 }
48- diags = component .Values .ElementsAs (ctx , & createComponent .Values , false )
48+ diags = planComponents [ i ] .Values .ElementsAs (ctx , & createComponent .Values , false )
4949 d .Append (diags ... )
5050 if d .HasError () {
5151 return
5252 }
53- createComponents = append ( createComponents , createComponent )
53+ createComponents [ i ] = createComponent
5454 }
5555 allocation .Rule .Components = & createComponents
5656 }
0 commit comments