generated from qbeyond/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_disk.tf
30 lines (27 loc) · 1.26 KB
/
data_disk.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
resource "azurerm_managed_disk" "data_disk" {
for_each = var.data_disks
name = lookup(var.name_overrides.data_disks, each.key, "disk-${var.virtual_machine_config.hostname}-${each.key}")
location = var.virtual_machine_config.location
resource_group_name = var.resource_group_name
zone = var.virtual_machine_config.zone
storage_account_type = each.value["storage_account_type"]
create_option = each.value["create_option"]
source_resource_id = each.value["source_resource_id"]
disk_size_gb = each.value["disk_size_gb"]
on_demand_bursting_enabled = each.value["on_demand_bursting_enabled"]
tags = var.tags
lifecycle {
prevent_destroy = true
}
}
resource "azurerm_virtual_machine_data_disk_attachment" "data_disk" {
for_each = var.data_disks
managed_disk_id = azurerm_managed_disk.data_disk[each.key].id
virtual_machine_id = azurerm_windows_virtual_machine.this.id
lun = each.value["lun"]
caching = each.value["caching"]
write_accelerator_enabled = each.value["write_accelerator_enabled"]
lifecycle {
prevent_destroy = true
}
}