Skip to content

Commit

Permalink
azurerm_firewall_policy: Fix import by removing potential nilpointe…
Browse files Browse the repository at this point in the history
…rs (#13862)
  • Loading branch information
aristosvo authored Oct 25, 2021
1 parent 21cf6da commit eb4a7e1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions internal/services/firewall/firewall_policy_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,18 @@ func flattenFirewallPolicyIntrusionDetection(input *network.FirewallPolicyIntrus
}

signatureOverrides := make([]interface{}, 0)
trafficBypass := make([]interface{}, 0)

if input.Configuration == nil {
return []interface{}{
map[string]interface{}{
"mode": string(input.Mode),
"signature_overrides": signatureOverrides,
"traffic_bypass": trafficBypass,
},
}
}

if overrides := input.Configuration.SignatureOverrides; overrides != nil {
for _, override := range *overrides {
id := ""
Expand All @@ -681,7 +693,6 @@ func flattenFirewallPolicyIntrusionDetection(input *network.FirewallPolicyIntrus
}
}

trafficBypass := make([]interface{}, 0)
if bypasses := input.Configuration.BypassTrafficSettings; bypasses != nil {
for _, bypass := range *bypasses {
name := ""
Expand Down Expand Up @@ -742,7 +753,7 @@ func flattenFirewallPolicyIntrusionDetection(input *network.FirewallPolicyIntrus
}

func flattenFirewallPolicyTransportSecurity(input *network.FirewallPolicyTransportSecurity) []interface{} {
if input == nil {
if input == nil || input.CertificateAuthority == nil {
return []interface{}{}
}

Expand Down

0 comments on commit eb4a7e1

Please sign in to comment.