Browse Source

add new resources

tags/1.0.0
ravi 2 months ago
parent
commit
c3d3ca539e
23 changed files with 629 additions and 623 deletions
  1. +69
    -42
      README.md
  2. +0
    -9
      data.tf
  3. +2
    -2
      examples/default/README.md
  4. +25
    -9
      examples/default/deploy.tf
  5. +2
    -2
      examples/default/outputs.tf
  6. +5
    -1
      examples/default/providers.tf
  7. +1
    -1
      examples/disabled/README.md
  8. +1
    -1
      examples/disabled/outputs.tf
  9. +5
    -1
      examples/disabled/providers.tf
  10. +0
    -70
      examples/external-resources/deploy.tf
  11. +0
    -8
      examples/external-resources/providers.tf
  12. +2
    -2
      examples/linux_default/README.md
  13. +93
    -0
      examples/linux_default/deploy.tf
  14. +2
    -2
      examples/linux_default/outputs.tf
  15. +5
    -1
      examples/linux_default/providers.tf
  16. +0
    -0
      examples/linux_default/variables.tf
  17. +0
    -47
      examples/x-vms-x-disks-x-netint/README.md
  18. +0
    -147
      examples/x-vms-x-disks-x-netint/deploy.tf
  19. +0
    -27
      examples/x-vms-x-disks-x-netint/outputs.tf
  20. +0
    -15
      examples/x-vms-x-disks-x-netint/variables.tf
  21. +117
    -100
      main.tf
  22. +3
    -3
      outputs.tf
  23. +297
    -133
      variables.tf

+ 69
- 42
README.md View File

@@ -29,38 +29,55 @@ See `examples` folders for usage of this module.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| additional\_capabilities\_ultra\_ssd\_enabled | Should Ultra SSD disk be enabled for this Virtual Machine? | `bool` | `false` | no |
| additional\_unattend\_config\_content | Specifies the base-64 encoded XML formatted content that is added to the unattend.xml file for the specified path and component. | `string` | `""` | no |
| additional\_unattend\_config\_setting\_name | Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. | `string` | `"FirstLogonCommands"` | no |
| additional\_unattend\_content\_windows\_content | Specifies the base-64 encoded XML formatted content that is added to the unattend.xml file for the specified path and component. | `string` | `""` | no |
| additional\_unattend\_content\_windows\_setting | Specifies the name of the setting to which the content applies. Possible values are: `FirstLogonCommands` and `AutoLogon`. | `string` | `"FirstLogonCommands"` | no |
| allow\_extension\_operations | Boolean flag whcih provides the information about should the extension operations be allowed on the virtual machine? Chaning this forces a new resource to be created. | `bool` | `true` | no |
| availability\_set\_enabled | Whether or not to create an availability set. | `bool` | `true` | no |
| availability\_set\_exists | If defined, the existing availability set will be used by virtual machines instead of creating a new availability set inside this module. | `bool` | `false` | no |
| availability\_set\_managed | Specifies whether the availability set is managed or not. Possible values are true (to specify aligned) or false (to specify classic). | `bool` | `true` | no |
| availability\_set\_name | Specifies the name of the availability set. Changing this forces a new resource to be created. | `string` | `""` | no |
| availability\_set\_platform\_fault\_domain\_count | Specifies the number of fault domains that are used. | `number` | `2` | no |
| availability\_set\_platform\_update\_domain\_count | Specifies the number of update domains that are used. | `number` | `5` | no |
| availability\_set\_proximity\_placement\_group\_id | The ID of the proximity placement group to which the virtual machine should be assigned. Changing this forces a new resource to be created. | `string` | `""` | no |
| availability\_set\_tags | Tags specific to the availability set. | `map` | `{}` | no |
| boot\_diagnostics\_enabled | Should Boot Diagnostics be enabled for this Virtual Machine? | `bool` | `false` | no |
| boot\_diagnostics\_storage\_uri | The Storage Account's Blob Endpoint which should hold the virtual machine's diagnostic files. | `string` | `""` | no |
| delete\_data\_disks\_on\_termination | Should the Data Disks (either the Managed Disks / VHD Blobs) be deleted when the Virtual Machine is destroyed? | `bool` | `false` | no |
| delete\_os\_disk\_on\_termination | Should the OS Disk (either the Managed Disk / VHD Blob) be deleted when the Virtual Machine is destroyed? | `bool` | `false` | no |
| boot\_diagnostics\_enabled | Boolean flag which describes whether or not enable the boot diagnostics setting for the virtual machine. | `bool` | `false` | no |
| boot\_diagnostics\_storage\_account\_uri | The Storage Account's Blob Endpoint which should hold the virtual machine's diagnostic files. | `string` | `""` | no |
| certificate\_url | The Secret URL of the Key vault certificate. | `string` | `""` | no |
| computer\_names | Specifies the hostname which should be used for the virtual machine.If unspecified this defaults to the value of `vm_names` filed. Changing this forces a new resource to be created. | `list(string)` | <pre>[<br> null<br>]</pre> | no |
| custom\_data | The Base64-Encoded custom data which should be used for the virtual machine. Changing this forces a new resource to be created. | `any` | `null` | no |
| dedicated\_host\_enabled | Boolean flag which describes whether the Decicated host id enabled or not. | `bool` | `false` | no |
| dedicated\_host\_ids | The list IDs of a dedicated host where th emachien should be run on. Changing this forces a new resource to be created. | `list(string)` | <pre>[<br> null<br>]</pre> | no |
| diff\_disk\_settings\_option | 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. | `string` | `""` | no |
| enabled | Enable or disable module | `bool` | `true` | no |
| license\_type | Specifies the BYOL Type for this Virtual Machine. This is only applicable to Windows Virtual Machines. Possible values are Windows\_Client and Windows\_Server. | `string` | `"Windows_Server"` | no |
| machine\_extension\_name | The name of the virtual machine extension peering. Changing this forces a new resource to be created. | `string` | `"machine-ext"` | no |
| managed\_disk\_cachings | Specifies the caching requirements for the Managed Disks. Possible values include None, ReadOnly and ReadWrite. | `list(string)` | <pre>[<br> "ReadWrite"<br>]</pre> | no |
| eviction\_policy | Specifies what should happen when the virtual machine is evicted for the price reason when using the spot instance. At this time only supported value is `Deallocate`. Changing this forces a new resource to be created. | `string` | `"Deallocate"` | no |
| identity\_identity\_ids | A list of list of User managed identity ID's which should be assigned to the virtual machine. | `list(list(string))` | <pre>[<br> null<br>]</pre> | no |
| identity\_types | The list of types of Managed identity which should be assigned to the virtual machine. Possible values are `systemassigned`, `UserAssigned` and `SustemAssigned,UserAssigned`. | `list` | <pre>[<br> ""<br>]</pre> | no |
| linux\_admin\_password | The linux virtual machine password associated with the local administrator account. `NOTE`: When an admin\_password is specified disable\_password\_authentication must be set to `false`. | `string` | `""` | no |
| linux\_admin\_ssh\_keys | One or more admin ssh\_key blocks. `NOTE`: One of either `admin_password` or `admin_ssh_key must be specified`. | `list(object({ public_key = string, username = string }))` | <pre>[<br> null<br>]</pre> | no |
| linux\_admin\_username | Specifies the name of the linux virtual machine local administrator account. | `string` | `"testadmin"` | no |
| linux\_vm\_enabled | Boolean flag which describes whether or not enable the linux virtual machine resource. | `bool` | `false` | no |
| managed\_data\_disk\_cachings | Specifies the caching requirements for the Managed Disks. Possible values include None, ReadOnly and ReadWrite. | `list(string)` | <pre>[<br> "ReadWrite"<br>]</pre> | no |
| managed\_data\_disk\_create\_options | Specifies the list of create option of the data disk such as `Empty` or `Attach`. Defaults to `Attach`. Changing this forces a new resource to be created. | `list(string)` | <pre>[<br> "Attach"<br>]</pre> | no |
| managed\_data\_disk\_write\_accelerator\_enableds | Specifies if Write Accelerator is enabled on Managed Disks. This can only be enabled on Premium\_LRS managed disks with no caching and M-Series VMs. | `list(bool)` | <pre>[<br> false<br>]</pre> | no |
| managed\_disk\_count | How many additional managed disk to attach to EACH Virtual Machines. | `number` | `0` | no |
| managed\_disk\_create\_options | The methods to use when creating the Managed Disks. Possible values include: Empty, FromImage, Copy, Import, Restore. | `list(string)` | <pre>[<br> "Empty"<br>]</pre> | no |
| managed\_disk\_encryption\_key\_secret\_url | Refeerence to the URL of the key vault secret used as the disk encryption key. This can be found as `id` on the `azurerm_key_vault_secret` resource. | `string` | `""` | no |
| managed\_disk\_encryption\_key\_source\_vault\_id | The URl of the key vault. This can be found as `Vault_uri` on the `azurerm_key_vault` resource. | `string` | `""` | no |
| managed\_disk\_encryption\_settings\_enabled | Boolean flag which describes whether the encryption is enabled on the managed disk or not. Changing this forces a new resource to be created. | `bool` | `false` | no |
| managed\_disk\_image\_reference\_ids | IDs of an existing platform/marketplace disk image to copy when create\_option is FromImage. CAREFUL: if you create multiple Managed Disks with different create\_option, make sure this list matches with the disks having "FromImage" on (meaning this list may have empty values). | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| managed\_disk\_key\_encryption\_key\_key\_url | The URL to the key vault key used as the key encryption key. This can be found as `id` on the `azurerm_key_vault_key` resource. | `string` | `""` | no |
| managed\_disk\_key\_encryption\_key\_source\_valut\_id | The ID of the source key vault. | `string` | `""` | no |
| managed\_disk\_names | Specifies the names of the Managed Disks. Changing this forces a new resource to be created. | `list(string)` | <pre>[<br> "vm-manage-disk"<br>]</pre> | no |
| managed\_disk\_os\_types | Specify values when the source of an Import or Copy operation targets a source that contains an operating system. Valid values inside the list are Linux or Windows. CAREFUL: if you create multiple Managed Disks with different create\_option, make sure this list matches with the disks having "Copy"/"Import" on (meaning this list may have empty values). | `list(string)` | <pre>[<br> "Linux"<br>]</pre> | no |
| managed\_disk\_os\_types | Specify values when the source of an Import or Copy operation targets a source that contains an operating system. Valid values inside the list are Linux or Windows. CAREFUL: if you create multiple Managed Disks with different create\_option, make sure this list matches with the disks having "Copy"/"Import" on (meaning this list may have empty values). | `list(string)` | <pre>[<br> "Windows"<br>]</pre> | no |
| managed\_disk\_size\_gbs | Specifies the sizes of the Managed Disks to create in gigabytes. If create\_option is Copy or FromImage, then the value must be equal to or greater than the source's size. | `list(number)` | <pre>[<br> 5<br>]</pre> | no |
| managed\_disk\_source\_resource\_ids | The IDs of existing Managed Disks to copy create\_option is Copy or the recovery points to restore when create\_option is Restore. CAREFUL: if you create multiple Managed Disks with different create\_option, make sure this list matches with the disks having "Copy"/"Restore" on (meaning this list may have empty values). | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| managed\_disk\_source\_uris | URI to a valid VHD file to be used when create\_option is Import. CAREFUL: if you create multiple Managed Disks with different create\_option, make sure this list matches with the disks having "Import" on (meaning this list may have empty values). | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| managed\_disk\_storage\_account\_types | The types of storage to use for the Managed Disks. Possible values inside the list are Standard\_LRS, Premium\_LRS, StandardSSD\_LRS or UltraSSD\_LRS. | `list(string)` | <pre>[<br> "Standard_LRS"<br>]</pre> | no |
| managed\_disk\_tags | Tags specific to the Managed Disks. | `map` | `{}` | no |
| managed\_disk\_write\_accelerator\_enableds | Specifies if Write Accelerator is enabled on Managed Disks. This can only be enabled on Premium\_LRS managed disks with no caching and M-Series VMs. | `list(bool)` | <pre>[<br> false<br>]</pre> | no |
| marketplace\_agreement\_offers | Should Ultra SSD disk be enabled for this Virtual Machine? | `list` | `[]` | no |
| marketplace\_agreement\_plans | Should Ultra SSD disk be enabled for this Virtual Machine? | `list` | `[]` | no |
| marketplace\_agreement\_publishers | Should Ultra SSD disk be enabled for this Virtual Machine? | `list` | `[]` | no |
| name | Specifies the name of the Virtual Machine. Changing this forces a new resource to be created. | `string` | `"vm"` | no |
| max\_bid\_price | The maximum price youre willing to pay for the vitual machine, in US Dollard; which must be greater tha the current spot price. If this bid price falls below the current spot price the virtual machine will be evicted using the `evction_policy`. Defaults to `-1`, which means that the virtual machine should not be evicted for the price reason. | `string` | `"-1"` | no |
| network\_interface\_application\_gateway\_backend\_address\_pool\_count | How many Gateway Backend Address Pools to associate per Network Interface. | `number` | `0` | no |
| network\_interface\_application\_gateway\_backend\_address\_pool\_ids | The IDs of the Application Gateway's Backend Address Pools which each Network Interfaces which should be connected to. Changing this forces a new resource to be created. Beware: network\_interface\_index value is the index per Virtual Machine. | `list(object({ network_interface_index = number, application_gateway_backend_address_pool_id = string }))` | <pre>[<br> {<br> "application_gateway_backend_address_pool_id": "",<br> "network_interface_index": 0<br> }<br>]</pre> | no |
| network\_interface\_application\_security\_group\_count | How many Network Interfaces security groups to associate per Network Interface. | `number` | `0` | no |
@@ -76,6 +93,7 @@ See `examples` folders for usage of this module.
| network\_interface\_external\_names | If defined, this network interfaces will be used by other virtual machines instead of creating a new network interfaces inside this module. | `list` | <pre>[<br> ""<br>]</pre> | no |
| network\_interface\_internal\_dns\_name\_labels | Relative DNS names for this NIC used for internal communications between VMs in the same VNet. | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| network\_interface\_ip\_configuration\_names | User-defined name of the IPs for the Network Interfaces. Careful: this defines all the IP configurations meaning network\_interface\_count times vm\_count. | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| network\_interface\_ip\_configuration\_primary | Boolean flag which describes if ip configuration is primary one or not. Must be `true` for the first `ip_configuration` when multiple are specified. Defaults to `fasle`. | `list(bool)` | <pre>[<br> true<br>]</pre> | no |
| network\_interface\_ip\_configuration\_private\_ip\_address\_allocations | Defines how a private IP addresses are assigned. Options are Static or Dynamic. Careful: this defines all the IP configurations meaning network\_interface\_count times vm\_count. | `list(string)` | <pre>[<br> "Dynamic"<br>]</pre> | no |
| network\_interface\_ip\_configuration\_private\_ip\_address\_versions | The IP versions to use. Possible values are IPv4 or IPv6. Careful: this defines all the IP configurations meaning network\_interface\_count times vm\_count. | `list(string)` | <pre>[<br> "IPv4"<br>]</pre> | no |
| network\_interface\_ip\_configuration\_private\_ip\_addresses | Static IP Addresses. Careful: this defines all the IP configurations meaning network\_interface\_count times vm\_count. | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
@@ -86,43 +104,52 @@ See `examples` folders for usage of this module.
| network\_interface\_nat\_rule\_association\_ids | The IDs of the Load Balancer NAT Rules which each Network Interfaces which should be connected to. Changing this forces a new resource to be created. Beware: network\_interface\_index value is the index per Virtual Machine. | `list(object({ network_interface_index = number, nat_rule_id = string }))` | <pre>[<br> {<br> "nat_rule_id": "",<br> "network_interface_index": 0<br> }<br>]</pre> | no |
| network\_interface\_network\_security\_group\_ids | The IDs of the Network Security Groups to associate with the network interfaces. | `list` | <pre>[<br> ""<br>]</pre> | no |
| network\_interface\_tags | Tags specific to the network interface. | `map` | `{}` | no |
| num\_suffix\_digits | How many digits to use for resources names. | `number` | `2` | no |
| os\_profile\_admin\_password | The password associated with the local administrator account. | `string` | `"Passw0rd_TO_BE_CHANGED!"` | no |
| os\_profile\_admin\_username | Specifies the name of the local administrator account. | `string` | `"testadmin"` | no |
| os\_profile\_custom\_data | Specifies custom data to supply to the machine. On Linux-based systems, this can be used as a cloud-init script. On other systems, this will be copied as a file on disk. Internally, Terraform will base64 encode this value before sending it to the API. The maximum length of the binary array is 65535 bytes. | `string` | `""` | no |
| os\_profile\_linux\_config\_disable\_password\_authentication | Specifies whether password authentication should be disabled. If set to false, an admin\_password must be specified. | `bool` | `true` | no |
| os\_profile\_linux\_config\_ssh\_keys | One or more ssh\_keys blocks. This field is required if disable\_password\_authentication is set to true. | `list(object({ key_data = string }))` | `[]` | no |
| os\_profile\_secrets\_source\_vault\_id | Specifies the ID of the Key Vault to use. | `string` | `""` | no |
| os\_profile\_secrets\_vault\_certificates | One or more vault\_certificates blocks. | `list(object({ certificate_url = string, certificate_store = string }))` | `[]` | no |
| os\_profile\_windows\_config\_enable\_automatic\_upgrades | Are automatic updates enabled on this Virtual Machine? | `bool` | `false` | no |
| os\_profile\_windows\_config\_provision\_vm\_agent | Should the Azure Virtual Machine Guest Agent be installed on this Virtual Machine? | `bool` | `false` | no |
| os\_profile\_windows\_config\_timezone | Specifies the time zone of the virtual machine | `string` | `"UTC"` | no |
| num\_suffix\_digits | How many digits to use for resources names. | `number` | `0` | no |
| os\_disk\_caching | Specifies the caching requirements for the OS Disk. Possible values include None, ReadOnly and ReadWrite. | `string` | `"ReadWrite"` | no |
| os\_disk\_encryption\_set\_id | The ID of the Disk encryption set which should be used to encrypt the OS disk. `NOTE: The Disk encryption set must have the `READER` role assignmnet scoped on the key vault- in addition to an access policy to the key vault`. | `any` | `null` | no |
| os\_disk\_size\_gb | Specifies the size of the OS Disk in gigabytes. | `number` | `30` | no |
| os\_disk\_storage\_account\_type | The type of storage account which should back the internal OS disk. Possible values are `Standard_LRS`, `StandardSSD_LRS` and `Premium_LRS`. Changing this forces a new resource to be created. | `string` | `"Standard_LRS"` | no |
| plan\_name | Specifies the name of the image from the marketplace. | `string` | `""` | no |
| plan\_product | Specifies the product of the image from the marketplace. | `string` | `""` | no |
| plan\_publisher | Specifies the publisher of the image. | `string` | `""` | no |
| resource\_group\_location | Specifies the supported Azure location where the resources exist. Changing this forces a new resource to be created. | `string` | `""` | no |
| priority | Specfies the priority of the virtual machine. Posssible values are `regular` an `Spot`. Defaults to `Regular`. Changing this forces a new resourec to be created. | `string` | `"Regular"` | no |
| provision\_vm\_agent | Boolean flag which descibes should the Azure VM agent to provisioned on the virtual machine or not. Defaults to `true`. Changing this forces a new resource to be created. | `bool` | `true` | no |
| proximity\_placement\_group\_id | The ID of the proximity placement group which the virtual machine should be assigned to. Changing this forces a new resource to be created. | `any` | `null` | no |
| resource\_group\_location | Specifies the supported Azure location where the resources exist. Changing this forces a new resource to be created. | `string` | `"eastus"` | no |
| resource\_group\_name | The name of the resource group in which to create the resources in this module. Changing this forces a new resource to be created. | `string` | `""` | no |
| storage\_image\_reference\_id | Specifies the ID of the Custom Image which the Virtual Machine should be created from. Changing this forces a new resource to be created. | `string` | `""` | no |
| storage\_image\_reference\_offer | Specifies the offer of the image used to create the virtual machine. Changing this forces a new resource to be created. | `string` | `"UbuntuServer"` | no |
| storage\_image\_reference\_publisher | Specifies the publisher of the image used to create the virtual machine. Changing this forces a new resource to be created. | `string` | `"Canonical"` | no |
| storage\_image\_reference\_sku | Specifies the SKU of the image used to create the virtual machine. Changing this forces a new resource to be created. | `string` | `"18.04-LTS"` | no |
| storage\_image\_reference\_version | Specifies the version of the image used to create the virtual machine. Changing this forces a new resource to be created. | `string` | `"latest"` | no |
| storage\_os\_disk\_caching | Specifies the caching requirements for the OS Disk. Possible values include None, ReadOnly and ReadWrite. | `string` | `"ReadWrite"` | no |
| storage\_os\_disk\_create\_option | Specifies how the OS Disk should be created. Possible values are Attach (managed disks only) and FromImage. | `string` | `"FromImage"` | no |
| storage\_os\_disk\_managed\_disk\_create\_option | The method to use when creating the managed disk. Changing this forces a new resource to be created. For the OS disk. Possible values include: Empty, FromImage, Copy, Import, Restore. | `string` | `"FromImage"` | no |
| storage\_os\_disk\_managed\_disk\_source\_resource\_id | Copy an existing managed disk or snapshot. For the OS disk. Only when storage\_os\_disk\_managed\_disk\_create\_option = Copy. | `string` | `""` | no |
| storage\_os\_disk\_managed\_disk\_source\_uri | Import a VHD file in to the managed disk. For the OS disk. Only when storage\_os\_disk\_managed\_disk\_create\_option = Import. | `string` | `""` | no |
| storage\_os\_disk\_name | Specifies the name of the OS Disk. If empty, the name of the VMs will be used as names for the disks. | `string` | `""` | no |
| storage\_os\_disk\_size\_gb | Specifies the size of the OS Disk in gigabytes. | `number` | `30` | no |
| storage\_os\_managed\_disk\_type | Specifies the type of Managed Disk which should be created. Possible values are Standard\_LRS, StandardSSD\_LRS or Premium\_LRS. | `string` | `"Standard_LRS"` | no |
| storage\_os\_write\_accelerator\_enabled | Specifies if Write Accelerator is enabled on the disk. This can only be enabled on Premium\_LRS managed disks with no caching and M-Series VMs. | `bool` | `false` | no |
| secret\_key\_vault\_id | The ID of the key vault from which all secrets should be sourced. | `string` | `""` | no |
| source\_image\_id | The ID of the image which the virtual machine should be created from. Changing this forces a new resource to be created. | `any` | `null` | no |
| source\_image\_reference\_offer | Specifies the offer of the image used to create the virtual machine. Changing this forces a new resource to be created. | `string` | `"WindowsServer"` | no |
| source\_image\_reference\_publisher | Specifies the publisher of the image used to create the virtual machine. Changing this forces a new resource to be created. | `string` | `"MicrosoftWindowsServer"` | no |
| source\_image\_reference\_sku | Specifies the SKU of the image used to create the virtual machine. Changing this forces a new resource to be created. | `string` | `"2016-Datacenter"` | no |
| source\_image\_reference\_version | Specifies the version of the image used to create the virtual machine. Changing this forces a new resource to be created. | `string` | `"latest"` | no |
| tags | Tags shared by all resources of this module. Will be merged with any other specific tags by resource | `map` | `{}` | no |
| vm\_count | How many Virtual Machines to create. | `number` | `1` | no |
| vm\_extension\_auto\_upgarde\_minor\_version | Boolean flag list which describes if the platform deploys the latest minor version update to the `type_handler_version` specified. | `list` | <pre>[<br> false<br>]</pre> | no |
| vm\_extension\_count | How many extensions have to be configured to EACH virtual machine. | `number` | `1` | no |
| vm\_extension\_names | The list of names of virtual machine extension peering. Changing this forces a new resource to be created. | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| vm\_extension\_protected\_settings | The list of protected settings passed to the extension, like settings, these are specified as a JSON object in a string. | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| vm\_extension\_publishers | The List of publisher of the extensions, available publisher can be found by using the Azure CLI `via: az vm extension image list --location westus -o table`. | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| vm\_extension\_settings | List of settings passed to the extension, these are specified as a JSON object in a string. Please `Note`: Certain VM Extensions require that the keys in the `settings` block are case sensitive. If you're seeing unhelpful errors, please ensure the keys are consistent with how Azure is expecting them (for instance, for the `JsonADDomainExtension extension`, the keys are expected to be in `TitleCase`.). | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| vm\_extension\_tags | Tags which will be associated to the virtual machine extensions. | `map` | `{}` | no |
| vm\_extension\_type\_handler\_versions | Specifies the list of version of the extensions to use, available versions can be found using Azure CLI. | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| vm\_extension\_types | List which specifies the type of extension, available types for a publisher can be found using Azure CLI. `NOTE`: The `Publisher` and `Type` of virtual machine extension can be found using the Azure CLI, via: `shell $ az vm extension image list --location westus -o table`. | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| vm\_extensions\_enabled | Booelan flag which describes whether or not to enable the virtual machine extensions. | `bool` | `false` | no |
| vm\_names | Specifies the names of the Virtual Machine. Changing this forces a new resource to be created. | `list(string)` | <pre>[<br> "vm"<br>]</pre> | no |
| vm\_size | Specifies the size of the Virtual Machines. https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes?toc=%2Fazure%2Fvirtual-machines%2Fwindows%2Ftoc.json. | `string` | `"Standard_B2ms"` | no |
| vm\_tags | Tags specific to the Virtual Machines. | `map` | `{}` | no |
| vm\_type | The type of Virtual Machines to create. Can be either "Linux" or "Windows". | `string` | `"Linux"` | no |
| winrm\_certificate\_url | The ID of the Key Vault Secret which contains the encrypted Certificate which should be installed on the Virtual Machine. This certificate must also be specified in the vault\_certificates block within the os\_profile\_secrets block. | `string` | `""` | no |
| winrm\_protocol | Specifies the protocol of listener. Possible values are HTTP or HTTPS. | `string` | `"HTTPS"` | no |
| vm\_type | The type of Virtual Machine. Can be either "Linux" or "Windows". | `string` | `"Windows"` | no |
| windows\_admin\_password | The windows virtual machine password associated with the local administrator account. | `string` | `"Passw0rd_TO_BE_CHANGED!"` | no |
| windows\_admin\_username | Specifies the name of the windows virtual machine local administrator account. | `string` | `"testadmin"` | no |
| windows\_certificate\_store | The certificate store on the windows virtual machine where the certificate should be added. | `string` | `""` | no |
| windows\_enable\_automatic\_updates | Specifies if the automatic updates are enabled for the windows virtual machine. Changing this forces a new resource to be created. | `bool` | `false` | no |
| windows\_license\_type | Specifies the type of on-premise license (also know as `Azure Hybrid Use Benefits`) which should be used for the virtual machine. Possible values are `None`, `Windows_client` and `Windows_Server`. Changing this forces a new resource to be created. | `string` | `""` | no |
| windows\_timezone | Specifies the timezone which should be used by the virtual machine. The possible values are defined over here: https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/ | `string` | `"UTC"` | no |
| windows\_vm\_enabled | Whether or not create windows virtual machine. | `bool` | `false` | no |
| winrm\_listener\_certificate\_url | The ID of the Key Vault Secret which contains the encrypted Certificate which should be installed on the Virtual Machine. This certificate must also be specified in the vault\_certificates block within the os\_profile\_secrets block. | `string` | `""` | no |
| winrm\_listener\_protocol | Specifies the protocol of listener. Possible values are `Http` or `Https`. | `string` | `"Http"` | no |
| zone | The zone in which the virtual machine should be created. Changing this forces a new resource to be created. | `number` | `null` | no |
| zone\_enabled | Boolean flag which describes whether or not enable the zone. Changing this will force a new resource to be created. | `bool` | `false` | no |

## Outputs

@@ -130,10 +157,10 @@ See `examples` folders for usage of this module.
|------|-------------|
| availability\_set\_id | n/a |
| identities | n/a |
| ids | n/a |
| managed\_disk\_ids | n/a |
| marketplace\_agreement\_ids | n/a |
| network\_interface\_ids | n/a |
| network\_interface\_private\_ip\_addresses | n/a |
| vm\_ids | n/a |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

+ 0
- 9
data.tf View File

@@ -11,12 +11,3 @@ data "azurerm_availability_set" "this" {
name = var.availability_set_exists ? var.availability_set_name : concat(azurerm_availability_set.this.*.id, [""])[0]
resource_group_name = var.resource_group_name
}

data "azurerm_platform_image" "this_os" {
count = var.enabled && var.storage_os_disk_create_option == "Attach" ? 1 : 0

location = var.resource_group_location
publisher = var.storage_image_reference_publisher
offer = var.storage_image_reference_offer
sku = var.storage_image_reference_sku
}

+ 2
- 2
examples/default/README.md View File

@@ -1,6 +1,6 @@
# Default example

This will create basic resources.
This will create basic resources related to Windows virtual machine.

## Usage
```
@@ -38,10 +38,10 @@ terraform destroy
|------|-------------|
| availability\_set\_id | n/a |
| identities | n/a |
| ids | n/a |
| managed\_disk\_ids | n/a |
| marketplace\_agreement\_ids | n/a |
| network\_interface\_ids | n/a |
| network\_interface\_private\_ip\_addresses | n/a |
| vm\_ids | n/a |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

+ 25
- 9
examples/default/deploy.tf View File

@@ -8,7 +8,11 @@ resource "random_string" "this" {

resource "azurerm_resource_group" "example" {
name = "tftest${random_string.this.result}"
location = "Canada Central"
location = "West Europe"
tags = {
Owner = "Terraform"
EndDate = "2020-04-22"
}
}

resource "azurerm_virtual_network" "example" {
@@ -34,15 +38,15 @@ resource "azurerm_application_security_group" "example" {
module "example" {
source = "../.."

enabled = true
resource_group_location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
tags = {
env = "test"
}

num_suffix_digits = 4

availability_set_name = "tftest${random_string.this.result}"
availability_set_enabled = true
availability_set_name = "tftest${random_string.this.result}"
availability_set_tags = {
test = "tftest${random_string.this.result}"
}
@@ -67,9 +71,21 @@ module "example" {
managed_disk_count = 1
managed_disk_names = ["tftest${random_string.this.result}ext"]

name = "tftest${random_string.this.result}"

os_profile_linux_config_ssh_keys = [{
key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDD3gEe3zm4Z5AZtAD1qhD6f5hyg6qMBQA8SuMAVtAP8q8k/kFu/oCU6DUMUBO83SQIXBnEniBs2EMl8xUMXShrmYqHZE6bZZeBVg2y8Kr2ReCCSMPH5TDbPTWrGJR7x0SIBXgsjctOazCyMBB98lMgcK++P0PQnqGSvRj7iZbiyN2KNaXE1ukZ4USGeTWxoh9NFVilIt5R0pI5CECSLajKgXJMUl3QWc5bHL8fSpvHqoRfItiPEmpm5pSQb519jkdT7ohnhSwIA8qBo6sAnfrRH0ydLT3swglyn44FDs4hCSSK1Hu4n1vYMBWgzGyfxWJlVV483MJYduxamMGIpyjgLCRcQ7sIwWnkSepKpj6okEN+0D9JM/64uk5p0oZ1bBQ3UU/D1XDxOHkyOobFiGUn2GSnKs3CdDhLbKobjK2RN6Qs/mqJ2Ux8eqQr4n76X/4xHuuqtJMc/OyfOKTRE7BZ7MhBP5r6btMks2GEATye34qiHwH7YNy1/no2ynW8RI8= test@tests"
}]
vm_names = ["tftest${random_string.this.result}"]
vm_size = "Standard_F2"
windows_admin_username = "testadmin"
windows_admin_password = "Passw0rd_TO_BE_CHANGED!"
os_disk_caching = "ReadWrite"
os_disk_size_gb = 127
os_disk_storage_account_type = "Standard_LRS"
allow_extension_operations = true
source_image_reference_publisher = "MicrosoftWindowsServer"
source_image_reference_offer = "WindowsServer"
source_image_reference_sku = "2016-Datacenter"
source_image_reference_version = "latest"
windows_timezone = "UTC"
priority = "Regular"
windows_license_type = "None"
provision_vm_agent = true
windows_enable_automatic_updates = true
}

+ 2
- 2
examples/default/outputs.tf View File

@@ -14,8 +14,8 @@ output "marketplace_agreement_ids" {
value = module.example.marketplace_agreement_ids
}

output "ids" {
value = module.example.ids
output "vm_ids" {
value = module.example.vm_ids
}

output "identities" {


+ 5
- 1
examples/default/providers.tf View File

@@ -1,5 +1,9 @@
provider "azurerm" {
features {}
features {
virtual_machine {
delete_os_disk_on_deletion = true
}
}
version = ">= 2.0.0"
client_id = var.client_id
client_secret = var.client_secret


+ 1
- 1
examples/disabled/README.md View File

@@ -35,10 +35,10 @@ No provider.
|------|-------------|
| availability\_set\_id | n/a |
| identities | n/a |
| ids | n/a |
| managed\_disk\_ids | n/a |
| marketplace\_agreement\_ids | n/a |
| network\_interface\_ids | n/a |
| network\_interface\_private\_ip\_addresses | n/a |
| vm\_ids | n/a |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

+ 1
- 1
examples/disabled/outputs.tf View File

@@ -14,7 +14,7 @@ output "marketplace_agreement_ids" {
value = module.example.marketplace_agreement_ids
}

output "ids" {
output "vm_ids" {
value = module.example.ids
}



+ 5
- 1
examples/disabled/providers.tf View File

@@ -1,5 +1,9 @@
provider "azurerm" {
features {}
features {
virtual_machine {
delete_os_disk_on_deletion = true
}
}
version = ">= 2.0.0"
client_id = var.client_id
client_secret = var.client_secret


+ 0
- 70
examples/external-resources/deploy.tf View File

@@ -1,70 +0,0 @@
data "azurerm_client_config" "current" {}

resource "random_string" "this" {
length = 6
upper = false
special = false
}

resource "azurerm_resource_group" "example" {
name = "tftest${random_string.this.result}"
location = "West US"
}

resource "azurerm_virtual_network" "example" {
name = "tftest${random_string.this.result}"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_subnet" "example" {
name = "tftest${random_string.this.result}"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefix = "10.0.0.0/24"
}

resource "azurerm_availability_set" "example" {
name = "tftest${random_string.this.result}"

managed = true
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_network_interface" "example" {
name = "tftest${random_string.this.result}"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name

ip_configuration {
name = "tftest${random_string.this.result}"
subnet_id = azurerm_subnet.example.id
private_ip_address_allocation = "Dynamic"
}
}


module "example" {
source = "../.."

resource_group_location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
tags = {
env = "test"
}

availability_set_name = azurerm_availability_set.example.name
availability_set_enabled = true
availability_set_exists = true

network_interface_external_names = [azurerm_network_interface.example.name]
network_interface_exists = true

name = "tftest${random_string.this.result}"

os_profile_linux_config_ssh_keys = [{
key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDD3gEe3zm4Z5AZtAD1qhD6f5hyg6qMBQA8SuMAVtAP8q8k/kFu/oCU6DUMUBO83SQIXBnEniBs2EMl8xUMXShrmYqHZE6bZZeBVg2y8Kr2ReCCSMPH5TDbPTWrGJR7x0SIBXgsjctOazCyMBB98lMgcK++P0PQnqGSvRj7iZbiyN2KNaXE1ukZ4USGeTWxoh9NFVilIt5R0pI5CECSLajKgXJMUl3QWc5bHL8fSpvHqoRfItiPEmpm5pSQb519jkdT7ohnhSwIA8qBo6sAnfrRH0ydLT3swglyn44FDs4hCSSK1Hu4n1vYMBWgzGyfxWJlVV483MJYduxamMGIpyjgLCRcQ7sIwWnkSepKpj6okEN+0D9JM/64uk5p0oZ1bBQ3UU/D1XDxOHkyOobFiGUn2GSnKs3CdDhLbKobjK2RN6Qs/mqJ2Ux8eqQr4n76X/4xHuuqtJMc/OyfOKTRE7BZ7MhBP5r6btMks2GEATye34qiHwH7YNy1/no2ynW8RI8= test@tests"
}]
}

+ 0
- 8
examples/external-resources/providers.tf View File

@@ -1,8 +0,0 @@
provider "azurerm" {
features {}
version = ">= 2.0.0"
client_id = var.client_id
client_secret = var.client_secret
subscription_id = var.subscription_id
tenant_id = var.tenant_id
}

examples/external-resources/README.md → examples/linux_default/README.md View File

@@ -1,6 +1,6 @@
# External resources example
# Default example

This will use externally created resources.
This will create basic resources related to Linux virtual machine.

## Usage
```

+ 93
- 0
examples/linux_default/deploy.tf View File

@@ -0,0 +1,93 @@
data "azurerm_client_config" "current" {}

resource "random_string" "this" {
length = 6
upper = false
special = false
}

resource "azurerm_resource_group" "example" {
name = "tftest${random_string.this.result}"
location = "West Europe"
tags = {
Owner = "Terraform"
EndDate = "2020-04-23"
}
}

resource "azurerm_virtual_network" "example" {
name = "tftest${random_string.this.result}"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name

resource "azurerm_subnet" "example" {
name = "tftest${random_string.this.result}"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefix = "10.0.0.0/24"
}

resource "azurerm_application_security_group" "example" {
name = "tftest${random_string.this.result}"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}

module "example" {
source = "../.."
enabled = true
resource_group_location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
tags = {
env = "test"
}
availability_set_enabled = true
availability_set_name = "tftest${random_string.this.result}"
availability_set_tags = {
test = "tftest${random_string.this.result}"
}

network_interface_enabled = true
network_interface_names = ["tftest${random_string.this.result}"]
network_interface_internal_dns_name_labels = ["tftest${random_string.this.result}"]
network_interface_ip_configuration_names = ["tftest${random_string.this.result}"]
network_interface_ip_configuration_subnet_ids = [azurerm_subnet.example.id]
network_interface_tags = {
test = "tftest${random_string.this.result}"
}

network_interface_application_security_group_count = 1
network_interface_application_security_group_ids = [
{
network_interface_index = 0
application_security_group_id = azurerm_application_security_group.example.id
},
]

managed_disk_count = 1
managed_disk_names = ["tftest${random_string.this.result}ext"]

vm_names = ["tftest${random_string.this.result}"]
vm_size = "Standard_B2ms"
vm_type = "Linux"
linux_vm_enabled = true
linux_admin_username = "testadmin"
os_disk_caching = "ReadWrite"
os_disk_size_gb = 30
os_disk_storage_account_type = "Standard_LRS"
allow_extension_operations = true
source_image_reference_publisher = "Canonical"
source_image_reference_offer = "UbuntuServer"
source_image_reference_sku = "18.04-LTS"
source_image_reference_version = "latest"
priority = "Regular"
provision_vm_agent = true

linux_admin_ssh_keys = [{
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDD3gEe3zm4Z5AZtAD1qhD6f5hyg6qMBQA8SuMAVtAP8q8k/kFu/oCU6DUMUBO83SQIXBnEniBs2EMl8xUMXShrmYqHZE6bZZeBVg2y8Kr2ReCCSMPH5TDbPTWrGJR7x0SIBXgsjctOazCyMBB98lMgcK++P0PQnqGSvRj7iZbiyN2KNaXE1ukZ4USGeTWxoh9NFVilIt5R0pI5CECSLajKgXJMUl3QWc5bHL8fSpvHqoRfItiPEmpm5pSQb519jkdT7ohnhSwIA8qBo6sAnfrRH0ydLT3swglyn44FDs4hCSSK1Hu4n1vYMBWgzGyfxWJlVV483MJYduxamMGIpyjgLCRcQ7sIwWnkSepKpj6okEN+0D9JM/64uk5p0oZ1bBQ3UU/D1XDxOHkyOobFiGUn2GSnKs3CdDhLbKobjK2RN6Qs/mqJ2Ux8eqQr4n76X/4xHuuqtJMc/OyfOKTRE7BZ7MhBP5r6btMks2GEATye34qiHwH7YNy1/no2ynW8RI8= test@tests"
username = "testadmin"
}]
}

examples/external-resources/outputs.tf → examples/linux_default/outputs.tf View File

@@ -14,8 +14,8 @@ output "marketplace_agreement_ids" {
value = module.example.marketplace_agreement_ids
}

output "ids" {
value = module.example.ids
output "vm_ids" {
value = module.example.vm_ids
}

output "identities" {

examples/x-vms-x-disks-x-netint/providers.tf → examples/linux_default/providers.tf View File

@@ -1,5 +1,9 @@
provider "azurerm" {
features {}
features {
virtual_machine {
delete_os_disk_on_deletion = true
}
}
version = ">= 2.0.0"
client_id = var.client_id
client_secret = var.client_secret

examples/external-resources/variables.tf → examples/linux_default/variables.tf View File


+ 0
- 47
examples/x-vms-x-disks-x-netint/README.md View File

@@ -1,47 +0,0 @@
# X VMs X Disks example

This will create multiple VMs with multiple network interfaces, with multiple data disks attached to them.

## Usage
```
terraform init
terraform apply
terraform destroy
```

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| azurerm | >= 2.0.0 |

## Providers

| Name | Version |
|------|---------|
| azurerm | >= 2.0.0 |
| random | n/a |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| client\_id | n/a | `string` | n/a | yes |
| client\_secret | n/a | `string` | n/a | yes |
| subscription\_id | n/a | `string` | n/a | yes |
| tenant\_id | n/a | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| availability\_set\_id | n/a |
| identities | n/a |
| ids | n/a |
| managed\_disk\_ids | n/a |
| marketplace\_agreement\_ids | n/a |
| network\_interface\_ids | n/a |
| network\_interface\_private\_ip\_addresses | n/a |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

+ 0
- 147
examples/x-vms-x-disks-x-netint/deploy.tf View File

@@ -1,147 +0,0 @@
data "azurerm_client_config" "current" {}

resource "random_string" "this" {
length = 6
upper = false
special = false
}

resource "azurerm_resource_group" "example" {
name = "tftest${random_string.this.result}"
location = "northcentralus"
}

resource "azurerm_virtual_network" "example" {
name = "tftest${random_string.this.result}"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_subnet" "example" {
name = "tftest${random_string.this.result}"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefix = "10.0.0.0/24"
}

resource "azurerm_application_security_group" "example1" {
name = "tftest${random_string.this.result}1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_application_security_group" "example2" {
name = "tftest${random_string.this.result}2"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_public_ip" "example" {
name = "tftest${random_string.this.result}"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
allocation_method = "Static"
}

resource "azurerm_lb" "example" {
name = "tftest${random_string.this.result}"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name

frontend_ip_configuration {
name = "tftest${random_string.this.result}"
public_ip_address_id = azurerm_public_ip.example.id
}
}

resource "azurerm_lb_backend_address_pool" "example" {
resource_group_name = azurerm_resource_group.example.name
loadbalancer_id = azurerm_lb.example.id
name = "tftest${random_string.this.result}"
}

module "example" {
source = "../.."

resource_group_location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
tags = {
env = "test"
}

availability_set_name = "tftest${random_string.this.result}"
availability_set_tags = {
test = "tftest${random_string.this.result}"
}

network_interface_enabled = true
network_interface_count = 2
network_interface_names = ["tftest${random_string.this.result}"]
network_interface_internal_dns_name_labels = ["tftest${random_string.this.result}-first", "tftest${random_string.this.result}-second", "tftest${random_string.this.result}-third", "tftest${random_string.this.result}-1first", "tftest${random_string.this.result}-2second", "tftest${random_string.this.result}-3third"]
network_interface_ip_configuration_names = ["tftest${random_string.this.result}", "tftest${random_string.this.result}2", "tftest${random_string.this.result}3", "tftest${random_string.this.result}4", "tftest${random_string.this.result}5", "tftest${random_string.this.result}6"]
network_interface_ip_configuration_subnet_ids = [azurerm_subnet.example.id]
network_interface_tags = {
test = "tftest${random_string.this.result}"
}

network_interface_backend_address_pool_count = 1
network_interface_backend_address_pool_ids = [
{
network_interface_index = 1
backend_address_pool_id = azurerm_lb_backend_address_pool.example.id
},
]
network_interface_application_security_group_count = 6
network_interface_application_security_group_ids = [
{
network_interface_index = 0
application_security_group_id = azurerm_application_security_group.example1.id
},
{
network_interface_index = 0
application_security_group_id = azurerm_application_security_group.example2.id
},
{
network_interface_index = 1
application_security_group_id = azurerm_application_security_group.example1.id
},
{
network_interface_index = 1
application_security_group_id = azurerm_application_security_group.example2.id
},
{
network_interface_index = 2
application_security_group_id = azurerm_application_security_group.example1.id
},
{
network_interface_index = 2
application_security_group_id = azurerm_application_security_group.example2.id
},
]

name = "tftest${random_string.this.result}"
vm_count = 3
vm_type = "Windows"
vm_size = "Standard_D1_v2"
num_suffix_digits = 3
storage_image_reference_offer = "WindowsServer"
storage_image_reference_sku = "2019-Datacenter"
storage_image_reference_publisher = "MicrosoftWindowsServer"
storage_os_disk_size_gb = 127

winrm_protocol = "HTTP"

managed_disk_count = 3
managed_disk_names = ["tftest1${random_string.this.result}ext", "tftest2${random_string.this.result}ext", "tftest3${random_string.this.result}ext"]
managed_disk_storage_account_types = ["Standard_LRS"]
managed_disk_size_gbs = [5, 6, 10]
managed_disk_create_options = ["Empty", "Empty", "Empty"]
managed_disk_cachings = ["ReadWrite"]
managed_disk_write_accelerator_enableds = [false]
managed_disk_os_types = ["Windows"]

managed_disk_tags = {
test = "tftest${random_string.this.result}"
}
}

+ 0
- 27
examples/x-vms-x-disks-x-netint/outputs.tf View File

@@ -1,27 +0,0 @@
output "availability_set_id" {
value = module.example.availability_set_id
}

output "network_interface_ids" {
value = module.example.network_interface_ids
}

output "network_interface_private_ip_addresses" {
value = module.example.network_interface_private_ip_addresses
}

output "marketplace_agreement_ids" {
value = module.example.marketplace_agreement_ids
}

output "ids" {
value = module.example.ids
}

output "identities" {
value = module.example.identities
}

output "managed_disk_ids" {
value = module.example.managed_disk_ids
}

+ 0
- 15
examples/x-vms-x-disks-x-netint/variables.tf View File

@@ -1,15 +0,0 @@
variable "client_id" {
type = string
}

variable "client_secret" {
type = string
}

variable "subscription_id" {
type = string
}

variable "tenant_id" {
type = string
}

+ 117
- 100
main.tf View File

@@ -1,9 +1,6 @@
locals {
should_create_availability_set = var.enabled && var.availability_set_enabled && ! var.availability_set_exists
should_create_network_interface = var.enabled && var.network_interface_enabled && ! var.network_interface_exists && var.vm_count > 0
data_disk_attachement = var.enabled && (var.vm_count > 0 || var.vm_exists)
storage_os_disk_name = var.storage_os_disk_name != "" ? var.storage_os_disk_name : var.name
supports_encryption_set = var.resource_group_location == "eastus2" || var.resource_group_location == "canadacentral" || var.resource_group_location == "westcentralus" || var.resource_group_location == "northeurope"
}

###
@@ -37,13 +34,13 @@ resource "azurerm_availability_set" "this" {
###

resource "azurerm_network_interface" "this" {
count = local.should_create_network_interface ? var.network_interface_count : 0
count = local.should_create_network_interface ? var.network_interface_count * var.vm_count : 0

name = var.network_interface_count > 0 ? element(var.network_interface_names, count.index) : null
name = var.num_suffix_digits > 0 ? format("%s%0${var.num_suffix_digits}d", element(var.network_interface_names, count.index % var.network_interface_count), count.index + 1) : element(var.network_interface_names, count.index)
location = var.resource_group_location
resource_group_name = var.resource_group_name

internal_dns_name_label = var.network_interface_count > 0 ? element(var.network_interface_internal_dns_name_labels, count.index) : null
internal_dns_name_label = var.num_suffix_digits == 0 ? format("%s%0${var.num_suffix_digits}d", element(var.network_interface_internal_dns_name_labels, count.index % var.network_interface_count), count.index + 1) : element(var.network_interface_internal_dns_name_labels, count.index % var.network_interface_count)
enable_ip_forwarding = element(var.network_interface_enable_ip_forwardings, count.index)
enable_accelerated_networking = element(var.network_interface_enable_accelerated_networkings, count.index)
dns_servers = element(var.network_interface_dns_servers, count.index)
@@ -58,6 +55,7 @@ resource "azurerm_network_interface" "this" {
private_ip_address_version = element(var.network_interface_ip_configuration_private_ip_address_versions, count.index)
}


tags = merge(
var.tags,
var.network_interface_tags,
@@ -115,49 +113,60 @@ resource "azurerm_marketplace_agreement" "this" {
###

resource "azurerm_windows_virtual_machine" "this" {
count = var.enabled ? var.vm_count : 0
name = element(var.vm_names, count.index)
size = var.vm_size
zone = var.zones
location = var.resource_group_location
resource_group_name = var.resource_group_name
admin_username = element(var.windows_admin_usernames, count.index)
admin_password = element(var.windows_admin_passwords, count.index)
network_interface_ids = var.vm_count > 1 ? element(slice((var.network_interface_exists ? data.azurerm_network_interface.this.*.id : azurerm_network_interface.this.*.id), element(var.network_interface_start_index, count.index), element(var.network_interface_end_index, count.index)), count.index) : concat(azurerm_network_interface.this.*.id, list(""))
allow_extensions_operations = true
timezone = var.windows_timezone
priority = var.priority
custom_data = element(var.custom_data, count.index)
license_type = element(var.windows_license_types, count.index)
computer_name = element(var.computer_name, count.index)
max_bid_price = var.priority == "Spot" ? element(var.windows_max_bid_prices, count.index) : ""
eviction_policy = var.priority == "Spot" ? element(var.windows_eviction_policies, count.index) : ""
source_image_id = var.source_image_id
dedicated_host_id = element(var.dedicated_host_ids, count.index)
availability_set_id = var.availability_set_enabled ? (var.availability_set_exists ? data.azurerm_availability_set.this.*.id[0] : concat(azurerm_availability_set.this.*.id, list(""))[0]) : ""
provision_vm_agent = var.provision_vm_agent
source_image_reference = var.source_image_reference
enable_automatic_updates = element(var.windows_enable_automatic_updates, count.index)
count = var.enabled && var.windows_vm_enabled ? var.vm_count : 0
name = var.num_suffix_digits > 0 ? format("%s%0${var.num_suffix_digits}d", element(var.vm_names, count.index), count.index + 1) : element(var.vm_names, count.index)
zone = var.zone_enabled ? var.zone : null
size = var.vm_size
location = var.resource_group_location
resource_group_name = var.resource_group_name
admin_username = var.windows_admin_username
admin_password = var.windows_admin_password
network_interface_ids = element(chunklist((var.network_interface_exists ? data.azurerm_network_interface.this.*.id : azurerm_network_interface.this.*.id), var.network_interface_count), count.index)
allow_extension_operations = var.allow_extension_operations
timezone = var.windows_timezone
priority = var.priority
custom_data = var.custom_data
license_type = var.windows_license_type
computer_name = element(var.computer_names, count.index) == null ? element(var.vm_names, count.index) : element(var.computer_names, count.index)
max_bid_price = var.priority == "Spot" ? var.max_bid_price : null
eviction_policy = var.priority == "Spot" ? var.eviction_policy : null
source_image_id = var.source_image_id
dedicated_host_id = var.dedicated_host_enabled ? element(var.dedicated_host_ids, count.index) : null
provision_vm_agent = var.provision_vm_agent
availability_set_id = var.zone_enabled != true && var.availability_set_enabled ? (var.availability_set_exists ? data.azurerm_availability_set.this.*.id[0] : azurerm_availability_set.this.*.id[0]) : null
enable_automatic_updates = var.windows_enable_automatic_updates
proximity_placement_group_id = var.proximity_placement_group_id

additional_capabilities {
ultra_ssd_enabled = var.additional_capabilities_ultra_ssd_enabled
}

dynamic "additional_unattend_content" {
for_each = var.additional_unattend_content_seeting != "" ? [1] : []
dynamic "boot_diagnostics" {
for_each = var.boot_diagnostics_enabled == true ? [1] : []

content {
content = var.additional_unattend_content_content
setting = var.additional_unattend_content_seeting
storage_account_uri = var.boot_diagnostics_storage_account_uri
}
}

dynamic "boot_diagnostics" {
for_each = var.boot_diagnostics_storage_account_uri != "" ? [1] : []
dynamic "source_image_reference" {
for_each = var.source_image_id == null && var.source_image_reference_publisher != "" ? [1] : []

content {
storage_account_uri = var.boot_diagnostics_storage_account_uri
publisher = var.source_image_reference_publisher
offer = var.source_image_reference_offer
sku = var.source_image_reference_sku
version = var.source_image_reference_version
}
}

dynamic "additional_unattend_content" {
for_each = var.additional_unattend_content_windows_content != "" ? [1] : []

content {
content = var.additional_unattend_content_windows_content
setting = var.additional_unattend_content_windows_setting
}
}

@@ -166,7 +175,7 @@ resource "azurerm_windows_virtual_machine" "this" {

content {
type = element(var.identity_types, count.index)
identity_ids = element(var.identity_identities_ids, count.index)
identity_ids = element(var.identity_types, count.index) == "UserAssigned" ? element(var.identity_identity_ids, count.index) : null
}
}

@@ -174,12 +183,12 @@ resource "azurerm_windows_virtual_machine" "this" {
for_each = var.os_disk_caching != "" ? [1] : []

content {
name = var.os_disk_name
name = format("%s-OSDisk", element(var.vm_names, count.index))
caching = var.os_disk_caching
storage_account_type = var.os_disk_storage_account_type
disk_encryption_set_id = var.os_disk_encryption_set_id
disk_size_gb = var.os_disk_size_gb
write_accelerator_enabled = var.os_disk_storage_account_type == "Premium_LRS" && var.os_disk_caching == "None" ? true : false
disk_encryption_set_id = var.os_disk_encryption_set_id
write_accelerator_enabled = var.os_disk_storage_account_type == "Premium_LRS" ? true : false

dynamic "diff_disk_settings" {
for_each = var.diff_disk_settings_option != "" ? [1] : []
@@ -208,10 +217,10 @@ resource "azurerm_windows_virtual_machine" "this" {
key_vault_id = var.secret_key_vault_id

dynamic "certificate" {
for_each = var.certificate_store != "" ? [1] : []
for_each = var.windows_certificate_store != "" ? [1] : []

content {
store = var.certificate_store
store = var.windows_certificate_store
url = var.certificate_url
}
}
@@ -219,47 +228,44 @@ resource "azurerm_windows_virtual_machine" "this" {
}

winrm_listener {
Protocol = var.winrm_listener_protocol
cerificate_url = var.winrm_listener_certificate_url
protocol = var.winrm_listener_protocol
certificate_url = var.winrm_listener_protocol == "Https" ? var.winrm_listener_certificate_url : null
}


tags = merge(
var.tags,
var.windows_vm_tags,
var.vm_tags,
{
Terraform = "true"
},
)


}


###
# Linux virtual machine
###

resource "azurerm_linux_virtual_machine" "this" {
count = var.linux_vm_enabled ? var.vm_count : 0
count = var.enabled && var.linux_vm_enabled ? var.vm_count : 0

name = element(var.vm_names, count.index)
zone = var.zones
name = var.num_suffix_digits > 0 ? format("%s%0${var.num_suffix_digits}d", element(var.vm_names, count.index), count.index + 1) : element(var.vm_names, count.index)
zone = var.zone_enabled ? var.zone : null
size = var.vm_size
location = var.resource_group_location
resource_group_name = var.resource_group_name
admin_username = var.linux_admin_usernames
admin_password = var.linux_admin_passwords
network_interface_ids = var.vm_count > 1 ? element(slice((var.network_interface_exists ? data.azurerm_network_interface.this.*.id : azurerm_network_interface.this.*.id), element(var.network_interface_start_index, count.index), element(var.network_interface_end_index, count.index)), count.index) : concat(azurerm_network_interface.this.*.id, list(""))
allow_extensions_operations = true
admin_username = var.linux_admin_username
admin_password = var.linux_admin_password
network_interface_ids = element(chunklist((var.network_interface_exists ? data.azurerm_network_interface.this.*.id : azurerm_network_interface.this.*.id), var.network_interface_count), count.index)
allow_extension_operations = var.allow_extension_operations
priority = var.priority
custom_data = var.custom_data
computer_name = var.computer_names
max_bid_price = var.priority == "Spot" ? var.linux_max_bid_prices : ""
eviction_policy = var.priority == "Spot" ? var.linux_eviction_policies : ""
computer_name = element(var.computer_names, count.index) == null ? element(var.vm_names, count.index) : element(var.computer_names, count.index)
max_bid_price = var.priority == "Spot" ? var.max_bid_price : null
eviction_policy = var.priority == "Spot" ? var.eviction_policy : null
source_image_id = var.source_image_id
dedicated_host_id = var.dedicated_host_ids
dedicated_host_id = var.dedicated_host_enabled ? element(var.dedicated_host_ids, count.index) : null
provision_vm_agent = var.provision_vm_agent
availability_set_id = var.availability_set_enabled ? (var.availability_set_exists ? data.azurerm_availability_set.this.*.id[0] : concat(azurerm_availability_set.this.*.id, list(""))[0]) : ""
availability_set_id = var.availability_set_enabled ? (var.availability_set_exists ? data.azurerm_availability_set.this.*.id[0] : azurerm_availability_set.this.*.id[0]) : null
proximity_placement_group_id = var.proximity_placement_group_id
disable_password_authentication = var.linux_admin_password == "" ? true : false

@@ -267,20 +273,31 @@ resource "azurerm_linux_virtual_machine" "this" {
ultra_ssd_enabled = var.additional_capabilities_ultra_ssd_enabled
}

dynamic "admin_ssh_key" {
for_each = var.admin_passwords == null ? var.admin_ssh_key : {}
dynamic "boot_diagnostics" {
for_each = var.boot_diagnostics_enabled == true ? [1] : []

content {
public_key = var.admin_ssh_key.value.public_key
username = var.admin_ssh_key.value.username
storage_account_uri = var.boot_diagnostics_storage_account_uri
}
}

dynamic "boot_diagnostics" {
for_each = var.boot_diagnostics_storage_account_uri != "" ? [1] : []
dynamic "source_image_reference" {
for_each = var.source_image_reference_publisher != "" ? [1] : []

content {
storage_account_uri = var.boot_diagnostics_storage_account_uri
publisher = var.source_image_reference_publisher
offer = var.source_image_reference_offer
sku = var.source_image_reference_sku
version = var.source_image_reference_version
}
}

dynamic "admin_ssh_key" {
for_each = var.linux_admin_password == "" ? var.linux_admin_ssh_keys : []

content {
public_key = admin_ssh_key.value.public_key
username = admin_ssh_key.value.username
}
}

@@ -289,7 +306,7 @@ resource "azurerm_linux_virtual_machine" "this" {

content {
type = element(var.identity_types, count.index)
identity_ids = element(var.identity_identities_ids, count.index)
identity_ids = element(var.identity_types, count.index) == "UserAssigned" ? element(var.identity_identity_ids, count.index) : null
}
}

@@ -297,12 +314,12 @@ resource "azurerm_linux_virtual_machine" "this" {
for_each = var.os_disk_caching != "" ? [1] : []

content {
name = var.os_disk_name
name = format("%s-OSDisk", element(var.vm_names, count.index))
caching = var.os_disk_caching
storage_account_type = var.os_disk_storage_account_type
disk_encryption_set_id = var.os_disk_encryption_set_id
disk_size_gb = var.os_disk_size_gb
write_accelerator_enabled = var.os_disk_storage_account_type == "Premium_LRS" && var.os_disk_caching == "None" ? true : false
write_accelerator_enabled = var.os_disk_storage_account_type == "Premium_LRS" ? true : false

dynamic "diff_disk_settings" {
for_each = var.diff_disk_settings_option != "" ? [1] : []
@@ -342,7 +359,7 @@ resource "azurerm_linux_virtual_machine" "this" {

tags = merge(
var.tags,
var.windows_vm_tags,
var.vm_tags,
{
Terraform = "true"
},
@@ -355,25 +372,25 @@ resource "azurerm_linux_virtual_machine" "this" {
###

resource "azurerm_managed_disk" "this" {
count = var.enabled && var.managed_disk_count > 0 ? var.managed_disk_count : 0
count = var.enabled && var.managed_disk_count > 0 ? var.managed_disk_count * var.vm_count : 0

location = var.resource_group_location
resource_group_name = var.resource_group_name

name = element(var.managed_disk_names, count.index)
storage_account_type = element(var.managed_disk_storage_account_types, count.index)
disk_size_gb = element(var.managed_disk_size_gbs, count.index)
name = var.num_suffix_digits > 0 ? format("%s%0${var.num_suffix_digits}d", element(var.managed_disk_names, floor(count.index / var.vm_count) % var.managed_disk_count), count.index) : element(var.managed_disk_names, count.index)
storage_account_type = element(var.managed_disk_storage_account_types, floor(count.index / var.vm_count) % var.managed_disk_count)
disk_size_gb = element(var.managed_disk_size_gbs, floor(count.index / var.vm_count) % var.managed_disk_count)

create_option = element(var.managed_disk_create_options, count.index)
create_option = element(var.managed_disk_create_options, floor(count.index / var.vm_count) % var.managed_disk_count)

image_reference_id = element(var.managed_disk_create_options, count.index) == "FromImage" ? element(var.managed_disk_image_reference_ids, count.index) : null
source_resource_id = element(var.managed_disk_create_options, count.index) == "Copy" ? element(var.managed_disk_source_resource_ids, count.index) : null
source_uri = element(var.managed_disk_create_options, count.index) == "Import" ? element(var.managed_disk_source_uris, count.index) : null
image_reference_id = element(var.managed_disk_create_options, floor(count.index / var.vm_count) % var.managed_disk_count) == "FromImage" ? element(var.managed_disk_image_reference_ids, floor(count.index / var.vm_count) % var.managed_disk_count) : null
source_resource_id = element(var.managed_disk_create_options, floor(count.index / var.vm_count) % var.managed_disk_count) == "Copy" ? element(var.managed_disk_source_resource_ids, floor(count.index / var.vm_count) % var.managed_disk_count) : null
source_uri = element(var.managed_disk_create_options, floor(count.index / var.vm_count) % var.managed_disk_count) == "Import" ? element(var.managed_disk_source_uris, floor(count.index / var.vm_count) % var.managed_disk_count) : null

os_type = element(var.managed_disk_os_types, count.index)
os_type = element(var.managed_disk_os_types, floor(count.index / var.vm_count) % var.managed_disk_count)

dynamic "encryption_settings" {
for_each = var.managed_disk_encryption_settings_enabled ? [1] : []
for_each = var.managed_disk_encryption_settings_enabled != "" ? [1] : []

content {
enabled = var.managed_disk_encryption_settings_enabled
@@ -383,14 +400,14 @@ resource "azurerm_managed_disk" "this" {

content {
secret_url = var.managed_disk_encryption_key_secret_url
source_valut_id = var.managed_disk_encryption_key_source_vault_id
source_vault_id = var.managed_disk_encryption_key_source_vault_id
}
}

dynamic "key_encryption_key" {
for_each = var.managed_disk_key_encryption_key_source_valut_id != "" ? [1] : []

content = {
content {
key_url = var.managed_disk_key_encryption_key_key_url
source_vault_id = var.managed_disk_key_encryption_key_source_valut_id
}
@@ -408,15 +425,15 @@ resource "azurerm_managed_disk" "this" {
}

resource "azurerm_virtual_machine_data_disk_attachment" "this" {
count = local.data_disk_attachement ? var.managed_disk_count : 0
count = var.enabled && var.vm_count > 0 ? var.managed_disk_count * var.vm_count : 0

managed_disk_id = element(azurerm_managed_disk.this.*.id, count.index)
virtual_machine_id = var.vm_type == "Windows" ? element(compact(concat(azurerm_windows_virtual_machine.this.*.id, var.exisiting_vm_ids)), count.index) : element(compact(concat(azurerm_linux_virtual_machine.this.*.id, var.exisiting_vm_ids)), count.index)
virtual_machine_id = var.vm_type == "Windows" ? element(concat(azurerm_windows_virtual_machine.this.*.id, [""]), count.index % var.vm_count) : element(concat(azurerm_linux_virtual_machine.this.*.id, [""]), count.index % var.vm_count)

lun = count.index
caching = element(var.managed_disk_cachings, count.index)
create_option = element(var.managed_disk_create_options, count.index)
write_accelerator_enabled = element(var.managed_disk_write_accelerator_enableds, count.index)
caching = element(var.managed_data_disk_cachings, floor(count.index / var.vm_count) % var.managed_disk_count)
create_option = element(var.managed_data_disk_create_options, floor(count.index / var.vm_count) % var.managed_disk_count)
write_accelerator_enabled = element(var.managed_data_disk_write_accelerator_enableds, floor(count.index / var.vm_count) % var.managed_disk_count)
}

###
@@ -424,16 +441,16 @@ resource "azurerm_virtual_machine_data_disk_attachment" "this" {
###

resource "azurerm_virtual_machine_extension" "this_extension" {
count = var.enabled && var.vm_extensions_enabled ? length(var.vm_extension_names) : 0
name = element(var.vm_extension_names, count.index)
type = element(var.vm_extension_types, count.index)
settings = element(var.vm_extension_settings, count.index)
publisher = element(var.vm_extension_publishers, count.index)
protected_settings = elementt(var.vm_extension_protected_settings, count.index)
virtual_machine_id = var.vm_type == "Windows" ? element(azurem_windows_virtual_machine.this.*.id, count.index) : element(azurerm_linux_virtual_machine.this.*.id, count.index)
type_handler_version = element(var.vm_extension_type_handler_versions, count.index)
auto_upgrade_minor_version = element(var.vm_extension_auto_upgarde_minor_version, count.index)
count = var.enabled && var.vm_extensions_enabled ? var.vm_extension_count * var.vm_count : 0
name = element(var.vm_extension_names, floor(count.index / var.vm_count) % var.vm_extension_count)
type = element(var.vm_extension_types, floor(count.index / var.vm_count) % var.vm_extension_count)
settings = element(var.vm_extension_settings, floor(count.index / var.vm_count) % var.vm_extension_count)
publisher = element(var.vm_extension_publishers, floor(count.index / var.vm_count) % var.vm_extension_count)
protected_settings = element(var.vm_extension_protected_settings, floor(count.index / var.vm_count) % var.vm_extension_count)
virtual_machine_id = var.vm_type == "Windows" ? element(concat(azurerm_windows_virtual_machine.this.*.id, [""]), count.index % var.vm_count) : element(concat(azurerm_linux_virtual_machine.this.*.id, [""]), count.index % var.vm_count)
type_handler_version = element(var.vm_extension_type_handler_versions, floor(count.index / var.vm_count) % var.vm_extension_count)
auto_upgrade_minor_version = element(var.vm_extension_auto_upgarde_minor_version, floor(count.index / var.vm_count) % var.vm_extension_count)

tags = merge(
var.tags,


+ 3
- 3
outputs.tf View File

@@ -22,12 +22,12 @@ output "network_interface_private_ip_addresses" {
# Virtual Machines
###

output "ids" {
value = azurerm_virtual_machine.this.*.id
output "vm_ids" {
value = var.linux_vm_enabled != true ? azurerm_windows_virtual_machine.this.*.id : azurerm_linux_virtual_machine.this.*.id
}

output "identities" {
value = azurerm_virtual_machine.this.*.identity
value = var.linux_vm_enabled != true ? azurerm_windows_virtual_machine.this.*.identity : azurerm_linux_virtual_machine.this.*.identity
}

###


+ 297
- 133
variables.tf View File

@@ -9,7 +9,7 @@ variable "enabled" {

variable "resource_group_location" {
description = "Specifies the supported Azure location where the resources exist. Changing this forces a new resource to be created."
default = ""
default = "eastus"
}

variable "resource_group_name" {
@@ -24,7 +24,7 @@ variable "tags" {

variable "num_suffix_digits" {
description = "How many digits to use for resources names."
default = 2
default = 0
}

###
@@ -56,6 +56,11 @@ variable "availability_set_platform_update_domain_count" {
default = 5
}

variable "availability_set_proximity_placement_group_id" {
description = "The ID of the proximity placement group to which the virtual machine should be assigned. Changing this forces a new resource to be created."
default = ""
}

variable "availability_set_platform_fault_domain_count" {
description = "Specifies the number of fault domains that are used."
default = 2
@@ -130,6 +135,12 @@ variable "network_interface_ip_configuration_names" {
default = [""]
}

variable "network_interface_ip_configuration_primary" {
description = "Boolean flag which describes if ip configuration is primary one or not. Must be `true` for the first `ip_configuration` when multiple are specified. Defaults to `fasle`."
type = list(bool)
default = [true]
}

variable "network_interface_ip_configuration_subnet_ids" {
description = "Reference to subnets in which this NICs have been created. Required when private_ip_address_versions is IPv4. Careful: this defines all the IP configurations meaning network_interface_count times vm_count."
type = list(string)
@@ -252,102 +263,159 @@ variable "marketplace_agreement_plans" {
# Virtual Machine
###

variable "additional_capabilities_ultra_ssd_enabled" {
description = "Should Ultra SSD disk be enabled for this Virtual Machine?"
default = false
variable "vm_count" {
description = "How many Virtual Machines to create."
default = 1
}

variable "additional_unattend_config_setting_name" {
description = "Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon."
default = "FirstLogonCommands"
variable "vm_names" {
description = "Specifies the names of the Virtual Machine. Changing this forces a new resource to be created."
type = list(string)
default = ["vm"]
}

variable "additional_unattend_config_content" {
description = "Specifies the base-64 encoded XML formatted content that is added to the unattend.xml file for the specified path and component."
default = ""
variable "vm_size" {
description = "Specifies the size of the Virtual Machines. https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes?toc=%2Fazure%2Fvirtual-machines%2Fwindows%2Ftoc.json."
default = "Standard_B2ms"
}

variable "boot_diagnostics_enabled" {
description = "Should Boot Diagnostics be enabled for this Virtual Machine?"
variable "zone_enabled" {
description = "Boolean flag which describes whether or not enable the zone. Changing this will force a new resource to be created."
default = false
}

variable "boot_diagnostics_storage_uri" {
description = "The Storage Account's Blob Endpoint which should hold the virtual machine's diagnostic files."
default = ""
variable "zone" {
description = "The zone in which the virtual machine should be created. Changing this forces a new resource to be created."
type = number
default = null
}

variable "delete_os_disk_on_termination" {
description = "Should the OS Disk (either the Managed Disk / VHD Blob) be deleted when the Virtual Machine is destroyed?"
default = false
variable "allow_extension_operations" {
description = "Boolean flag whcih provides the information about should the extension operations be allowed on the virtual machine? Chaning this forces a new resource to be created."
default = true
}

variable "delete_data_disks_on_termination" {
description = "Should the Data Disks (either the Managed Disks / VHD Blobs) be deleted when the Virtual Machine is destroyed?"
default = false
variable "priority" {
description = "Specfies the priority of the virtual machine. Posssible values are `regular` an `Spot`. Defaults to `Regular`. Changing this forces a new resourec to be created."
default = "Regular"
}

variable "license_type" {
description = "Specifies the BYOL Type for this Virtual Machine. This is only applicable to Windows Virtual Machines. Possible values are Windows_Client and Windows_Server."
default = "Windows_Server"
variable "custom_data" {
description = "The Base64-Encoded custom data which should be used for the virtual machine. Changing this forces a new resource to be created."
default = null
}

variable "name" {
description = "Specifies the name of the Virtual Machine. Changing this forces a new resource to be created."
default = "vm"
variable "computer_names" {
description = "Specifies the hostname which should be used for the virtual machine.If unspecified this defaults to the value of `vm_names` filed. Changing this forces a new resource to be created."
type = list(string)
default = [null]
}

variable "os_profile_admin_username" {
description = "Specifies the name of the local administrator account."
default = "testadmin"
variable "max_bid_price" {
description = "The maximum price youre willing to pay for the vitual machine, in US Dollard; which must be greater tha the current spot price. If this bid price falls below the current spot price the virtual machine will be evicted using the `evction_policy`. Defaults to `-1`, which means that the virtual machine should not be evicted for the price reason."
default = "-1"
}

variable "os_profile_admin_password" {
description = "The password associated with the local administrator account."
default = "Passw0rd_TO_BE_CHANGED!"
variable "eviction_policy" {
description = "Specifies what should happen when the virtual machine is evicted for the price reason when using the spot instance. At this time only supported value is `Deallocate`. Changing this forces a new resource to be created."
default = "Deallocate"
}

variable "os_profile_custom_data" {
description = "Specifies custom data to supply to the machine. On Linux-based systems, this can be used as a cloud-init script. On other systems, this will be copied as a file on disk. Internally, Terraform will base64 encode this value before sending it to the API. The maximum length of the binary array is 65535 bytes."
default = ""
variable "source_image_id" {
description = "The ID of the image which the virtual machine should be created from. Changing this forces a new resource to be created."
default = null
}

variable "os_profile_linux_config_disable_password_authentication" {
description = "Specifies whether password authentication should be disabled. If set to false, an admin_password must be specified."
default = true
variable "dedicated_host_enabled" {
description = "Boolean flag which describes whether the Decicated host id enabled or not."
default = false
}

variable "os_profile_linux_config_ssh_keys" {
description = "One or more ssh_keys blocks. This field is required if disable_password_authentication is set to true."
default = []
type = list(object({ key_data = string }))
variable "dedicated_host_ids" {
description = "The list IDs of a dedicated host where th emachien should be run on. Changing this forces a new resource to be created."
type = list(string)
default = [null]
}

variable "provision_vm_agent" {
description = "Boolean flag which descibes should the Azure VM agent to provisioned on the virtual machine or not. Defaults to `true`. Changing this forces a new resource to be created."
default = true
}

variable "proximity_placement_group_id" {
description = "The ID of the proximity placement group which the virtual machine should be assigned to. Changing this forces a new resource to be created."
default = null
}

variable "os_profile_windows_config_provision_vm_agent" {
description = "Should the Azure Virtual Machine Guest Agent be installed on this Virtual Machine?"
variable "additional_capabilities_ultra_ssd_enabled" {
description = "Should Ultra SSD disk be enabled for this Virtual Machine?"
default = false
}

variable "os_profile_windows_config_enable_automatic_upgrades" {
description = "Are automatic updates enabled on this Virtual Machine?"
variable "boot_diagnostics_enabled" {
description = "Boolean flag which describes whether or not enable the boot diagnostics setting for the virtual machine."
default = false
}

variable "os_profile_windows_config_timezone" {
description = "Specifies the time zone of the virtual machine"
default = "UTC"
variable "boot_diagnostics_storage_account_uri" {
description = "The Storage Account's Blob Endpoint which should hold the virtual machine's diagnostic files."
default = ""
}

variable "os_profile_secrets_source_vault_id" {
description = "Specifies the ID of the Key Vault to use."
default = ""
variable "source_image_reference_publisher" {
description = "Specifies the publisher of the image used to create the virtual machine. Changing this forces a new resource to be created."
default = "MicrosoftWindowsServer"
}

variable "os_profile_secrets_vault_certificates" {
description = "One or more vault_certificates blocks."
default = []
type = list(object({ certificate_url = string, certificate_store = string }))
variable "source_image_reference_offer" {
description = "Specifies the offer of the image used to create the virtual machine. Changing this forces a new resource to be created."
default = "WindowsServer"
}

variable "source_image_reference_sku" {
description = "Specifies the SKU of the image used to create the virtual machine. Changing this forces a new resource to be created."
default = "2016-Datacenter"
}

variable "source_image_reference_version" {
description = "Specifies the version of the image used to create the virtual machine. Changing this forces a new resource to be created."
default = "latest"
}

variable "identity_types" {
description = "The list of types of Managed identity which should be assigned to the virtual machine. Possible values are `systemassigned`, `UserAssigned` and `SustemAssigned,UserAssigned`."
default = [""]
}

variable "identity_identity_ids" {
description = "A list of list of User managed identity ID's which should be assigned to the virtual machine."
type = list(list(string))
default = [null]
}

variable "os_disk_caching" {
description = "Specifies the caching requirements for the OS Disk. Possible values include None, ReadOnly and ReadWrite."
default = "ReadWrite"
}

variable "os_disk_size_gb" {
description = "Specifies the size of the OS Disk in gigabytes."
default = 30
}

variable "os_disk_storage_account_type" {
description = "The type of storage account which should back the internal OS disk. Possible values are `Standard_LRS`, `StandardSSD_LRS` and `Premium_LRS`. Changing this forces a new resource to be created."
default = "Standard_LRS"
}

variable "os_disk_encryption_set_id" {
description = "The ID of the Disk encryption set which should be used to encrypt the OS disk. `NOTE: The Disk encryption set must have the `READER` role assignmnet scoped on the key vault- in addition to an access policy to the key vault`."
default = null
}

variable "diff_disk_settings_option" {
description = "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."
default = ""
}

variable "plan_name" {
@@ -365,109 +433,103 @@ variable "plan_product" {
default = ""
}

variable "storage_image_reference_id" {
description = "Specifies the ID of the Custom Image which the Virtual Machine should be created from. Changing this forces a new resource to be created."
variable "secret_key_vault_id" {
description = "The ID of the key vault from which all secrets should be sourced."
default = ""
}

variable "storage_image_reference_publisher" {
description = "Specifies the publisher of the image used to create the virtual machine. Changing this forces a new resource to be created."
default = "Canonical"
}

variable "storage_image_reference_offer" {
description = "Specifies the offer of the image used to create the virtual machine. Changing this forces a new resource to be created."
default = "UbuntuServer"
variable "certificate_url" {
description = "The Secret URL of the Key vault certificate."
default = ""
}

variable "storage_image_reference_sku" {
description = "Specifies the SKU of the image used to create the virtual machine. Changing this forces a new resource to be created."
default = "18.04-LTS"
variable "vm_tags" {
description = "Tags specific to the Virtual Machines."
default = {}
}

variable "storage_image_reference_version" {
description = "Specifies the version of the image used to create the virtual machine. Changing this forces a new resource to be created."
default = "latest"
}
###
# Windows virtual machine
###

variable "storage_os_disk_create_option" {
description = "Specifies how the OS Disk should be created. Possible values are Attach (managed disks only) and FromImage."
default = "FromImage"
variable "windows_vm_enabled" {
description = "Whether or not create windows virtual machine."
default = false
}

variable "storage_os_disk_name" {
description = "Specifies the name of the OS Disk. If empty, the name of the VMs will be used as names for the disks."
default = ""
variable "windows_admin_username" {
description = "Specifies the name of the windows virtual machine local administrator account."
default = "testadmin"
}

variable "storage_os_disk_caching" {
description = "Specifies the caching requirements for the OS Disk. Possible values include None, ReadOnly and ReadWrite."
default = "ReadWrite"
variable "windows_admin_password" {
description = "The windows virtual machine password associated with the local administrator account."
default = "Passw0rd_TO_BE_CHANGED!"
}

variable "storage_os_disk_size_gb" {
description = "Specifies the size of the OS Disk in gigabytes."
default = 30
variable "windows_timezone" {
description = "Specifies the timezone which should be used by the virtual machine. The possible values are defined over here: https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/ "
default = "UTC"
}

variable "storage_os_managed_disk_type" {
description = "Specifies the type of Managed Disk which should be created. Possible values are Standard_LRS, StandardSSD_LRS or Premium_LRS."
default = "Standard_LRS"
variable "windows_license_type" {
description = "Specifies the type of on-premise license (also know as `Azure Hybrid Use Benefits`) which should be used for the virtual machine. Possible values are `None`, `Windows_client` and `Windows_Server`. Changing this forces a new resource to be created."
default = ""
}

variable "storage_os_write_accelerator_enabled" {
description = "Specifies if Write Accelerator is enabled on the disk. This can only be enabled on Premium_LRS managed disks with no caching and M-Series VMs."
variable "windows_enable_automatic_updates" {
description = "Specifies if the automatic updates are enabled for the windows virtual machine. Changing this forces a new resource to be created."
default = false
}

variable "storage_os_disk_managed_disk_create_option" {
description = "The method to use when creating the managed disk. Changing this forces a new resource to be created. For the OS disk. Possible values include: Empty, FromImage, Copy, Import, Restore."
default = "FromImage"
variable "additional_unattend_content_windows_setting" {
description = "Specifies the name of the setting to which the content applies. Possible values are: `FirstLogonCommands` and `AutoLogon`."
default = "FirstLogonCommands"
}

variable "storage_os_disk_managed_disk_source_resource_id" {
description = "Copy an existing managed disk or snapshot. For the OS disk. Only when storage_os_disk_managed_disk_create_option = Copy."
variable "additional_unattend_content_windows_content" {
description = "Specifies the base-64 encoded XML formatted content that is added to the unattend.xml file for the specified path and component."
default = ""
}

variable "storage_os_disk_managed_disk_source_uri" {
description = "Import a VHD file in to the managed disk. For the OS disk. Only when storage_os_disk_managed_disk_create_option = Import."
variable "windows_certificate_store" {
description = "The certificate store on the windows virtual machine where the certificate should be added."
default = ""
}

variable "vm_count" {
description = "How many Virtual Machines to create."
default = 1
variable "winrm_listener_protocol" {
description = "Specifies the protocol of listener. Possible values are `Http` or `Https`."
default = "Http"
}

variable "vm_type" {
description = "The type of Virtual Machines to create. Can be either \"Linux\" or \"Windows\"."
default = "Linux"
variable "winrm_listener_certificate_url" {
description = "The ID of the Key Vault Secret which contains the encrypted Certificate which should be installed on the Virtual Machine. This certificate must also be specified in the vault_certificates block within the os_profile_secrets block."
default = ""
}

variable "vm_size" {
description = "Specifies the size of the Virtual Machines. https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes?toc=%2Fazure%2Fvirtual-machines%2Fwindows%2Ftoc.json."
default = "Standard_B2ms"
}
###
# Linux virtual machine
###

variable "vm_tags" {
description = "Tags specific to the Virtual Machines."
default = {}
variable "linux_vm_enabled" {
description = "Boolean flag which describes whether or not enable the linux virtual machine resource."
default = false
}

variable "winrm_protocol" {
description = "Specifies the protocol of listener. Possible values are HTTP or HTTPS."
default = "HTTPS"
variable "linux_admin_username" {
description = "Specifies the name of the linux virtual machine local administrator account."
default = "testadmin"
}

variable "winrm_certificate_url" {
description = "The ID of the Key Vault Secret which contains the encrypted Certificate which should be installed on the Virtual Machine. This certificate must also be specified in the vault_certificates block within the os_profile_secrets block."
variable "linux_admin_password" {
description = "The linux virtual machine password associated with the local administrator account. `NOTE`: When an admin_password is specified disable_password_authentication must be set to `false`."
default = ""
}

variable "machine_extension_name" {
description = "The name of the virtual machine extension peering. Changing this forces a new resource to be created."
default = "machine-ext"
variable "linux_admin_ssh_keys" {
description = "One or more admin ssh_key blocks. `NOTE`: One of either `admin_password` or `admin_ssh_key must be specified`."
type = list(object({ public_key = string, username = string }))
default = [null]
}

###
@@ -503,18 +565,6 @@ variable "managed_disk_create_options" {
default = ["Empty"]
}

variable "managed_disk_cachings" {
description = "Specifies the caching requirements for the Managed Disks. Possible values include None, ReadOnly and ReadWrite."
type = list(string)
default = ["ReadWrite"]
}

variable "managed_disk_write_accelerator_enableds" {
description = "Specifies if Write Accelerator is enabled on Managed Disks. This can only be enabled on Premium_LRS managed disks with no caching and M-Series VMs."
type = list(bool)
default = [false]
}

variable "managed_disk_image_reference_ids" {
description = "IDs of an existing platform/marketplace disk image to copy when create_option is FromImage. CAREFUL: if you create multiple Managed Disks with different create_option, make sure this list matches with the disks having \"FromImage\" on (meaning this list may have empty values)."
type = list(string)
@@ -536,10 +586,124 @@ variable "managed_disk_source_uris" {
variable "managed_disk_os_types" {
description = "Specify values when the source of an Import or Copy operation targets a source that contains an operating system. Valid values inside the list are Linux or Windows. CAREFUL: if you create multiple Managed Disks with different create_option, make sure this list matches with the disks having \"Copy\"/\"Import\" on (meaning this list may have empty values)."
type = list(string)
default = ["Linux"]
default = ["Windows"]
}

variable "managed_disk_encryption_settings_enabled" {
description = "Boolean flag which describes whether the encryption is enabled on the managed disk or not. Changing this forces a new resource to be created."
type = bool
default = false
}

variable "managed_disk_encryption_key_secret_url" {
description = "Refeerence to the URL of the key vault secret used as the disk encryption key. This can be found as `id` on the `azurerm_key_vault_secret` resource."
type = string
default = ""
}

variable "managed_disk_encryption_key_source_vault_id" {
description = "The URl of the key vault. This can be found as `Vault_uri` on the `azurerm_key_vault` resource."
type = string
default = ""
}

variable "managed_disk_key_encryption_key_key_url" {
description = "The URL to the key vault key used as the key encryption key. This can be found as `id` on the `azurerm_key_vault_key` resource."
type = string
default = ""
}

variable "managed_disk_key_encryption_key_source_valut_id" {
description = "The ID of the source key vault."
type = string
default = ""
}

variable "managed_data_disk_cachings" {
description = "Specifies the caching requirements for the Managed Disks. Possible values include None, ReadOnly and ReadWrite."
type = list(string)
default = ["ReadWrite"]
}

variable "managed_data_disk_write_accelerator_enableds" {
description = "Specifies if Write Accelerator is enabled on Managed Disks. This can only be enabled on Premium_LRS managed disks with no caching and M-Series VMs."
type = list(bool)
default = [false]
}

variable "managed_data_disk_create_options" {
description = "Specifies the list of create option of the data disk such as `Empty` or `Attach`. Defaults to `Attach`. Changing this forces a new resource to be created."
type = list(string)
default = ["Attach"]
}

variable "vm_type" {
description = "The type of Virtual Machine. Can be either \"Linux\" or \"Windows\"."
default = "Windows"
}

variable "managed_disk_tags" {
description = "Tags specific to the Managed Disks."
default = {}
}

###
# Virtual machine extensions
###

variable "vm_extensions_enabled" {
description = "Booelan flag which describes whether or not to enable the virtual machine extensions."
default = false
}

variable "vm_extension_count" {
description = "How many extensions have to be configured to EACH virtual machine."
type = number
default = 1
}

variable "vm_extension_names" {
description = "The list of names of virtual machine extension peering. Changing this forces a new resource to be created."
type = list(string)
default = [""]
}

variable "vm_extension_types" {
description = "List which specifies the type of extension, available types for a publisher can be found using Azure CLI. `NOTE`: The `Publisher` and `Type` of virtual machine extension can be found using the Azure CLI, via: `shell $ az vm extension image list --location westus -o table`."
type = list(string)
default = [""]
}

variable "vm_extension_settings" {
description = "List of settings passed to the extension, these are specified as a JSON object in a string. Please `Note`: Certain VM Extensions require that the keys in the `settings` block are case sensitive. If you're seeing unhelpful errors, please ensure the keys are consistent with how Azure is expecting them (for instance, for the `JsonADDomainExtension extension`, the keys are expected to be in `TitleCase`.)."
type = list(string)
default = [""]
}

variable "vm_extension_publishers" {
description = "The List of publisher of the extensions, available publisher can be found by using the Azure CLI `via: az vm extension image list --location westus -o table`."
type = list(string)
default = [""]
}

variable "vm_extension_protected_settings" {
description = "The list of protected settings passed to the extension, like settings, these are specified as a JSON object in a string."
type = list(string)
default = [""]
}

variable "vm_extension_type_handler_versions" {
description = "Specifies the list of version of the extensions to use, available versions can be found using Azure CLI."
type = list(string)
default = [""]
}

variable "vm_extension_auto_upgarde_minor_version" {
description = "Boolean flag list which describes if the platform deploys the latest minor version update to the `type_handler_version` specified."
default = [false]
}

variable "vm_extension_tags" {
description = "Tags which will be associated to the virtual machine extensions."
default = {}
}

Loading…
Cancel
Save