From 6309915e96ba7e8481ae3aae8de14d09b9bf4ece Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 22 Nov 2023 17:55:10 +0100 Subject: [PATCH] firewall: recasing the `firewall_policy_id` field The Azure API incorrectly returns `resourcegroups` whereas the API Spec defines `resourceGroups` Fixes #23990 --- internal/services/firewall/firewall_resource.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/services/firewall/firewall_resource.go b/internal/services/firewall/firewall_resource.go index 41bd9352e0aa..260f654c9784 100644 --- a/internal/services/firewall/firewall_resource.go +++ b/internal/services/firewall/firewall_resource.go @@ -437,9 +437,14 @@ func resourceFirewallRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("setting `private_ip_ranges`: %+v", err) } - if policy := props.FirewallPolicy; policy != nil { - d.Set("firewall_policy_id", policy.Id) + firewallPolicyId := "" + if props.FirewallPolicy != nil && props.FirewallPolicy.Id != nil { + firewallPolicyId = *props.FirewallPolicy.Id + if policyId, err := firewallpolicies.ParseFirewallPolicyIDInsensitively(firewallPolicyId); err == nil { + firewallPolicyId = policyId.ID() + } } + d.Set("firewall_policy_id", firewallPolicyId) if sku := props.Sku; sku != nil { d.Set("sku_name", string(pointer.From(sku.Name)))