diff --git a/schema/azure/defaults/infrastructure/virtual-machine.yml b/schema/azure/defaults/infrastructure/virtual-machine.yml index 9ce95b5d8b..96cc966b16 100644 --- a/schema/azure/defaults/infrastructure/virtual-machine.yml +++ b/schema/azure/defaults/infrastructure/virtual-machine.yml @@ -11,7 +11,7 @@ specification: network_interface_name: SET_BY_AUTOMATION availability_set_name: SET_BY_AUTOMATION # Please don't change this default value, keep it "SET_BY_AUTOMATION" use_network_security_groups: SET_BY_AUTOMATION - security_group_association_name: SET_BY_AUTOMATION + security_group_association_name: SET_BY_AUTOMATION tags: [] os_type: linux size: Standard_DS1_v2 @@ -28,6 +28,12 @@ specification: create_option: FromImage disk_size_gb: 32 managed_disk_type: Premium_LRS + additional_disks: [] + # - storage_account_type: Premium_LRS + # create_option: Empty + # disk_size_gb: 32 + # device_name: "/dev/sdb" + # mountpoint: /var/pvs network_interface: enable_accelerated_networking: false private_ip: diff --git a/terraform/azure/infrastructure/virtual-machine.j2 b/terraform/azure/infrastructure/virtual-machine.j2 index 3d8f22316b..108ea5234b 100644 --- a/terraform/azure/infrastructure/virtual-machine.j2 +++ b/terraform/azure/infrastructure/virtual-machine.j2 @@ -85,3 +85,24 @@ resource "azurerm_virtual_machine" "{{ specification.name }}" { #TODO: # storage_data_disk } + +{%- if specification.additional_disks is defined %} + {%- for disk in specification.additional_disks %} +resource "azurerm_managed_disk" "{{ specification.name }}-data-disk-{{ loop.index }}" { + name = "{{ specification.name }}-pvs-disk-{{ loop.index }}" + location = azurerm_resource_group.rg.location + resource_group_name = azurerm_resource_group.rg.name + storage_account_type = "{{ disk.storage_account_type }}" + create_option = "{{ disk.create_option }}" + disk_size_gb = "{{ disk.disk_size_gb }}" +} + +resource "azurerm_virtual_machine_data_disk_attachment" "{{ specification.name }}-disk-attachment-{{ loop.index }}" { + managed_disk_id = azurerm_managed_disk.{{ specification.name }}-data-disk-{{ loop.index }}.id + virtual_machine_id = azurerm_virtual_machine.{{ specification.name }}.id + lun = "{{ loop.index * 10 }}" + caching = "ReadWrite" +} + + {%- endfor %} +{%- endif %}