azurerm_maintenance_assignment_dynamic_scope

Manages a Dynamic Maintenance Assignment.

Example Usage

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_maintenance_configuration" "example" {
  name                     = "example"
  resource_group_name      = azurerm_resource_group.example.name
  location                 = azurerm_resource_group.example.location
  scope                    = "InGuestPatch"
  in_guest_user_patch_mode = "User"

  window {
    start_date_time = formatdate("YYYY-MM-DD hh:mm", timestamp())
    time_zone       = "Greenwich Standard Time"
    recur_every     = "1Day"
  }

  install_patches {
    reboot = "Always"

    windows {
      classifications_to_include = ["Critical"]
      kb_numbers_to_exclude      = []
      kb_numbers_to_include      = []
    }
  }
}

resource "azurerm_maintenance_assignment_dynamic_scope" "example" {
  name                         = "example"
  maintenance_configuration_id = azurerm_maintenance_configuration.example.id

  filter {
    locations       = ["West Europe"]
    os_types        = ["Windows"]
    resource_groups = [azurerm_resource_group.example.name]
    resource_types  = ["Microsoft.Compute/virtualMachines"]
    tag_filter      = "Any"
    tags {
      tag    = "foo"
      values = ["barbar"]
    }
  }
}

Arguments Reference

The following arguments are supported:


A filter block supports the following:


A tags block supports the following:

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

Dynamic Maintenance Assignments can be imported using the resource id, e.g.

terraform import azurerm_maintenance_assignment_dynamic_scope.example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Maintenance/configurationAssignments/assignmentName