Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyeqf committed Sep 18, 2024
1 parent 8916ae9 commit 449dc54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ func (r LogAnalyticsWorkspaceTableResource) Create() sdk.ResourceFunc {

if model.Plan == string(tables.TablePlanEnumAnalytics) {
updateInput.Properties.RetentionInDays = pointer.To(model.RetentionInDays)
}

if model.TotalRetentionInDays != 0 {
updateInput.Properties.TotalRetentionInDays = pointer.To(model.TotalRetentionInDays)
}

if err := client.CreateOrUpdateThenPoll(ctx, id, updateInput); err != nil {
return fmt.Errorf("failed to update table %s in workspace %s in resource group %s: %s", tableName, workspaceId.WorkspaceName, workspaceId.ResourceGroupName, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ resource "azurerm_log_analytics_workspace" "test" {
retention_in_days = 30
}
resource "azurerm_log_analytics_workspace_table" "test" {
name = "AppTraces"
workspace_id = azurerm_log_analytics_workspace.test.id
plan = "Basic"
name = "AppTraces"
workspace_id = azurerm_log_analytics_workspace.test.id
plan = "Basic"
total_retention_in_days = 32
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}

0 comments on commit 449dc54

Please sign in to comment.