Skip to content

Commit

Permalink
Define additional disks with defined sizes to VMs for Azure (hitachie…
Browse files Browse the repository at this point in the history
…nergy#2953)

* Additional disks for azure

* Simplify config

* add changelog note

* Change starting index value in names

* Change value of lun attribute to alling with disks indexing
  • Loading branch information
erzetpe authored and cicharka committed Apr 11, 2022
1 parent 9003c68 commit 7738653
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/changelogs/CHANGELOG-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
- [#2991](https://github.com/epiphany-platform/epiphany/issues/2991) - Add automatic backup creation for download requirements
- [#2448](https://github.com/epiphany-platform/epiphany/issues/2448) - Passwordless SSH communication for postgres user between DB nodes
- [#2821](https://github.com/epiphany-platform/epiphany/issues/2821) - Node Exporter preflight checks
<<<<<<< HEAD
- [#2996](https://github.com/epiphany-platform/epiphany/issues/2996) - Introduce the new configuration field to change a component name
=======
- [#2888](https://github.com/epiphany-platform/epiphany/issues/2888) - Define additional disks with defined sizes to VMs for Azure
>>>>>>> 91aca7b4 (Define additional disks with defined sizes to VMs for Azure (#2953))
### Fixed

Expand Down
3 changes: 3 additions & 0 deletions schema/azure/defaults/infrastructure/virtual-machine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ specification:
create_option: FromImage
disk_size_gb: 32
managed_disk_type: Premium_LRS
additional_disks: []
# - storage_account_type: Premium_LRS
# disk_size_gb: 32
network_interface:
enable_accelerated_networking: false
private_ip:
Expand Down
22 changes: 20 additions & 2 deletions terraform/azure/infrastructure/virtual-machine.j2
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ resource "azurerm_virtual_machine" "{{ specification.name }}" {
depends_on = [azurerm_network_interface_security_group_association.{{ specification.security_group_association_name }}]
{%- endif %}

#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.index0 }}" {
name = "{{ specification.name }}-data-disk-{{ loop.index0 }}"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
storage_account_type = "{{ disk.storage_account_type }}"
create_option = "Empty"
disk_size_gb = "{{ disk.disk_size_gb }}"
}

resource "azurerm_virtual_machine_data_disk_attachment" "{{ specification.name }}-disk-attachment-{{ loop.index0 }}" {
managed_disk_id = azurerm_managed_disk.{{ specification.name }}-data-disk-{{ loop.index0 }}.id
virtual_machine_id = azurerm_virtual_machine.{{ specification.name }}.id
lun = "{{ loop.index0 }}"
caching = "ReadWrite"
}
{%- endfor %}
{%- endif %}

0 comments on commit 7738653

Please sign in to comment.