From 13b162969778a41cf3e1401f3b18389a3c9910a2 Mon Sep 17 00:00:00 2001 From: oleh_mykolaishyn Date: Thu, 20 Jun 2024 14:53:19 +0300 Subject: [PATCH 1/2] fix: support flag for automatic os upgrade policy block --- main.tf | 9 ++++++--- variables.tf | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 4080009..440cc9a 100644 --- a/main.tf +++ b/main.tf @@ -51,9 +51,12 @@ resource "azurerm_linux_virtual_machine_scale_set" "this" { } } - automatic_os_upgrade_policy { - disable_automatic_rollback = var.automatic_os_upgrade_policy.disable_automatic_rollback - enable_automatic_os_upgrade = var.automatic_os_upgrade_policy.enable_automatic_os_upgrade + dynamic "automatic_os_upgrade_policy" { + for_each = var.automatic_os_upgrade_policy_enabled ? [1] : [] + content { + disable_automatic_rollback = var.automatic_os_upgrade_policy.disable_automatic_rollback + enable_automatic_os_upgrade = var.automatic_os_upgrade_policy.enable_automatic_os_upgrade + } } boot_diagnostics { diff --git a/variables.tf b/variables.tf index c042b3b..7d22f32 100644 --- a/variables.tf +++ b/variables.tf @@ -177,6 +177,12 @@ variable "dependency_agent_extension_version" { default = "9.5" } +variable "automatic_os_upgrade_policy_enabled" { + description = "Boolean flag that determines whether automatic os upgrade policy is enabled" + type = bool + default = false +} + variable "automatic_os_upgrade_policy" { description = "Configuration options for automatic os upgrade policy" type = object({ From 6e4910c20648379fb64a5db41477f9218fdac953 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 20 Jun 2024 11:55:44 +0000 Subject: [PATCH 2/2] terraform-docs: automated action --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3335319..071e5a1 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ No modules. | [admin\_ssh\_key](#input\_admin\_ssh\_key) | Objects to configure ssh key reference for Virtual Machine Scale Sets |
object({
username = optional(string, "azureuser")
public_key = string
})
|
{
"public_key": null,
"username": null
}
| no | | [analytics\_workspace\_id](#input\_analytics\_workspace\_id) | Resource ID of Log Analytics Workspace | `string` | `null` | no | | [automatic\_os\_upgrade\_policy](#input\_automatic\_os\_upgrade\_policy) | Configuration options for automatic os upgrade policy |
object({
disable_automatic_rollback = optional(bool, false)
enable_automatic_os_upgrade = optional(bool, false)
})
| `{}` | no | +| [automatic\_os\_upgrade\_policy\_enabled](#input\_automatic\_os\_upgrade\_policy\_enabled) | Boolean flag that determines whether automatic os upgrade policy is enabled | `bool` | `false` | no | | [data\_collection\_rule\_association\_name](#input\_data\_collection\_rule\_association\_name) | Data collection rule association name | `string` | `null` | no | | [data\_collection\_rule\_name](#input\_data\_collection\_rule\_name) | Data collection rule name | `string` | `null` | no | | [datasource\_name](#input\_datasource\_name) | Datasource syslog name | `string` | `"datasource-syslog"` | no |