Skip to content

Commit

Permalink
tflint
Browse files Browse the repository at this point in the history
  • Loading branch information
stephybun committed May 8, 2024
1 parent 3ff232d commit 7cfabb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 5 additions & 4 deletions internal/services/network/ip_group_cidr_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}

Expand Down
8 changes: 6 additions & 2 deletions internal/services/network/nat_gateway_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7cfabb8

Please sign in to comment.