Azure / terraform-azurerm-avm-res-compute-virtualmachinescaleset

MIT License
1 stars 7 forks source link

terraform-azurerm-avm-res-compute-virtualmachinescaleset

Major version Zero (0.y.z) is for initial development. Anything MAY change at any time. A module SHOULD NOT be considered stable till at least it is major version one (1.0.0) or greater. Changes will always be via new versions being published and no changes will be made to existing published versions. For more details please go to https://semver.org/

Note: This AVM will only deploy Azure Virtual Machine Scale Sets in Orchestrated mode. Please see this reliability guidance for more information: Deploy VMs with flexible orchestration mode

Requirements

The following requirements are needed by this module:

Providers

The following providers are used by this module:

Resources

The following resources are used by this module:

Required Inputs

The following input variables are required:

admin_password

Description: (Optional) Sets the VM password

Type: string

admin_ssh_keys

Description: (Optional) SSH Keys to be used for Linx instances

Type:

set(object({
    id         = string
    public_key = string
    username   = string
  }))

extension

Description: - auto_upgrade_minor_version_enabled - (Optional) Should the latest version of the Extension be used at Deployment Time, if one is available? This won't auto-update the extension on existing installation. Defaults to true.

Note: Operational failures such as not connecting to the VM will not be suppressed regardless of the failure_suppression_enabled value.

A Health Extension is deployed by default as per WAF guidelines.

Note: protected_settings_from_key_vault cannot be used with protected_settings

Type:

set(object({
    auto_upgrade_minor_version_enabled        = optional(bool)
    extensions_to_provision_after_vm_creation = optional(set(string))
    failure_suppression_enabled               = optional(bool)
    force_extension_execution_on_change       = optional(string)
    name                                      = string
    publisher                                 = string
    settings                                  = optional(string)
    type                                      = string
    type_handler_version                      = string
    protected_settings_from_key_vault = optional(object({
      secret_url      = string
      source_vault_id = string
    }), null)
  }))

extension_protected_setting

Description: (Optional) A JSON String which specifies Sensitive Settings (such as Passwords) for the Extension.

Type: map(string)

location

Description: (Required) The Azure location where the Orchestrated Virtual Machine Scale Set should exist. Changing this forces a new resource to be created.

Type: string

name

Description: (Required) The name of the Orchestrated Virtual Machine Scale Set. Changing this forces a new resource to be created.

Type: string

platform_fault_domain_count

Description: (Required) Specifies the number of fault domains that are used by this Orchestrated Virtual Machine Scale Set. Changing this forces a new resource to be created.

Type: number

resource_group_name

Description: (Required) The name of the Resource Group in which the Orchestrated Virtual Machine Scale Set should exist. Changing this forces a new resource to be created.

Type: string

user_data_base64

Description: (Optional) The Base64-Encoded User Data which should be used for this Virtual Machine Scale Set.

Type: string

Optional Inputs

The following input variables are optional (have default values):

additional_capabilities

Description: - ultra_ssd_enabled - (Optional) Should the capacity to enable Data Disks of the UltraSSD_LRS storage account type be supported on this Orchestrated Virtual Machine Scale Set? Defaults to false. Changing this forces a new resource to be created.

Type:

object({
    ultra_ssd_enabled = optional(bool)
  })

Default: null

automatic_instance_repair

Description: Description: Enabling automatic instance repair allows VMSS to automatically detect and recover unhealthy VM instances at runtime, ensuring high application availability

Note: To enable the automatic_instance_repair, the Orchestrated Virtual Machine Scale Set must have a valid health_probe_id or an Application Health Extension. Defaulted to true as per this reliability recommendation: Enable automatic repair policy

Type:

object({
    enabled      = bool
    grace_period = optional(string)
  })

Default:

{
  "enabled": true
}

boot_diagnostics

Description: - storage_account_uri - (Optional) The Primary/Secondary Endpoint for the Azure Storage Account which should be used to store Boot Diagnostics, including Console Output and Screenshots from the Hypervisor. By including a boot_diagnostics block without passing the storage_account_uri field will cause the API to utilize a Managed Storage Account to store the Boot Diagnostics output.

Type:

object({
    storage_account_uri = optional(string)
  })

Default: null

capacity_reservation_group_id

Description: (Optional) Specifies the ID of the Capacity Reservation Group which the Virtual Machine Scale Set should be allocated to. Changing this forces a new resource to be created.

Note: capacity_reservation_group_id cannot be specified with proximity_placement_group_id. If capacity_reservation_group_id is specified the single_placement_group must be set to false.

Type: string

Default: null

data_disk

Description: - caching - (Required) The type of Caching which should be used for this Data Disk. Possible values are None, ReadOnly and ReadWrite.

Note: Disk Encryption Sets are in Public Preview in a limited set of regions.

Type:

set(object({
    caching                        = string
    create_option                  = optional(string)
    disk_encryption_set_id         = optional(string)
    disk_size_gb                   = number
    lun                            = number
    storage_account_type           = string
    ultra_ssd_disk_iops_read_write = optional(number)
    ultra_ssd_disk_mbps_read_write = optional(number)
    write_accelerator_enabled      = optional(bool)
  }))

Default: null

enable_telemetry

Description: -> This is a Note
This variable controls whether or not telemetry is enabled for the module.
For more information see https://aka.ms/avm/telemetryinfo.
If it is set to false, then no telemetry will be collected.

Type: bool

Default: true

encryption_at_host_enabled

Description: (Optional) Should disks attached to this Virtual Machine Scale Set be encrypted by enabling Encryption at Host?.

Type: bool

Default: null

eviction_policy

Description: (Optional) The Policy which should be used Virtual Machines are Evicted from the Scale Set. Possible values are Deallocate and Delete. Changing this forces a new resource to be created.

Type: string

Default: null

extension_operations_enabled

Description: > Note: extension_operations_enabled may only be set to false if there are no extensions defined in the extension field. (Optional) Should extension operations be allowed on the Virtual Machine Scale Set? Possible values are true or false. Defaults to true. Changing this forces a new Orchestrated Virtual Machine Scale Set to be created.

Type: bool

Default: null

extensions_time_budget

Description: (Optional) Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. Defaults to PT1H30M.

Type: string

Default: null

identity

Description: - identity_ids - (Required) Specifies a set of User Managed Identity IDs to be assigned to this Orchestrated Windows Virtual Machine Scale Set.

Type:

object({
    identity_ids = set(string)
    type         = string
  })

Default: null

instances

Description: (Optional) The number of Virtual Machines in the Orcestrated Virtual Machine Scale Set.

Type: number

Default: null

license_type

Description: (Optional) Specifies the type of on-premise license (also known as Azure Hybrid Use Benefit) which should be used for this Orchestrated Virtual Machine Scale Set. Possible values are None, Windows_Client and Windows_Server.

Type: string

Default: null

lock

Description: Controls the Resource Lock configuration for this resource. The following properties can be specified:

Type:

object({
    kind = string
    name = optional(string, null)
  })

Default: null

max_bid_price

Description: (Optional) The maximum price you're willing to pay for each Orchestrated Virtual Machine in this Scale Set, in US Dollars; which must be greater than the current spot price. If this bid price falls below the current spot price the Virtual Machines in the Scale Set will be evicted using the eviction_policy. Defaults to -1, which means that each Virtual Machine in the Orchestrated Scale Set should not be evicted for price reasons. See this reference for more details: Pricing

Type: number

Default: -1

network_interface

Description: - dns_servers - (Optional) A set of IP Addresses of DNS Servers which should be assigned to the Network Interface.

Note: When using this field you'll also need to configure a Rule for the Load Balancer, and use a depends_on between this resource and the Load Balancer Rule.

Note: subnet_id is required if version is set to IPv4.

Type:

set(object({
    dns_servers                   = optional(set(string))
    enable_accelerated_networking = optional(bool)
    enable_ip_forwarding          = optional(bool)
    name                          = string
    network_security_group_id     = optional(string)
    primary                       = optional(bool)
    ip_configuration = set(object({
      application_gateway_backend_address_pool_ids = optional(set(string))
      application_security_group_ids               = optional(set(string))
      load_balancer_backend_address_pool_ids       = optional(set(string))
      name                                         = string
      primary                                      = optional(bool)
      subnet_id                                    = optional(string)
      version                                      = optional(string)
      public_ip_address = optional(set(object({
        domain_name_label       = optional(string)
        idle_timeout_in_minutes = optional(number)
        name                    = string
        public_ip_prefix_id     = optional(string)
        sku_name                = optional(string)
        version                 = optional(string)
        ip_tag = optional(set(object({
          tag  = string
          type = string
        })))
      })))
    }))
  }))

Default: null

os_disk

Description: - caching - (Required) The Type of Caching which should be used for the Internal OS Disk. Possible values are None, ReadOnly and ReadWrite.


diff_disk_settings block supports the following:

Type:

object({
    caching                   = string
    disk_encryption_set_id    = optional(string)
    disk_size_gb              = optional(number)
    storage_account_type      = string
    write_accelerator_enabled = optional(bool)
    diff_disk_settings = optional(object({
      option    = string
      placement = optional(string)
    }))
  })

Default:

{
  "caching": "ReadWrite",
  "storage_account_type": "Premium_LRS"
}

os_profile

Description: Configure the operating system provile.

Note: Either admin_password or admin_ssh_key must be specified.

Note: If the patch_assessment_mode is set to AutomaticByPlatform then the provision_vm_agent field must be set to true.

Note: If patch_mode is set to AutomaticByPlatform the provision_vm_agent must be set to true and the extension must contain at least one application health extension.


windows_configuration block supports the following:

Note: Hotpatching can only be enabled if the patch_mode is set to AutomaticByPlatform, the provision_vm_agent is set to true, your source_image_reference references a hotpatching enabled image, the VM's sku_name is set to a Azure generation 2 VM SKU and the extension contains an application health extension.

Note: If the patch_assessment_mode is set to AutomaticByPlatform then the provision_vm_agent field must be set to true.

Note: If patch_mode is set to AutomaticByPlatform the provision_vm_agent must be set to true and the extension must contain at least one application health extension.

Note: This can be sourced from the secret_id field within the azurerm_key_vault_certificate Resource.

Type:

object({
    custom_data = optional(string)
    linux_configuration = optional(object({
      admin_username                  = string
      computer_name_prefix            = optional(string)
      disable_password_authentication = optional(bool)
      patch_assessment_mode           = optional(string)
      patch_mode                      = optional(string, "AutomaticByPlatform")
      provision_vm_agent              = optional(bool, true)
      admin_ssh_key_id                = optional(set(string))
      secret = optional(set(object({
        key_vault_id = string
        certificate = set(object({
          url = string
        }))
      })))
    }))
    windows_configuration = optional(object({
      admin_username           = string
      computer_name_prefix     = optional(string)
      enable_automatic_updates = optional(bool, true)
      hotpatching_enabled      = optional(bool)
      patch_assessment_mode    = optional(string)
      patch_mode               = optional(string, "AutomaticByPlatform")
      provision_vm_agent       = optional(bool, true)
      timezone                 = optional(string)
      secret = optional(set(object({
        key_vault_id = string
        certificate = set(object({
          store = string
          url   = string
        }))
      })))
      winrm_listener = optional(set(object({
        certificate_url = optional(string)
        protocol        = string
      })))
    }))
  })

Default: null

plan

Description: - name - (Required) Specifies the name of the image from the marketplace. Changing this forces a new resource to be created.

Type:

object({
    name      = string
    product   = string
    publisher = string
  })

Default: null

priority

Description: (Optional) The Priority of this Orchestrated Virtual Machine Scale Set. Possible values are Regular and Spot. Defaults to Regular. Changing this value forces a new resource.

Type: string

Default: "Regular"

priority_mix

Description: - base_regular_count - (Optional) Specifies the base number of VMs of Regular priority that will be created before any VMs of priority Spot are created. Possible values are integers between 0 and 1000. Defaults to 0.

Type:

object({
    base_regular_count            = optional(number)
    regular_percentage_above_base = optional(number)
  })

Default: null

proximity_placement_group_id

Description: (Optional) The ID of the Proximity Placement Group which the Orchestrated Virtual Machine should be assigned to. Changing this forces a new resource to be created.

Type: string

Default: null

role_assignments

Description: A map of role assignments to create on the . The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.

Type:

map(object({
    role_definition_id_or_name             = string
    principal_id                           = string
    description                            = optional(string, null)
    skip_service_principal_aad_check       = optional(bool, false)
    condition                              = optional(string, null)
    condition_version                      = optional(string, null)
    delegated_managed_identity_resource_id = optional(string, null)
    principal_type                         = optional(string, null)
  }))

Default: {}

single_placement_group

Description: (Optional) Should this Virtual Machine Scale Set be limited to a Single Placement Group, which means the number of instances will be capped at 100 Virtual Machines. Possible values are true or false.

Note: single_placement_group behaves differently for Orchestrated Virtual Machine Scale Sets than it does for other Virtual Machine Scale Sets. If you do not define the single_placement_group field in your configuration file the service will determin what this value should be based off of the value contained within the sku_name field of your configuration file. You may set the single_placement_group field to true, however once you set it to false you will not be able to revert it back to true. If you wish to use Specialty Sku virtual machines (e.g. M-Seiries virtual machines) you will need to contact you Microsoft support professional and request to be added to the include list since this feature is currently in private preview until the end of September 2022. Once you have been added to the private preview include list you will need to run the following command to register your subscription with the feature: az feature register --namespace Microsoft.Compute --name SpecialSkusForVmssFlex. If you are not on the include list this command will error out with the following error message (featureRegistrationUnsupported) The feature 'SpecialSkusForVmssFlex' does not support registration.

Type: bool

Default: null

sku_name

Description: (Optional) The name of the SKU to be used by this Orcestrated Virtual Machine Scale Set. Valid values include: any of the General purpose, Compute optimized, Memory optimized, Storage optimized, GPU optimized, FPGA optimized, High performance, or Previous generation virtual machine SKUs.

Type: string

Default: null

source_image_id

Description: (Optional) The ID of an Image which each Virtual Machine in this Scale Set should be based on. Possible Image ID types include Image IDs, Shared Image IDs, Shared Image Version IDs, Community Gallery Image IDs, Community Gallery Image Version IDs, Shared Gallery Image IDs and Shared Gallery Image Version IDs.

Type: string

Default: null

source_image_reference

Description: - offer - (Required) Specifies the offer of the image used to create the virtual machines. Changing this forces a new resource to be created.

Type:

object({
    offer     = string
    publisher = string
    sku       = string
    version   = string
  })

Default: null

tags

Description: (Optional) Tags of the resource.

Type: map(string)

Default: null

termination_notification

Description: - enabled - (Required) Should the termination notification be enabled on this Virtual Machine Scale Set? Possible values true or false

Type:

object({
    enabled = bool
    timeout = optional(string)
  })

Default: null

timeouts

Description: - create - (Defaults to 60 minutes) Used when creating the Orchestrated Virtual Machine Scale Set.

Type:

object({
    create = optional(string)
    delete = optional(string)
    read   = optional(string)
    update = optional(string)
  })

Default: null

zone_balance

Description: (Optional) Should the Virtual Machines in this Scale Set be strictly evenly distributed across Availability Zones? Defaults to false. Changing this forces a new resource to be created.

Note: This can only be set to true when one or more zones are configured.

Type: bool

Default: null

zones

Description: Specifies a list of Availability Zones in which this Orchestrated Virtual Machine should be located. Changing this forces a new Orchestrated Virtual Machine to be created. Defaulted to 3 zones as per this reliability guidance: Deploy Virtual Machine Scale Sets across availability zones with Virtual Machine Scale Sets Flex

Note: Due to a limitation of the Azure API at this time only one Availability Zone can be defined.

Type: set(string)

Default:

[
  "1",
  "2",
  "3"
]

Outputs

The following outputs are exported:

resource

Description: All attributes of the Virtual Machine Scale Set resource.

resource_id

Description: The ID of the Virtual Machine Scale Set.

resource_name

Description: The name of the Virtual Machine Scale Set.

Modules

No modules.

Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.