-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.tf
28 lines (26 loc) · 982 Bytes
/
main.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
resource "cosmic_instance" "default" {
name = var.name
affinity_group_ids = var.affinity_group_ids
disk_controller = var.disk_controller
expunge = true
ip_address = var.ip_address
network_id = var.network_id
optimise_for = lower(var.os_type) == "windows" ? "Windows" : "Generic"
root_disk_size = var.root_disk_size
service_offering = var.service_offering
template = var.template
user_data = var.user_data
lifecycle {
ignore_changes = [template, user_data]
}
}
resource "cosmic_disk" "default" {
for_each = var.disks
name = each.key
attach = true
device_id = try(each.value.device_id, null)
disk_controller = try(each.value.disk_controller, "SCSI")
disk_offering = try(each.value.disk_offering, var.disk_offering, null)
size = each.value.size
virtual_machine_id = cosmic_instance.default.id
}