Skip to content

Commit

Permalink
d/log_analytics_workspace: Force ID from parser, rather than from res…
Browse files Browse the repository at this point in the history
…ponse (#10892)

Fixes #10857
  • Loading branch information
favoretti authored Mar 9, 2021
1 parent a81ccf5 commit c2a9d1e
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
Expand Down

0 comments on commit c2a9d1e

Please sign in to comment.