Skip to content

This module deploys an LXC container on ProxmoxVE host, with optional firewall configuration and LXC template download from URL.

Notifications You must be signed in to change notification settings

f1uff3h/terraform-bpg-pve-lxc

Repository files navigation

terraform-bpg-pve-lxc

Based on bpg's provider

Create an LXC container on PVE using Terraform

This module deploys an LXC container on ProxmoxVE host, with optional firewall configuration and LXC template download from URL. Most variables either have defaults or inherit defaults from provider configuration. For a quick deployment only ct_node and ct_os are required.

Requirements

Name Version
terraform >= 1.4
proxmox >= 0.66
random ~> 3
time ~> 0

Providers

Name Version
proxmox >= 0.66
random ~> 3
terraform n/a
time ~> 0

Modules

No modules.

Resources

Name Type
proxmox_virtual_environment_container.ct resource
proxmox_virtual_environment_download_file.ct_template resource
proxmox_virtual_environment_firewall_options.ct_fw_opts resource
proxmox_virtual_environment_firewall_rules.ct_fw_rules resource
random_password.ct_root_pw resource
terraform_data.bootstrap_ct resource
time_sleep.wait_for_ct resource

Inputs

Name Description Type Default Required
clone_target The target container to clone.
map(object({
vm_id = optional(string)
node_name = optional(string)
datastore_id = optional(string)
}))
{} no
ct_bootstrap_script Path to script file ro run on container creation. string null no
ct_console Console settings for the container.
object({
enabled = optional(bool)
type = optional(string)
tty_count = optional(number)
})
{
"enabled": true,
"type": "shell"
}
no
ct_cpu Container CPU configuration.
object({
arch = optional(string)
cores = optional(number)
units = optional(string)
})
{} no
ct_disk Container storage.
object({
datastore = optional(string)
size = optional(number)
})
{} no
ct_dns DNS settings for the container. Map should contain maximum 1 object. Defined as map because empty dns block triggers a provider error.
object({
domain = optional(string)
servers = optional(list(string))
})
null no
ct_features Features to enable for the container.
object({
nesting = optional(bool)
fuse = optional(bool)
keyctl = optional(bool)
mount = optional(list(string))
})
{
"nesting": true
}
no
ct_fw Firewall settings for the container.
object({
enabled = optional(bool)
dhcp = optional(bool)
input_policy = optional(string)
output_policy = optional(string)
log_level_in = optional(string)
log_level_out = optional(string)
macfilter = optional(bool)
ipfilter = optional(bool)
ndp = optional(bool)
radv = optional(bool)
})
{} no
ct_fw_fsg Firewall rules that import from a security group.
map(object({
enabled = optional(bool)
iface = optional(string)
comment = optional(string)
}))
{} no
ct_fw_rules Firewall rules for the container.
map(object({
enabled = optional(bool)
action = string
direction = string
sourceip = optional(string)
destip = optional(string)
sport = optional(string)
dport = optional(string)
proto = optional(string)
log = optional(string)
comment = optional(string)
}))
{} no
ct_id The ID of the container. number null no
ct_init Initialization settings for the container.
object({
hostname = optional(string)
root_pw = optional(string)
root_keys = optional(list(string))
})
{} no
ct_mem Container memory configuration.
object({
dedicated = optional(number)
swap = optional(number)
})
{} no
ct_net_ifaces Container network interfaces.
map(object({
name = optional(string)
bridge = optional(string)
enabled = optional(bool)
firewall = optional(bool)
mac_address = optional(string)
mtu = optional(number)
rate_limit = optional(string)
vlan_id = optional(number)
ipv4_addr = optional(string)
ipv4_gw = optional(string)
ipv6_addr = optional(string)
ipv6_gw = optional(string)
}))
{} no
ct_node The node on which to create the container. string n/a yes
ct_os The template to use for the container. string null no
ct_os_type The type of the OS template. Unmanaged means PVE won't manage the container (e.g. static IPs don't get auto assigned) string "unmanaged" no
ct_os_upload Settings for uploading the OS template.
object({
datastore = optional(string)
source = optional(string)
checksum = optional(string)
checksum_alg = optional(string)
decomp_alg = optional(string)
file_name = optional(string)
overwrite = optional(bool)
overwrite_unmanaged = optional(bool)
timeout = optional(number)
verify = optional(bool)
})
{} no
ct_pool The pool in which to create the container. string null no
ct_protection Whether protection is enabled on the container. bool false no
ct_ssh_privkey File containing ssh private key to be used for container bootstrap. string null no
ct_start The start settings for the container.
object({
on_deploy = bool
on_boot = bool
order = optional(number)
up_delay = optional(number)
down_delay = optional(number)
})
{
"down_delay": 0,
"on_boot": false,
"on_deploy": true,
"order": 0,
"up_delay": 0
}
no
ct_tags The tags to apply to the container. list(string) [] no
ct_template Whether the container is a template. bool false no
ct_unprivileged Whether the container should be unprivileged. bool true no

Outputs

No outputs.

About

This module deploys an LXC container on ProxmoxVE host, with optional firewall configuration and LXC template download from URL.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published