Skip to content

Commit

Permalink
azurerm_lb_backend_address_pool_address - when using this resource,…
Browse files Browse the repository at this point in the history
… values are no longer reset on `azurerm_lb_backend_address_pool` (#26264)
  • Loading branch information
sinbai authored Jun 11, 2024
1 parent 53a732c commit c6cf895
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,10 @@ func (r BackendAddressPoolAddressResource) Create() sdk.ResourceFunc {
})
}

backendAddressPool := loadbalancers.BackendAddressPool{
Properties: &loadbalancers.BackendAddressPoolPropertiesFormat{
LoadBalancerBackendAddresses: &addresses,
},
}
pool.Model.Properties.LoadBalancerBackendAddresses = &addresses

metadata.Logger.Infof("adding %s..", id)
err = lbClient.LoadBalancerBackendAddressPoolsCreateOrUpdateThenPoll(ctx, *poolId, backendAddressPool)
err = lbClient.LoadBalancerBackendAddressPoolsCreateOrUpdateThenPoll(ctx, *poolId, *pool.Model)
if err != nil {
return fmt.Errorf("updating %s: %+v", id, err)
}
Expand Down Expand Up @@ -478,11 +475,7 @@ func (r BackendAddressPoolAddressResource) Update() sdk.ResourceFunc {
}
}

backendAddressPool := loadbalancers.BackendAddressPool{
Properties: &loadbalancers.BackendAddressPoolPropertiesFormat{
LoadBalancerBackendAddresses: &addresses,
},
}
pool.Model.Properties.LoadBalancerBackendAddresses = &addresses

timeout, _ := ctx.Deadline()
lbStatus := &pluginsdk.StateChangeConf{
Expand All @@ -499,7 +492,7 @@ func (r BackendAddressPoolAddressResource) Update() sdk.ResourceFunc {
return fmt.Errorf("waiting for parent resource loadbalancer status to be ready error: %+v", err)
}

err = lbClient.LoadBalancerBackendAddressPoolsCreateOrUpdateThenPoll(ctx, poolId, backendAddressPool)
err = lbClient.LoadBalancerBackendAddressPoolsCreateOrUpdateThenPoll(ctx, poolId, *pool.Model)
if err != nil {
return fmt.Errorf("updating %s: %+v", *id, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,9 @@ func (BackendAddressPoolAddressResourceTests) Destroy(ctx context.Context, clien
}
}

backendAddressPool := loadbalancers.BackendAddressPool{
Properties: &loadbalancers.BackendAddressPoolPropertiesFormat{
LoadBalancerBackendAddresses: &newAddresses,
},
}
err = client.LoadBalancers.LoadBalancersClient.LoadBalancerBackendAddressPoolsCreateOrUpdateThenPoll(ctx, poolId, backendAddressPool)
pool.Model.Properties.LoadBalancerBackendAddresses = &newAddresses

err = client.LoadBalancers.LoadBalancersClient.LoadBalancerBackendAddressPoolsCreateOrUpdateThenPoll(ctx, poolId, *pool.Model)
if err != nil {
return nil, fmt.Errorf("updating %s: %+v", *id, err)
}
Expand Down

0 comments on commit c6cf895

Please sign in to comment.