Skip to content

Azure/terraform-azure-avm-utl-compute-linuxvirtualmachine-azapi-replicator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

terraform-azure-avm-utl-compute-linuxvirtualmachine-azapi-replicator

This Azure Verified Module (AVM) utility module provides a migration path from azurerm_linux_virtual_machine resource to the generic azapi_resource provider. It acts as a replicator that accepts the same input variables as the AzureRM provider and outputs the necessary configurations for AzAPI resource deployment.

Purpose

This module is designed to:

  • Facilitate migration from AzureRM provider to AzAPI provider for subnet resources
  • Maintain compatibility with existing azurerm_linux_virtual_machine configurations
  • Generate AzAPI outputs including resource headers, body, locks, and sensitive data

Key Features

  • Full feature parity with azurerm_linux_virtual_machine resource
  • Schema validation disabled to support all Azure API fields including read-only properties
  • Automatic state migration support via output configurations
  • Comprehensive validation for input parameters
  • Telemetry support (opt-in/opt-out)
  • Lock management for safe concurrent operations

Requirements

The following requirements are needed by this module:

Resources

The following resources are used by this module:

Required Inputs

The following input variables are required:

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

Type: string

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

Type: string

Description: (Required). A list of Network Interface IDs which should be attached to this Virtual Machine. The first Network Interface ID in this list will be the Primary Network Interface on the Virtual Machine.

Type: list(string)

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

  • disk_encryption_set_id - (Optional) The ID of the Disk Encryption Set which should be used to Encrypt this OS Disk. Conflicts with secure_vm_disk_encryption_set_id.
  • disk_size_gb - (Optional) The Size of the Internal OS Disk in GB, if you wish to vary from the size used in the image this Virtual Machine is sourced from.
  • name - (Optional) The name which should be used for the Internal OS Disk. Changing this forces a new resource to be created.
  • secure_vm_disk_encryption_set_id - (Optional) The ID of the Disk Encryption Set which should be used to Encrypt this OS Disk when the Virtual Machine is a Confidential VM. Conflicts with disk_encryption_set_id. Changing this forces a new resource to be created.
  • security_encryption_type - (Optional) Encryption Type when the Virtual Machine is a Confidential VM. Possible values are VMGuestStateOnly and DiskWithVMGuestState. Changing this forces a new resource to be created.
  • storage_account_type - (Optional) The Type of Storage Account which should back this the Internal OS Disk. Possible values are Standard_LRS, StandardSSD_LRS, Premium_LRS, StandardSSD_ZRS and Premium_ZRS. Changing this forces a new resource to be created.
  • write_accelerator_enabled - (Optional) Should Write Accelerator be Enabled for this OS Disk? Defaults to false.

diff_disk_settings block supports the following:

  • option - (Required) Specifies the Ephemeral Disk Settings for the OS Disk. At this time the only possible value is Local. Changing this forces a new resource to be created.
  • placement - (Optional) Specifies where to store the Ephemeral Disk. Possible values are CacheDisk, ResourceDisk and NvmeDisk. Defaults to CacheDisk. Changing this forces a new resource to be created.

Type:

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

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

Type: string

Description: (Required) The SKU which should be used for this Virtual Machine, such as Standard_F2.

Type: string

Optional Inputs

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

Description: - hibernation_enabled - (Optional) Whether to enable the hibernation capability or not.

  • ultra_ssd_enabled - (Optional) Should the capacity to enable Data Disks of the UltraSSD_LRS storage account type be supported on this Virtual Machine? Defaults to false.

Type:

object({
    hibernation_enabled = optional(bool, false)
    ultra_ssd_enabled   = optional(bool, false)
  })

Default: null

Description: (Optional) The Password which should be used for the local-administrator on this Virtual Machine. Changing this forces a new resource to be created.

Type: string

Default: null

Description: (Optional) Version tracking for admin_password. Must be set when admin_password is provided.

Type: number

Default: null

Description: - public_key - (Required) The Public Key which should be used for authentication, which needs to be in ssh-rsa format with at least 2048-bit or in ssh-ed25519 format. Changing this forces a new resource to be created.

  • username - (Required) The Username for which this Public SSH Key should be configured. Changing this forces a new resource to be created.

Type:

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

Default: null

Description: (Optional) The username of the local administrator used for the Virtual Machine. Changing this forces a new resource to be created.

Type: string

Default: null

Description: (Optional) Should Extension Operations be allowed on this Virtual Machine? Defaults to true.

Type: bool

Default: true

Description: (Optional) Specifies the ID of the Availability Set in which the Virtual Machine should exist. Changing this forces a new resource to be created.

Type: string

Default: null

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.

Type:

object({
    storage_account_uri = optional(string)
  })

Default: null

Description: (Optional) Specifies whether to skip platform scheduled patching when a user schedule is associated with the VM. Defaults to false.

Type: bool

Default: false

Description: (Optional) Specifies the ID of the Capacity Reservation Group which the Virtual Machine should be allocated to.

Type: string

Default: null

Description: (Optional) Specifies the Hostname which should be used for this Virtual Machine. If unspecified this defaults to the value for the name field. If the value of the name field is not a valid computer_name, then you must specify computer_name. Changing this forces a new resource to be created.

Type: string

Default: null

Description: (Optional) The Base64-Encoded Custom Data which should be used for this Virtual Machine. Changing this forces a new resource to be created.

Type: string

Default: null

Description: (Optional) Version tracking for custom_data. Must be set when custom_data is provided.

Type: number

Default: null

Description: (Optional) The ID of a Dedicated Host Group that this Linux Virtual Machine should be run within. Conflicts with dedicated_host_id.

Type: string

Default: null

Description: (Optional) The ID of a Dedicated Host where this machine should be run on. Conflicts with dedicated_host_group_id.

Type: string

Default: null

Description: (Optional) Should Password Authentication be disabled on this Virtual Machine? Changing this forces a new resource to be created.

Type: bool

Default: null

Description: (Optional) Specifies the Disk Controller Type used for this Virtual Machine. Possible values are SCSI and NVMe.

Type: string

Default: null

Description: (Optional) Specifies the Edge Zone within the Azure Region where this Linux Virtual Machine should exist. Changing this forces a new Linux Virtual Machine to be created.

Type: string

Default: null

Description: 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

Description: (Optional) Should all of the disks (including the temp disk) attached to this Virtual Machine be encrypted by enabling Encryption at Host?

Type: bool

Default: null

Description: (Optional) Specifies what should happen when the Virtual Machine is evicted for price reasons when using a Spot instance. Possible values are Deallocate and Delete. Changing this forces a new resource to be created.

Type: string

Default: null

Description: (Optional) Specifies the duration allocated 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: "PT1H30M"

Description: - automatic_upgrade_enabled - (Optional) Specifies whether the version will be automatically updated for the VM when a new Gallery Application version is available in PIR/SIG. Defaults to false.

  • configuration_blob_uri - (Optional) Specifies the URI to an Azure Blob that will replace the default configuration for the package if provided.
  • order - (Optional) Specifies the order in which the packages have to be installed. Possible values are between 0 and 2147483647. Defaults to 0.
  • tag - (Optional) Specifies a passthrough value for more generic context. This field can be any valid string value.
  • treat_failure_as_deployment_failure_enabled - (Optional) Specifies whether any failure for any operation in the VmApplication will fail the deployment of the VM. Defaults to false.
  • version_id - (Required) Specifies the Gallery Application Version resource ID.

Type:

list(object({
    automatic_upgrade_enabled                   = optional(bool, false)
    configuration_blob_uri                      = optional(string)
    order                                       = optional(number)
    tag                                         = optional(string)
    treat_failure_as_deployment_failure_enabled = optional(bool, false)
    version_id                                  = string
  }))

Default: null

Description: - identity_ids - (Optional) Specifies a list of User Assigned Managed Identity IDs to be assigned to this Linux Virtual Machine.

  • type - (Required) Specifies the type of Managed Service Identity that should be configured on this Linux Virtual Machine. Possible values are SystemAssigned, UserAssigned, SystemAssigned, UserAssigned (to enable both).

Type:

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

Default: null

Description: (Optional) Specifies the License Type for this Virtual Machine. Possible values are RHEL_BYOS, RHEL_BASE, RHEL_EUS, RHEL_SAPAPPS, RHEL_SAPHA, RHEL_BASESAPAPPS, RHEL_BASESAPHA, SLES_BYOS, SLES_SAP, SLES_HPC, UBUNTU_PRO.

Type: string

Default: null

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

Type: number

Default: -1

Description: - timeout - (Optional) Length of time a notification to be sent to the VM on the instance metadata server till the VM gets OS upgraded. The only possible value is PT15M. Defaults to PT15M.

Type:

object({
    timeout = optional(string, "PT15M")
  })

Default: null

Description: (Optional) The ID of an existing OS Managed Disk which should be attached to this Virtual Machine. When using this field you must also specify os_disk.caching. Conflicts with source_image_id and source_image_reference.

Type: string

Default: null

Description: (Optional) Specifies the mode of VM Guest Patching for the Virtual Machine. Possible values are AutomaticByPlatform or ImageDefault. Defaults to ImageDefault.

Type: string

Default: null

Description: (Optional) Specifies the mode of in-guest patching to this Linux Virtual Machine. Possible values are AutomaticByPlatform and ImageDefault. Defaults to ImageDefault. For more information on patch modes please see the product documentation.

Type: string

Default: "ImageDefault"

Description: - name - (Required) Specifies the Name of the Marketplace Image this Virtual Machine should be created from. Changing this forces a new resource to be created.

  • product - (Required) Specifies the Product of the Marketplace Image this Virtual Machine should be created from. Changing this forces a new resource to be created.
  • publisher - (Required) Specifies the Publisher of the Marketplace Image this Virtual Machine should be created from. Changing this forces a new resource to be created.

Type:

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

Default: null

Description: (Optional) Specifies the Platform Fault Domain in which this Linux Virtual Machine should be created. Defaults to -1, which means this will be automatically assigned to a fault domain that best maintains balance across the available fault domains. Changing this forces a new Linux Virtual Machine to be created.

Type: number

Default: -1

Description: (Optional) Specifies the priority of this Virtual Machine. Possible values are Regular and Spot. Defaults to Regular. Changing this forces a new resource to be created.

Type: string

Default: "Regular"

Description: (Optional) Should the Azure VM Agent be provisioned on this Virtual Machine? Defaults to true. Changing this forces a new resource to be created.

Type: bool

Default: true

Description: (Optional) The ID of the Proximity Placement Group which the Virtual Machine should be assigned to.

Type: string

Default: null

Description: (Optional) Specifies the reboot setting for platform scheduled patching. Possible values are Always, IfRequired and Never.

Type: string

Default: null

Description: - key_vault_id - (Required) The ID of the Key Vault from which all Secrets should be sourced.


certificate block supports the following:

  • url - (Required) The Secret URL of a Key Vault Certificate.

Type:

list(object({
    key_vault_id = string
    certificate = set(object({
      url = string
    }))
  }))

Default: null

Description: (Optional) Specifies whether secure boot should be enabled on the virtual machine. Changing this forces a new resource to be created.

Type: bool

Default: null

Description: (Optional) The ID of the Image which this Virtual Machine should be created from. Changing this forces a new resource to be created. 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

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

  • publisher - (Required) Specifies the publisher of the image used to create the virtual machines. Changing this forces a new resource to be created.
  • sku - (Required) Specifies the SKU of the image used to create the virtual machines. Changing this forces a new resource to be created.
  • version - (Required) Specifies the version 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

Description: (Optional) A mapping of tags which should be assigned to this Virtual Machine.

Type: map(string)

Default: null

Description: - enabled - (Required) Should the termination notification be enabled on this Virtual Machine?

  • timeout - (Optional) Length of time (in minutes, between 5 and 15) a notification to be sent to the VM on the instance metadata server till the VM gets deleted. The time duration should be specified in ISO 8601 format. Defaults to PT5M.

Type:

object({
    enabled = bool
    timeout = optional(string, "PT5M")
  })

Default: null

Description: - create - (Optional) Specifies the timeout for create operations. Defaults to 45 minutes.

  • delete - (Optional) Specifies the timeout for delete operations. Defaults to 45 minutes.
  • read - (Optional) Specifies the timeout for read operations. Defaults to 5 minutes.
  • update - (Optional) Specifies the timeout for update operations. Defaults to 45 minutes.

Type:

object({
    create = optional(string, "45m")
    delete = optional(string, "45m")
    read   = optional(string, "5m")
    update = optional(string, "45m")
  })

Default:

{
  "create": "45m",
  "delete": "45m",
  "read": "5m",
  "update": "45m"
}

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

Type: string

Default: null

Description: (Optional) Specifies the Orchestrated Virtual Machine Scale Set that this Virtual Machine should be created within.

Type: string

Default: null

Description: (Optional) Specifies whether vTPM should be enabled on the virtual machine. Changing this forces a new resource to be created.

Type: bool

Default: null

Description: (Optional) Specifies the Availability Zones in which this Linux Virtual Machine should be located. Changing this forces a new Linux Virtual Machine to be created.

Type: string

Default: null

Outputs

The following outputs are exported:

Description: n/a

Description: n/a

Description: n/a

Description: n/a

Description: n/a

Description: n/a

Description: n/a

Description: n/a

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.

About

Terraform Azure Verified Utility Module for avm-utl-compute-linuxvirtualmachine-azapi-replicator

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages