Skip to content

Commit

Permalink
Nil refence fix for issue #464
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Nov 2, 2017
1 parent ef3203b commit 857e5ff
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions azurerm/resource_arm_network_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,18 @@ func flattenNetworkSecurityRules(rules *[]network.SecurityRule) []interface{} {
sgRule["name"] = *rule.Name

if props := rule.SecurityRulePropertiesFormat; props != nil {
sgRule["destination_address_prefix"] = *props.DestinationAddressPrefix
sgRule["destination_port_range"] = *props.DestinationPortRange
sgRule["source_address_prefix"] = *props.SourceAddressPrefix
sgRule["source_port_range"] = *props.SourcePortRange
if props.DestinationAddressPrefix != nil {
sgRule["destination_address_prefix"] = *props.DestinationAddressPrefix
}
if props.DestinationPortRange != nil {
sgRule["destination_port_range"] = *props.DestinationPortRange
}
if props.SourceAddressPrefix != nil {
sgRule["source_address_prefix"] = *props.SourceAddressPrefix
}
if props.SourcePortRange != nil {
sgRule["source_port_range"] = *props.SourcePortRange
}
sgRule["priority"] = int(*props.Priority)
sgRule["access"] = string(props.Access)
sgRule["direction"] = string(props.Direction)
Expand Down

0 comments on commit 857e5ff

Please sign in to comment.