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 93cc49e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 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"

Check failure on line 8 in internal/services/network/nat_gateway_data_source.go

View workflow job for this annotation

GitHub Actions / golint

File is not `goimports`-ed (goimports)
"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
6 changes: 5 additions & 1 deletion internal/services/network/nat_gateway_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 93cc49e

Please sign in to comment.