Skip to content

Commit

Permalink
Merge pull request #10696 from terraform-providers/b/10543-lb-crash
Browse files Browse the repository at this point in the history
r/lb_outbound_rule: fixing a crash when `frontendIPConfigurations` is omitted in the API response
  • Loading branch information
tombuildsstuff authored Feb 23, 2021
2 parents 5bfc7b1 + 0720969 commit 1eed1d2
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 1eed1d2

Please sign in to comment.