mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-02 03:22:59 +00:00
* feat(core): add query url metadata endpoint to nodes client api Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(core): move storage api code to nodestorage folder Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(core): add download url api Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(storage): add resource_download_file Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(storage): finish new resource_download_file Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(storage): generate docs for new download file resource, update other docs and examples Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(storage): add basic acc tests for resource download_file Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * fix(test): lint new test file Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(storage): warning instead of error when file already exists on resource download file Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(storage): better validation in resource download file, delete upload task on error Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(storage): better err message in resource download file Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * fix(core): removed unnecessary toint in custom type bool Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * fix(storage): typo in resource download file error Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(storage): download file resource review - 1 Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * feat(storage): finish resource download file after review Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * fix(storage): error instead of warnings in parse int errors in sizeRequiresReplaceModifier Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * fix(docs): remove unwanted changes in virtual_environment_file.md Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * fix(test): fix download file base acceptance tests Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * fix(test): fix resource download file acc tests Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * fix(test): last fix resource download file acc test Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> * fix: use PVE-compatible jammy LXC image, fix few typos Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --------- Signed-off-by: Rafał Safin <rafal.safin@rafsaf.pl> Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Co-authored-by: Rafał Safin <rafal.safin@rafsaf.pl> Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
8.5 KiB
8.5 KiB
layout | title | permalink | nav_order | parent | subcategory |
---|---|---|---|---|---|
page | proxmox_virtual_environment_container | /resources/virtual_environment_container | 4 | Resources | Virtual Environment |
Resource: proxmox_virtual_environment_container
Manages a container.
Example Usage
resource "proxmox_virtual_environment_container" "ubuntu_container" {
description = "Managed by Terraform"
node_name = "first-node"
vm_id = 1234
initialization {
hostname = "terraform-provider-proxmox-ubuntu-container"
ip_config {
ipv4 {
address = "dhcp"
}
}
user_account {
keys = [
trimspace(tls_private_key.ubuntu_container_key.public_key_openssh)
]
password = random_password.ubuntu_container_password.result
}
}
network_interface {
name = "veth0"
}
operating_system {
template_file_id = proxmox_virtual_environment_file.latest_ubuntu_22_jammy_lxc_img.id
type = "ubuntu"
}
mount_point {
# bind mount, *requires* root@pam authentication
volume = "/mnt/bindmounts/shared"
path = "/mnt/shared"
}
mount_point {
# volume mount, a new volume will be created by PVE
volume = "local-lvm"
size = "10G"
path = "/mnt/volume"
}
}
resource "proxmox_virtual_environment_download_file" "latest_ubuntu_22_jammy_lxc_img" {
content_type = "vztmpl"
datastore_id = "local"
node_name = "first-node"
url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.tar.gz"
}
resource "random_password" "ubuntu_container_password" {
length = 16
override_special = "_%@"
special = true
}
resource "tls_private_key" "ubuntu_container_key" {
algorithm = "RSA"
rsa_bits = 2048
}
output "ubuntu_container_password" {
value = random_password.ubuntu_container_password.result
sensitive = true
}
output "ubuntu_container_private_key" {
value = tls_private_key.ubuntu_container_key.private_key_pem
sensitive = true
}
output "ubuntu_container_public_key" {
value = tls_private_key.ubuntu_container_key.public_key_openssh
}
Argument Reference
clone
- (Optional) The cloning configuration.datastore_id
- (Optional) The identifier for the target datastore.node_name
- (Optional) The name of the source node (leave blank, if equal to thenode_name
argument).vm_id
- (Required) The identifier for the source container.
console
- (Optional) The console configuration.enabled
- (Optional) Whether to enable the console device (defaults totrue
).mode
- (Optional) The console mode (defaults totty
).console
- Console.shell
- Shell.tty
- TTY.
tty_count
- (Optional) The number of available TTY (defaults to2
).
cpu
- (Optional) The CPU configuration.architecture
- (Optional) The CPU architecture (defaults toamd64
).amd64
- x86 (64 bit).arm64
- ARM (64-bit).armhf
- ARM (32 bit).i386
- x86 (32 bit).
cores
- (Optional) The number of CPU cores (defaults to1
).units
- (Optional) The CPU units (defaults to1024
).
description
- (Optional) The description.disk
- (Optional) The disk configuration.datastore_id
- (Optional) The identifier for the datastore to create the disk in (defaults tolocal
). -size
- (Optional) The size of the root filesystem in gigabytes ( defaults to4
). Requiresdatastore_id
to be set.
initialization
- (Optional) The initialization configuration.dns
- (Optional) The DNS configuration.domain
- (Optional) The DNS search domain.server
- (Optional) The DNS server. Theserver
attribute is deprecated and will be removed in a future release. Please use theservers
attribute instead.servers
- (Optional) The list of DNS servers.
hostname
- (Optional) The hostname.ip_config
- (Optional) The IP configuration (one block per network device).ipv4
- (Optional) The IPv4 configuration.address
- (Optional) The IPv4 address (usedhcp
for autodiscovery).gateway
- (Optional) The IPv4 gateway (must be omitted whendhcp
is used as the address).
ipv6
- (Optional) The IPv4 configuration.address
- (Optional) The IPv6 address (usedhcp
for autodiscovery).gateway
- (Optional) The IPv6 gateway (must be omitted whendhcp
is used as the address).
user_account
- (Optional) The user account configuration.keys
- (Optional) The SSH keys for the root account.password
- (Optional) The password for the root account.
memory
- (Optional) The memory configuration.dedicated
- (Optional) The dedicated memory in megabytes (defaults to512
).swap
- (Optional) The swap size in megabytes (defaults to0
).
mount_point
acl
(Optional) Explicitly enable or disable ACL support.backup
(Optional) Whether to include the mount point in backups (only used for volume mount points).mount_options
(Optional) List of extra mount options.path
(Required) Path to the mount point as seen from inside the container.quota
(Optional) Enable user quotas inside the container (not supported with ZFS subvolumes).read_only
(Optional) Read-only mount point.replicate
(Optional) Will include this volume to a storage replica job.shared
(Optional) Mark this non-volume mount point as available on all nodes.size
(Optional) Volume size (only for volume mount points). Can be specified with a unit suffix (e.g.10G
).volume
(Required) Volume, device or directory to mount into the container.
network_interface
- (Optional) A network interface (multiple blocks supported).bridge
- (Optional) The name of the network bridge (defaults tovmbr0
).enabled
- (Optional) Whether to enable the network device (defaults totrue
).firewall
- (Optional) Whether this interface's firewall rules should be used (defaults tofalse
).mac_address
- (Optional) The MAC address.mtu
- (Optional) Maximum transfer unit of the interface. Cannot be larger than the bridge's MTU.name
- (Required) The network interface name.rate_limit
- (Optional) The rate limit in megabytes per second.vlan_id
- (Optional) The VLAN identifier.
node_name
- (Required) The name of the node to assign the container to.operating_system
- (Required) The Operating System configuration.template_file_id
- (Required) The identifier for an OS template file.type
- (Optional) The type (defaults tounmanaged
).alpine
- Alpine.archlinux
- Arch Linux.centos
- CentOS.debian
- Debian.fedora
- Fedora.gentoo
- Gentoo.opensuse
- openSUSE.ubuntu
- Ubuntu.unmanaged
- Unmanaged.
pool_id
- (Optional) The identifier for a pool to assign the container to.started
- (Optional) Whether to start the container (defaults totrue
).start_on_boot
- (Optional) Automatically start container when the host system boots (defaults totrue
).tags
- (Optional) A list of tags the container tags. This is only meta information (defaults to[]
). Note: Proxmox always sorts the container tags. If the list in template is not sorted, then Proxmox will always report a difference on the resource. You may use theignore_changes
lifecycle meta-argument to ignore changes to this attribute.template
- (Optional) Whether to create a template (defaults tofalse
).unprivileged
- (Optional) Whether the container runs as unprivileged on the host (defaults tofalse
).vm_id
- (Optional) The container identifierfeatures
- (Optional) The container feature flags. Changing flags (except nesting) is only allowed forroot@pam
authenticated user.nesting
- (Optional) Whether the container is nested (defaults tofalse
)fuse
- (Optional) Whether the container supports FUSE mounts (defaults tofalse
)keyctl
- (Optional) Whether the container supportskeyctl()
system call (defaults tofalse
)mount
- (Optional) List of allowed mount types (cifs
ornfs
)
Attribute Reference
There are no additional attributes available for this resource.
Import
Instances can be imported using the node_name
and the vm_id
, e.g.,
terraform import proxmox_virtual_environment_container.ubuntu_container first-node/1234