diff --git a/internal/services/loganalytics/log_analytics_workspace_resource.go b/internal/services/loganalytics/log_analytics_workspace_resource.go index 6956cc9737ef..3a32342a2067 100644 --- a/internal/services/loganalytics/log_analytics_workspace_resource.go +++ b/internal/services/loganalytics/log_analytics_workspace_resource.go @@ -144,14 +144,13 @@ func resourceLogAnalyticsWorkspaceCustomDiff(ctx context.Context, d *pluginsdk.R // custom diff here because when you link the workspace to a cluster the // cluster changes the sku to LACluster, so we need to ignore the change // if it is LACluster else invoke the ForceNew as before... - // - // NOTE: Since LACluster is not in our enum the value is returned as "" + if d.HasChange("sku") { old, new := d.GetChange("sku") log.Printf("[INFO] Log Analytics Workspace SKU: OLD: %q, NEW: %q", old, new) // If the old value is not LACluster(e.g. "") return ForceNew because they are // really changing the sku... - if !strings.EqualFold(old.(string), "") { + if !strings.EqualFold(old.(string), string(workspaces.WorkspaceSkuNameEnumLACluster)) && !strings.EqualFold(old.(string), "") { d.ForceNew("sku") } } @@ -198,7 +197,7 @@ func resourceLogAnalyticsWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta i if err == nil { if resp.Model != nil && resp.Model.Properties != nil { if azSku := resp.Model.Properties.Sku; azSku != nil { - if strings.EqualFold(string(azSku.Name), "lacluster") { + if strings.EqualFold(string(azSku.Name), string(workspaces.WorkspaceSkuNameEnumLACluster)) { isLACluster = true log.Printf("[INFO] Log Analytics Workspace %q (Resource Group %q): SKU is linked to Log Analytics cluster", name, resourceGroup) } @@ -221,7 +220,7 @@ func resourceLogAnalyticsWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta i t := d.Get("tags").(map[string]interface{}) if isLACluster { - sku.Name = "lacluster" + sku.Name = workspaces.WorkspaceSkuNameEnumLACluster } else if skuName == "" { // Default value if sku is not defined sku.Name = workspaces.WorkspaceSkuNameEnumPerGBTwoZeroOneEight