Skip to content

azurermMaintenanceConfiguration

Manages a maintenance configuration.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
new azurerm.provider.AzurermProvider(this, "azurerm", {
  features: [{}],
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermMaintenanceConfigurationExample =
  new azurerm.maintenanceConfiguration.MaintenanceConfiguration(
    this,
    "example_2",
    {
      location: azurermResourceGroupExample.location,
      name: "example-mc",
      resource_group_name: azurermResourceGroupExample.name,
      scope: "SQLDB",
      tags: {
        Env: "prod",
      },
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMaintenanceConfigurationExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Maintenance Configuration. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the Resource Group where the Maintenance Configuration should exist. Changing this forces a new resource to be created.

  • location - (Required) Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created.

  • scope - (Required) The scope of the Maintenance Configuration. Possible values are extension, host, inGuestPatch, osImage, sqldb or sqlManagedInstance.

  • visibility - (Optional) The visibility of the Maintenance Configuration. The only allowable value is custom.

  • window - (Optional) A window block as defined below.

  • installPatches - (Optional) An installPatches block as defined below.

-> NOTE: installPatches must be specified when scope is inGuestPatch.

  • inGuestUserPatchMode - (Optional) The in guest user patch mode. Possible values are platform or user. Must be specified when scope is inGuestPatch.

  • properties - (Optional) A mapping of properties to assign to the resource.

  • tags - (Optional) A mapping of tags to assign to the resource. The key could not contain upper case letter.


A window block supports:

  • startDateTime - (Required) Effective start date of the maintenance window in YYYY-MM-DD hh:mm format.

  • expirationDateTime - (Optional) Effective expiration date of the maintenance window in YYYY-MM-DD hh:mm format.

  • duration - (Optional) The duration of the maintenance window in HH:mm format.

  • timeZone - (Required) The time zone for the maintenance window. A list of timezones can be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell.

  • recurEvery - (Optional) The rate at which a maintenance window is expected to recur. The rate can be expressed as daily, weekly, or monthly schedules.


A installPatches block supports:

  • linux - (Optional) A linux block as defined above. This property only applies when scope is set to inGuestPatch

  • windows - (Optional) A windows block as defined above. This property only applies when scope is set to inGuestPatch

  • reboot - (Optional) Possible reboot preference as defined by the user based on which it would be decided to reboot the machine or not after the patch operation is completed. Possible values are always, ifRequired and never. This property only applies when scope is set to inGuestPatch.


A linux block supports:

  • classificationsToInclude - (Optional) List of Classification category of patches to be patched. Possible values are critical, security and other.

  • packageNamesMaskToExclude - (Optional) List of package names to be excluded from patching.

  • packageNamesMaskToInclude - (Optional) List of package names to be included for patching.


A windows block supports:

  • classificationsToInclude - (Optional) List of Classification category of patches to be patched. Possible values are critical, security, updateRollup, featurePack, servicePack, definition, tools and updates.

  • kbNumbersToExclude - (Optional) List of KB numbers to be excluded from patching.

  • kbNumbersToInclude - (Optional) List of KB numbers to be included for patching.


Attributes Reference

The following attributes are exported:

  • id - The ID of the Maintenance Configuration.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Maintenance Configuration.
  • update - (Defaults to 30 minutes) Used when updating the Maintenance Configuration.
  • read - (Defaults to 5 minutes) Used when retrieving the Maintenance Configuration.
  • delete - (Defaults to 30 minutes) Used when deleting the Maintenance Configuration.

Import

Maintenance Configuration can be imported using the resourceId, e.g.

terraform import azurerm_maintenance_configuration.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Maintenance/maintenanceConfigurations/example-mc