From 093ce79885cf2f6479c541471e995c707e98935f Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 31 May 2024 11:27:18 -0700 Subject: [PATCH] Address review --- internal/services/network/vpn_site_resource.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/services/network/vpn_site_resource.go b/internal/services/network/vpn_site_resource.go index 5a27fe3e61e4..5f72d7cb89a0 100644 --- a/internal/services/network/vpn_site_resource.go +++ b/internal/services/network/vpn_site_resource.go @@ -291,12 +291,14 @@ func resourceVpnSiteRead(d *pluginsdk.ResourceData, meta interface{}) error { func resourceVpnSiteUpdate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Network.VirtualWANs - subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := virtualwans.NewVpnSiteID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - existing, err := client.VpnSitesGet(ctx, id) + id, err := virtualwans.ParseVpnSiteID(d.Id()) + if err != nil { + return err + } + existing, err := client.VpnSitesGet(ctx, *id) if err != nil { return fmt.Errorf("retrieving %s: %+v", id, err) } @@ -331,7 +333,7 @@ func resourceVpnSiteUpdate(d *pluginsdk.ResourceData, meta interface{}) error { payload.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } - if err := client.VpnSitesCreateOrUpdateThenPoll(ctx, id, *payload); err != nil { + if err := client.VpnSitesCreateOrUpdateThenPoll(ctx, *id, *payload); err != nil { return fmt.Errorf("updating %s: %+v", id, err) }