From 93cc49e6c60005a12e78591d1a7398e5120da2fc Mon Sep 17 00:00:00 2001 From: Steph Date: Wed, 8 May 2024 15:41:42 +0200 Subject: [PATCH] tflint --- internal/services/network/ip_group_cidr_resource.go | 9 +++++---- internal/services/network/nat_gateway_data_source.go | 8 ++++++-- internal/services/network/nat_gateway_resource.go | 6 +++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/internal/services/network/ip_group_cidr_resource.go b/internal/services/network/ip_group_cidr_resource.go index 4c047503b4af6..f70451b4f99b9 100644 --- a/internal/services/network/ip_group_cidr_resource.go +++ b/internal/services/network/ip_group_cidr_resource.go @@ -154,16 +154,17 @@ func resourceIpGroupCidrDelete(d *pluginsdk.ResourceData, meta interface{}) erro ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - cidr := d.Get("cidr").(string) - ipGroupId, err := ipgroups.ParseIPGroupID(d.Get("ip_group_id").(string)) + id, err := parse.IpGroupCidrID(d.Id()) if err != nil { return err } + cidr := d.Get("cidr").(string) + ipGroupId := ipgroups.NewIPGroupID(id.SubscriptionId, id.ResourceGroup, id.IpGroupName) locks.ByID(ipGroupId.ID()) defer locks.UnlockByID(ipGroupId.ID()) - existing, err := client.Get(ctx, *ipGroupId, ipgroups.DefaultGetOperationOptions()) + existing, err := client.Get(ctx, ipGroupId, ipgroups.DefaultGetOperationOptions()) if err != nil { if response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("retrieving %s: %s", ipGroupId, err) @@ -188,7 +189,7 @@ func resourceIpGroupCidrDelete(d *pluginsdk.ResourceData, meta interface{}) erro }, } - if err := client.CreateOrUpdateThenPoll(ctx, *ipGroupId, params); err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, ipGroupId, params); err != nil { return fmt.Errorf("updating %s: %+v", ipGroupId.ID(), err) } diff --git a/internal/services/network/nat_gateway_data_source.go b/internal/services/network/nat_gateway_data_source.go index a0ffa0b39d674..575917a0cf8d2 100644 --- a/internal/services/network/nat_gateway_data_source.go +++ b/internal/services/network/nat_gateway_data_source.go @@ -5,9 +5,9 @@ package network import ( "fmt" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "time" - "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -100,7 +100,11 @@ func dataSourceNatGatewayRead(d *pluginsdk.ResourceData, meta interface{}) error if model := resp.Model; model != nil { d.Set("location", location.NormalizeNilable(model.Location)) - d.Set("sku_name", pointer.From(model.Sku)) + sku := "" + if model.Sku != nil { + sku = string(pointer.From(model.Sku.Name)) + } + d.Set("sku_name", sku) d.Set("zones", zones.FlattenUntyped(model.Zones)) if props := model.Properties; props != nil { d.Set("idle_timeout_in_minutes", props.IdleTimeoutInMinutes) diff --git a/internal/services/network/nat_gateway_resource.go b/internal/services/network/nat_gateway_resource.go index e7305633e033f..3b23ae5df234f 100644 --- a/internal/services/network/nat_gateway_resource.go +++ b/internal/services/network/nat_gateway_resource.go @@ -225,7 +225,11 @@ func resourceNatGatewayRead(d *pluginsdk.ResourceData, meta interface{}) error { if model := resp.Model; model != nil { d.Set("location", location.NormalizeNilable(model.Location)) - d.Set("sku_name", pointer.From(model.Name)) + sku := "" + if model.Sku != nil { + sku = string(pointer.From(model.Sku.Name)) + } + d.Set("sku_name", sku) d.Set("zones", zones.FlattenUntyped(model.Zones)) if props := model.Properties; props != nil { d.Set("idle_timeout_in_minutes", props.IdleTimeoutInMinutes)