-
-
Notifications
You must be signed in to change notification settings - Fork 125
/
resource_virtual_environment_container.tf
93 lines (73 loc) · 2.27 KB
/
resource_virtual_environment_container.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
resource "proxmox_virtual_environment_container" "example_template" {
description = "Managed by Terraform"
start_on_boot = "true"
disk {
datastore_id = element(data.proxmox_virtual_environment_datastores.example.datastore_ids, index(data.proxmox_virtual_environment_datastores.example.datastore_ids, "local-lvm"))
size = 10
}
mount_point {
// volume mount
volume = element(data.proxmox_virtual_environment_datastores.example.datastore_ids, index(data.proxmox_virtual_environment_datastores.example.datastore_ids, "local-lvm"))
size = "4G"
path = "mnt/local"
}
initialization {
dns {
servers = ["1.1.1.1", "8.8.8.8"]
}
hostname = "terraform-provider-proxmox-example-lxc-template"
ip_config {
ipv4 {
address = "dhcp"
}
}
user_account {
keys = [trimspace(tls_private_key.example.public_key_openssh)]
password = "example"
}
}
network_interface {
name = "veth0"
mtu = 1450
}
node_name = data.proxmox_virtual_environment_nodes.example.names[0]
operating_system {
template_file_id = proxmox_virtual_environment_download_file.release_20240514_ubuntu_22_jammy_lxc_img.id
type = "ubuntu"
}
pool_id = proxmox_virtual_environment_pool.example.id
template = true
// use auto-generated vm_id
tags = [
"container",
"example",
"terraform",
]
startup {
order = "3"
up_delay = "60"
down_delay = "60"
}
}
resource "proxmox_virtual_environment_container" "example" {
disk {
datastore_id = element(data.proxmox_virtual_environment_datastores.example.datastore_ids, index(data.proxmox_virtual_environment_datastores.example.datastore_ids, "local-lvm"))
}
clone {
vm_id = proxmox_virtual_environment_container.example_template.id
}
initialization {
hostname = "terraform-provider-proxmox-example-lxc"
}
mount_point {
// bind mount, requires root@pam
volume = "/mnt/bindmounts/shared"
path = "/shared"
}
node_name = data.proxmox_virtual_environment_nodes.example.names[0]
pool_id = proxmox_virtual_environment_pool.example.id
vm_id = 2043
}
output "resource_proxmox_virtual_environment_container_example_id" {
value = proxmox_virtual_environment_container.example.id
}