Skip to content

Commit

Permalink
azurerm_log_analytics_workspace - fix workaround when sku is `LAC…
Browse files Browse the repository at this point in the history
…luster`
  • Loading branch information
ziyeqf committed Dec 8, 2022
1 parent 709842f commit 0ae37d3
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func resourceLogAnalyticsWorkspaceCustomDiff(ctx context.Context, d *pluginsdk.R
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)) {
d.ForceNew("sku")
}
}
Expand Down Expand Up @@ -198,7 +198,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)
}
Expand All @@ -221,7 +221,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
Expand Down

0 comments on commit 0ae37d3

Please sign in to comment.