From c2a9d1e6bcb3218cd4a48ef6fb24c52f9168a14b Mon Sep 17 00:00:00 2001 From: Vladimir Lazarenko Date: Tue, 9 Mar 2021 21:49:42 +0100 Subject: [PATCH] d/log_analytics_workspace: Force ID from parser, rather than from response (#10892) Fixes #10857 --- .../loganalytics/log_analytics_workspace_data_source.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/azurerm/internal/services/loganalytics/log_analytics_workspace_data_source.go b/azurerm/internal/services/loganalytics/log_analytics_workspace_data_source.go index be86126e24f5..dc507bbcff1d 100644 --- a/azurerm/internal/services/loganalytics/log_analytics_workspace_data_source.go +++ b/azurerm/internal/services/loganalytics/log_analytics_workspace_data_source.go @@ -79,6 +79,7 @@ func dataSourceLogAnalyticsWorkspace() *schema.Resource { func dataSourceLogAnalyticsWorkspaceRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*clients.Client).LogAnalytics.WorkspacesClient sharedKeysClient := meta.(*clients.Client).LogAnalytics.SharedKeysClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -93,10 +94,7 @@ func dataSourceLogAnalyticsWorkspaceRead(d *schema.ResourceData, meta interface{ return fmt.Errorf("Error making Read request on AzureRM Log Analytics workspaces '%s': %+v", name, err) } - id, err := parse.LogAnalyticsWorkspaceID(*resp.ID) - if err != nil { - return fmt.Errorf("Error parsing Log Analytics Workspace ID %q", *resp.ID) - } + id := parse.NewLogAnalyticsWorkspaceID(subscriptionId, resGroup, name) d.SetId(id.ID()) d.Set("name", resp.Name)