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
})
{| 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 |
"public_key": null,
"username": null
}
object({| `{}` | 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 | 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({
disable_automatic_rollback = optional(bool, false)
enable_automatic_os_upgrade = optional(bool, false)
})