Skip to content

Commit

Permalink
r/lb_outbound_rule: fixing a crash when frontendIPConfigurations is…
Browse files Browse the repository at this point in the history
… omitted in the API response

Fixes #10543
  • Loading branch information
tombuildsstuff committed Feb 23, 2021
1 parent 4caa88f commit 0720969
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions azurerm/internal/services/loadbalancer/outbound_rule_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,21 @@ func resourceArmLoadBalancerOutboundRuleRead(d *schema.ResourceData, meta interf
d.Set("enable_tcp_reset", props.EnableTCPReset)

frontendIpConfigurations := make([]interface{}, 0)
for _, feConfig := range *props.FrontendIPConfigurations {
if feConfig.ID == nil {
continue
if configs := props.FrontendIPConfigurations; configs != nil {
for _, feConfig := range *configs {
if feConfig.ID == nil {
continue
}
feid, err := parse.LoadBalancerFrontendIpConfigurationID(*feConfig.ID)
if err != nil {
return err
}

frontendIpConfigurations = append(frontendIpConfigurations, map[string]interface{}{
"id": feid.ID(),
"name": feid.FrontendIPConfigurationName,
})
}
feid, err := parse.LoadBalancerFrontendIpConfigurationID(*feConfig.ID)
if err != nil {
return err
}

frontendIpConfigurations = append(frontendIpConfigurations, map[string]interface{}{
"id": feid.ID(),
"name": feid.FrontendIPConfigurationName,
})
}
d.Set("frontend_ip_configuration", frontendIpConfigurations)

Expand Down

0 comments on commit 0720969

Please sign in to comment.