From 3dd3f967210008166315382bc269d877b7413fa9 Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 13 Jan 2023 09:13:03 -0800 Subject: [PATCH] azurerm_log_analytics - fixing crash around shared key id --- .../loganalytics/log_analytics_workspace_resource.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/services/loganalytics/log_analytics_workspace_resource.go b/internal/services/loganalytics/log_analytics_workspace_resource.go index 79e21b5d3f8e..a08b2db7fa88 100644 --- a/internal/services/loganalytics/log_analytics_workspace_resource.go +++ b/internal/services/loganalytics/log_analytics_workspace_resource.go @@ -335,11 +335,6 @@ func resourceLogAnalyticsWorkspaceRead(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() id, err := workspaces.ParseWorkspaceID(d.Id()) - sharedKeyId := sharedKeyWorkspaces.WorkspaceId{ - SubscriptionId: id.SubscriptionId, - ResourceGroupName: id.ResourceGroupName, - WorkspaceName: id.WorkspaceName, - } if err != nil { return err } @@ -421,6 +416,11 @@ func resourceLogAnalyticsWorkspaceRead(d *pluginsdk.ResourceData, meta interface } d.Set("allow_resource_only_permissions", allowResourceOnlyPermissions) + sharedKeyId := sharedKeyWorkspaces.WorkspaceId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + WorkspaceName: id.WorkspaceName, + } sharedKeysResp, err := sharedKeyClient.SharedKeysGetSharedKeys(ctx, sharedKeyId) if err != nil { log.Printf("[ERROR] Unable to List Shared keys for Log Analytics workspaces %s: %+v", id.WorkspaceName, err)