diff --git a/internal/services/loganalytics/log_analytics_workspace_table_resource.go b/internal/services/loganalytics/log_analytics_workspace_table_resource.go index 601acf8180218..bb93c079c28d5 100644 --- a/internal/services/loganalytics/log_analytics_workspace_table_resource.go +++ b/internal/services/loganalytics/log_analytics_workspace_table_resource.go @@ -158,7 +158,7 @@ func (r LogAnalyticsWorkspaceTableResource) Arguments() map[string]*pluginsdk.Sc }, "categories": { - Type: pluginsdk.TypeList, + Type: pluginsdk.TypeSet, Optional: true, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, @@ -174,7 +174,7 @@ func (r LogAnalyticsWorkspaceTableResource) Arguments() map[string]*pluginsdk.Sc }, "labels": { - Type: pluginsdk.TypeList, + Type: pluginsdk.TypeSet, Optional: true, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, @@ -198,7 +198,7 @@ func (r LogAnalyticsWorkspaceTableResource) Arguments() map[string]*pluginsdk.Sc func (r LogAnalyticsWorkspaceTableResource) Attributes() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ "solutions": { - Type: pluginsdk.TypeList, + Type: pluginsdk.TypeSet, Computed: true, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, @@ -475,7 +475,7 @@ func (r LogAnalyticsWorkspaceTableResource) Delete() sdk.ResourceFunc { return fmt.Errorf("while parsing resource ID: %+v", err) } - if metadata.ResourceData.Get("type") == string(tables.TableTypeEnumMicrosoft) { + if model.Type == string(tables.TableTypeEnumMicrosoft) { // We can't delete Microsoft tables, so we'll just set the retention to workspace default updateInput := tables.Table{ Properties: &tables.TableProperties{ diff --git a/website/docs/r/log_analytics_workspace_table.html.markdown b/website/docs/r/log_analytics_workspace_table.html.markdown index b5fcd859556ad..cf8da6f2388a9 100644 --- a/website/docs/r/log_analytics_workspace_table.html.markdown +++ b/website/docs/r/log_analytics_workspace_table.html.markdown @@ -31,7 +31,7 @@ resource "azurerm_log_analytics_workspace" "example" { resource "azurerm_log_analytics_workspace_table" "example" { workspace_id = azurerm_log_analytics_workspace.example.id name = "AppMetrics" - type = "Microsoft + type = "Microsoft" sub_type = "DataCollectionRuleBased" retention_in_days = 60 total_retention_in_days = 180 @@ -73,33 +73,33 @@ resource "azurerm_log_analytics_workspace_table" "example" { The following arguments are supported: -* `name` - (Required) Specifies the name of the table in a Log Analytics Workspace. Must end in `_CL` for custom tables. +- `name` - (Required) Specifies the name of the table in a Log Analytics Workspace. Must end in `_CL` for custom tables. -* `workspace_id` - (Required) The object ID of the Log Analytics Workspace that will contain the table. +- `workspace_id` - (Required) The object ID of the Log Analytics Workspace that will contain the table. -* `type` - (Required) The type of table. Must be either of `Microsoft` for inbuilt tables, or `CustomLog` for custom tables. +- `type` - (Required) The type of table. Must be either of `Microsoft` for inbuilt tables, or `CustomLog` for custom tables. -* `sub_type` - (Required) The sub type of table. Must be one of `Any`, `Classic`, or `DataCollectionRuleBased`. +- `sub_type` - (Required) The sub type of table. Must be one of `Any`, `Classic`, or `DataCollectionRuleBased`. -* `display_name` - (Optional) The display name of the table in a Log Analytics Workspace. +- `display_name` - (Optional) The display name of the table in a Log Analytics Workspace. -* `description` - (Optional) The description of the table in a Log Analytics Workspace. +- `description` - (Optional) The description of the table in a Log Analytics Workspace. -* `categories` - (Optional) The categories applied to the table. +- `categories` - (Optional) The categories applied to the table. -* `column` - (Optional) One or more `column` blocks detailed below. +- `column` - (Optional) One or more `column` blocks detailed below. -> **Note:** The order of the columns will match the display order in Log Analytics. -* `labels` - (Optional) The labels applied to the table. +- `labels` - (Optional) The labels applied to the table. -* `plan` - (Optional) Specify the system how to handle and charge the logs ingested to the table. Possible values are `Analytics` and `Basic`. Defaults to `Analytics`. +- `plan` - (Optional) Specify the system how to handle and charge the logs ingested to the table. Possible values are `Analytics` and `Basic`. Defaults to `Analytics`. -> **Note:** The `name` of tables currently supported by the `Basic` plan can be found [here](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/basic-logs-configure?tabs=portal-1#supported-tables). -* `retention_in_days` - (Optional) The table's retention in days. Possible values are either `8` (Basic Tier only) or range between `4` and `730`. +- `retention_in_days` - (Optional) The table's retention in days. Possible values are either `8` (Basic Tier only) or range between `4` and `730`. -* `total_retention_in_days` - (Optional) The table's total retention in days. Possible values range between `4` and `730`; or `1095`, `1460`, `1826`, `2191`, `2556`, `2922`, `3288`, `3653`, `4018`, or `4383`. +- `total_retention_in_days` - (Optional) The table's total retention in days. Possible values range between `4` and `730`; or `1095`, `1460`, `1826`, `2191`, `2556`, `2922`, `3288`, `3653`, `4018`, or `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 Microsoft or Classic azurerm_log_analytics_workspace_table is deleted. @@ -109,41 +109,41 @@ The following arguments are supported: A `column` block supports the following: -* `name` - (Required) The name of the column. +- `name` - (Required) The name of the column. -* `type` - (Required) The type of data stored in the column. Must be one of `boolean`, `dateTime`, `dynamic`, `guid"`, `int`, `long`, `real` , or `string`. +- `type` - (Required) The type of data stored in the column. Must be one of `boolean`, `dateTime`, `dynamic`, `guid"`, `int`, `long`, `real` , or `string`. -* `display_name` - (Optional) The display name of the column. +- `display_name` - (Optional) The display name of the column. -* `description` - (Optional) A description of the column. +- `description` - (Optional) A description of the column. -* `display_by_default` - (Optional) Is the column displayed by default. Defaults to `true`. +- `display_by_default` - (Optional) Is the column displayed by default. Defaults to `true`. -* `type_hint` - (Optional) A hint as to what kind of data is stored in a `string` column. Must be one of `armpath`, `guid`, `ip`, or `uri`. +- `type_hint` - (Optional) A hint as to what kind of data is stored in a `string` column. Must be one of `armpath`, `guid`, `ip`, or `uri`. -* `hidden` - (Optional) Is the column hidden? Defaults to `false`. +- `hidden` - (Optional) Is the column hidden? Defaults to `false`. ## Attributes Reference The following attributes are exported: -* `id` - The Log Analytics Workspace Table ID. +- `id` - The Log Analytics Workspace Table ID. -* `workspace_id` - The Workspace (or Customer) ID for the Log Analytics Workspace. +- `workspace_id` - The Workspace (or Customer) ID for the Log Analytics Workspace. -* `retention_in_days` - The table's data retention in days. +- `retention_in_days` - The table's data retention in days. -* `solutions` - The list of solutions associated with this table. +- `solutions` - The list of solutions associated with this table. -* `standard_column` - The details of the standard columns in this table. +- `standard_column` - The details of the standard columns in this table. -* `total_retention_in_days` - The table's total 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: -* `create` - (Defaults to 5 minutes) Used when creating the Log Analytics Workspace. -* `update` - (Defaults to 5 minutes) Used when updating the Log Analytics Workspace. -* `read` - (Defaults to 5 minutes) Used when retrieving the Log Analytics Workspace. -* `delete` - (Defaults to 30 minutes) Used when deleting the Log Analytics Workspace. +- `create` - (Defaults to 5 minutes) Used when creating the Log Analytics Workspace. +- `update` - (Defaults to 5 minutes) Used when updating the Log Analytics Workspace. +- `read` - (Defaults to 5 minutes) Used when retrieving the Log Analytics Workspace. +- `delete` - (Defaults to 30 minutes) Used when deleting the Log Analytics Workspace.