-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
60 lines (54 loc) · 1.58 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
terraform {
required_providers {
proxmox = {
source = "telmate/proxmox"
version = "3.0.1-rc1"
}
}
}
provider "proxmox" {
pm_api_url = var.proxmox_host
pm_api_token_id = var.proxmox_token_id
pm_api_token_secret = var.proxmox_token_secret
pm_tls_insecure = true
pm_debug = true
}
resource "proxmox_vm_qemu" "vm" {
for_each = { for idx, vm in local.vms : idx => vm }
name = "${each.value.name}-${var.environment}"
target_node = each.value.target_node
memory = each.value.memory
cores = each.value.cores
scsihw = "virtio-scsi-single"
full_clone = each.value.full_clone
agent = 1
qemu_os = "l26"
tags = "${var.environment};${each.value.tags}"
clone = each.value.template_name
disks {
scsi {
scsi0 {
disk {
backup = true
cache = "none"
discard = true
emulatessd = true
iothread = true
mbps_r_burst = 0.0
mbps_r_concurrent = 0.0
mbps_wr_burst = 0.0
mbps_wr_concurrent = 0.0
replicate = true
size = each.value.storage_size
storage = each.value.storage
}
}
}
}
network {
bridge = each.value.network_bridge
firewall = false
link_down = false
model = "virtio"
}
}