From 62a03b7f8049b813a560e6541eeef9b42d5dda13 Mon Sep 17 00:00:00 2001
From: Giovanni Barbaro <vanni-96@hotmail.it>
Date: Thu, 1 Feb 2024 13:56:34 +0100
Subject: [PATCH] Adds test coverage and documentation

---
 .../log_analytics_workspace_table_resource_test.go  |  8 +++++---
 .../r/log_analytics_workspace_table.html.markdown   | 13 +++++++++----
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/internal/services/loganalytics/log_analytics_workspace_table_resource_test.go b/internal/services/loganalytics/log_analytics_workspace_table_resource_test.go
index 2cb4200ac675a..1c56323099cbf 100644
--- a/internal/services/loganalytics/log_analytics_workspace_table_resource_test.go
+++ b/internal/services/loganalytics/log_analytics_workspace_table_resource_test.go
@@ -30,6 +30,7 @@ func TestAccLogAnalyticsWorkspaceTable_updateTableRetention(t *testing.T) {
 				check.That(data.ResourceName).Key("id").Exists(),
 				check.That(data.ResourceName).Key("name").HasValue("AppEvents"),
 				check.That(data.ResourceName).Key("retention_in_days").HasValue("7"),
+				check.That(data.ResourceName).Key("total_retention_in_days").HasValue("20"),
 			),
 		},
 	})
@@ -79,9 +80,10 @@ resource "azurerm_log_analytics_workspace" "test" {
   retention_in_days   = 30
 }
 resource "azurerm_log_analytics_workspace_table" "test" {
-  name              = "AppEvents"
-  workspace_id      = azurerm_log_analytics_workspace.test.id
-  retention_in_days = 7
+  name                    = "AppEvents"
+  workspace_id            = azurerm_log_analytics_workspace.test.id
+  retention_in_days       = 7
+  total_retention_in_days = 20
 }
 `, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
 }
diff --git a/website/docs/r/log_analytics_workspace_table.html.markdown b/website/docs/r/log_analytics_workspace_table.html.markdown
index b5fed8f2ca105..3ac000b01f92c 100644
--- a/website/docs/r/log_analytics_workspace_table.html.markdown
+++ b/website/docs/r/log_analytics_workspace_table.html.markdown
@@ -27,9 +27,10 @@ resource "azurerm_log_analytics_workspace" "example" {
   retention_in_days   = 30
 }
 resource "azurerm_log_analytics_workspace_table" "example" {
-  workspace_id      = azurerm_log_analytics_workspace.example.id
-  name              = "AppMetrics"
-  retention_in_days = 60
+  workspace_id            = azurerm_log_analytics_workspace.example.id
+  name                    = "AppMetrics"
+  retention_in_days       = 60
+  total_retention_in_days = 180
 }
 ```
 
@@ -47,7 +48,9 @@ The following arguments are supported:
 
 * `retention_in_days` - (Optional) The table's retention in days. Possible values are either 7 (Free Tier only) or range between 30 and 730.
 
--> **Note:** `retention_in_days` will revert back to the value of azurerm_log_analytics_workspace retention_in_days when a azurerm_log_analytics_workspace_table is deleted.
+* `total_retention_in_days` - (Optional) The table's total retention in days. Possible values range between 30 and 4383.
+
+-> **Note:** `retention_in_days` and `total_retention_in_days` will revert back to the value of azurerm_log_analytics_workspace retention_in_days when a azurerm_log_analytics_workspace_table is deleted.
 
 -> **Note:** The `retention_in_days` cannot be specified when `plan` is `Basic` because the retention is fixed at eight days.
 
@@ -61,6 +64,8 @@ The following attributes are exported:
 
 * `retention_in_days` - The table's data retention in days.
 
+* `total_retention_in_days` - The table's total data retention in days.
+
 ## Timeouts
 
 The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: