Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#35 #36 #37

Merged
merged 9 commits into from
Jun 29, 2021
1 change: 0 additions & 1 deletion terraform/dhcp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ resource "proxmox_lxc" "dhcp" {
tag = each.value.vlan_id
}
ostemplate = each.value.ostemplate
password = var.root_pass
rootfs {
storage = "ceph"
size = each.value.disk_size
Expand Down
23 changes: 23 additions & 0 deletions terraform/test_lxc_instance.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
resource "proxmox_lxc" "basic" {
count = 1
target_node = "pve1"
hostname = "provisioning-template-${count.index}.magevent.net"
ostemplate = "wowza:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz"
ssh_public_keys = var.common.ssh_public_keys
unprivileged = true

// Terraform will crash without rootfs defined
rootfs {
storage = "ceph"
size = "8G"
}

network {
name = "eth0"
ip = "dhcp"
bridge = var.magcloud.bridge_id
gw = var.magcloud.gateway
firewall = var.magcloud.firewall
tag = var.magcloud.vlan_id
}
}
30 changes: 14 additions & 16 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,30 @@ variable "common" {
EOT
}
}

variable "root_pass" {
type = string
variable "magcloud" {
type = map(string)
default = {
network_interface = "eth0"
bridge_id = "vmbr999"
cidr = "10.101.22.0/24"
gateway = "10.101.22.1"
firewall = true
vlan_id = "22"
}
}

variable "dhcp" {
type = map(map(string))
default = {
dhcp1 = {
hostname = "dhcp1"
target_node = "pve1"
vmid = "7007"
memory = "8192"
cores = "4"
memory = "1024"
cores = "1"
swap = "512"
start = true
network_interface = "eth0"
bridge_id = "vmbr999"
cidr = "10.101.22.253/24"
gateway = "10.101.22.1"
vlan_id = "22"
firewall = true
ostemplate = "wowza:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz"
disk_size = "8G"
unprivileged = true
Expand All @@ -37,16 +39,12 @@ variable "dhcp" {
hostname = "dhcp2"
target_node = "pve2"
vmid = "7008"
memory = "8192"
cores = "4"
memory = "1024"
cores = "1"
swap = "512"
start = true
network_interface = "eth0"
bridge_id = "vmbr999"
cidr = "10.101.22.254/24"
gateway = "10.101.22.1"
vlan_id = "22"
firewall = true
ostemplate = "wowza:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz"
disk_size = "8G"
unprivileged = true
Expand Down