Skip to content

Commit

Permalink
azurerm_monitor_diagnostic_setting - retention_policy deprecated …
Browse files Browse the repository at this point in the history
…in favor of `azurerm_storage_management_policy` (#23260)

* enhance deprecation message

* add more copy
  • Loading branch information
teowa authored Sep 18, 2023
1 parent 1fa32f2 commit a8aef80
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
16 changes: 9 additions & 7 deletions internal/services/monitor/monitor_diagnostic_setting_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func resourceMonitorDiagnosticSetting() *pluginsdk.Resource {
Type: pluginsdk.TypeList,
Optional: true,
MaxItems: 1,
Deprecated: "`retention_policy` has been deprecated - to learn more https://aka.ms/diagnostic_settings_log_retention",
Deprecated: "`retention_policy` has been deprecated in favor of `azurerm_storage_management_policy` resource - to learn more https://aka.ms/diagnostic_settings_log_retention",
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"enabled": {
Expand Down Expand Up @@ -168,9 +168,10 @@ func resourceMonitorDiagnosticSetting() *pluginsdk.Resource {
},

"retention_policy": {
Type: pluginsdk.TypeList,
Optional: true,
MaxItems: 1,
Type: pluginsdk.TypeList,
Optional: true,
MaxItems: 1,
Deprecated: "`retention_policy` has been deprecated in favor of `azurerm_storage_management_policy` resource - to learn more https://aka.ms/diagnostic_settings_log_retention",
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"enabled": {
Expand Down Expand Up @@ -218,9 +219,10 @@ func resourceMonitorDiagnosticSetting() *pluginsdk.Resource {
},

"retention_policy": {
Type: pluginsdk.TypeList,
Optional: true,
MaxItems: 1,
Type: pluginsdk.TypeList,
Optional: true,
MaxItems: 1,
Deprecated: "`retention_policy` has been deprecated in favor of `azurerm_storage_management_policy` resource - to learn more https://aka.ms/diagnostic_settings_log_retention",
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"enabled": {
Expand Down
9 changes: 9 additions & 0 deletions website/docs/r/monitor_diagnostic_setting.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ A `log` block supports the following:

* `retention_policy` - (Optional) A `retention_policy` block as defined below.

!> **NOTE:** `retention_policy` has been deprecated in favor of `azurerm_storage_management_policy` resource - to learn more information on the deprecation [in the Azure documentation](https://aka.ms/diagnostic_settings_log_retention).

* `enabled` - (Optional) Is this Diagnostic Log enabled? Defaults to `true`.

---
Expand All @@ -140,6 +142,8 @@ An `enabled_log` block supports the following:

* `retention_policy` - (Optional) A `retention_policy` block as defined below.

!> **NOTE:** `retention_policy` has been deprecated in favor of `azurerm_storage_management_policy` resource - to learn more information on the deprecation [in the Azure documentation](https://aka.ms/diagnostic_settings_log_retention).

---

A `metric` block supports the following:
Expand All @@ -150,15 +154,20 @@ A `metric` block supports the following:

* `retention_policy` - (Optional) A `retention_policy` block as defined below.

!> **NOTE:** `retention_policy` has been deprecated in favor of `azurerm_storage_management_policy` resource - to learn more information on the deprecation [in the Azure documentation](https://aka.ms/diagnostic_settings_log_retention).

* `enabled` - (Optional) Is this Diagnostic Metric enabled? Defaults to `true`.

---

A `retention_policy` block supports the following:

!> **NOTE:** `retention_policy` has been deprecated in favor of `azurerm_storage_management_policy` resource - to learn more information on the deprecation [in the Azure documentation](https://aka.ms/diagnostic_settings_log_retention).

* `enabled` - (Required) Is this Retention Policy enabled?

* `days` - (Optional) The number of days for which this Retention Policy should apply.


-> **NOTE:** Setting this to `0` will retain the events indefinitely.

Expand Down

0 comments on commit a8aef80

Please sign in to comment.