Skip to content

Commit

Permalink
add TODO comment to ip group cidr resource and extend context for des…
Browse files Browse the repository at this point in the history
…troy step in local network gateway resource tests
  • Loading branch information
stephybun committed May 14, 2024
1 parent befb327 commit 8d14a84
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions internal/services/network/ip_group_cidr_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ func resourceIpGroupCidrDelete(d *pluginsdk.ResourceData, meta interface{}) erro
if err != nil {
return err
}

// TODO this resource should use a composite resource ID to remove this instance of d.Get() in the Delete
// this file can then be removed from the exceptions list in the run-gradually-deprecated.sh script
cidr := d.Get("cidr").(string)
ipGroupId := ipgroups.NewIPGroupID(id.SubscriptionId, id.ResourceGroup, id.IpGroupName)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func resourceLocalNetworkGateway() *pluginsdk.Resource {
Timeouts: &pluginsdk.ResourceTimeout{
Create: pluginsdk.DefaultTimeout(30 * time.Minute),
Read: pluginsdk.DefaultTimeout(5 * time.Minute),
Update: pluginsdk.DefaultTimeout(30 * time.Minute),
Update: pluginsdk.DefaultTimeout(45 * time.Minute),
Delete: pluginsdk.DefaultTimeout(30 * time.Minute),
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"
"testing"
"time"

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/localnetworkgateways"
Expand Down Expand Up @@ -250,7 +251,9 @@ func (LocalNetworkGatewayResource) Destroy(ctx context.Context, client *clients.
return nil, err
}

if err := client.Network.Client.LocalNetworkGateways.DeleteThenPoll(ctx, *id); err != nil {
ctx2, cancel := context.WithTimeout(ctx, 30*time.Minute)
defer cancel()
if err := client.Network.Client.LocalNetworkGateways.DeleteThenPoll(ctx2, *id); err != nil {
return nil, fmt.Errorf("deleting %s: %+v", *id, err)
}

Expand Down
1 change: 0 additions & 1 deletion scripts/run-gradually-deprecated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ function runGraduallyDeprecatedFunctions {
fi

# exceptions to avoid false positives and legacy resources should have their original behaviour preserved
# TODO ip_group_cidr_resource.go should become a composite resource ID to remove this instance of d.Get() in the Delete
exceptions=("run-gradually-deprecated" "/legacy/" "network/ip_group_cidr_resource.go")
toSkip=false
for e in "${exceptions[@]}"; do
Expand Down

0 comments on commit 8d14a84

Please sign in to comment.