A question about documentation related to the proxmox_virtual_environment_container resource #1445
-
Hello, In the example usage, we see this:
What exactly does that comment mean? Does that mean SSH is used? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Hi @windowsrefund 👋🏼 This config mounts "/mnt/bindmounts/shared" path from the host (PVE) under "/mnt/shared" path in the container. It requires the provider to be authenticated using SSH access is not used in container resource. |
Beta Was this translation helpful? Give feedback.
-
Thanks for moving this to a discussion. OK, I figured out what you mean. Based on this provider's documentation related to authentication, we're saying either the |
Beta Was this translation helpful? Give feedback.
-
@bpg thank you so much for this plugin! I am using it to set up my homelab. I am having issues with bind-mounts though. I already (for the sake of getting it to work first) used ╷
│ Error: error waiting for container created: task "UPID:sanctum:000F4605:01503C69:67F66100:vzcreate:695:root@pam:" failed to complete with exit code: unable to create CT 695 - directory '/storage-pool/lldap-data:0' does not exist
│
│ with proxmox_virtual_environment_container.alpine_container,
│ on create_container.tf line 25, in resource "proxmox_virtual_environment_container" "alpine_container":
│ 25: resource "proxmox_virtual_environment_container" "alpine_container" { It works flawlessly with volume mounts, but I thought if I had bind-mounts, I'd be able to see the files from the host and not risk getting the volumes deleted if I un- or redeploy the container. Here's my configuration: resource "proxmox_virtual_environment_container" "alpine_container" {
# Wait for the template to be downloaded before creating the container
depends_on = [proxmox_virtual_environment_download_file.alpine_template]
...
unprivileged = true
# Container initialization settings
initialization {
hostname = var.lldap_hostname
# Network configuration
ip_config {
ipv4 {
address = "${var.lldap_ip}/24"
gateway = var.lldap_gateway
}
}
# User authentication
user_account {
keys = [
trimspace(tls_private_key.alpine_ssh_key.public_key_openssh)
]
password = random_password.alpine_password.result
}
}
# Network interface
network_interface {
...
}
# Operating system - using Alpine template
operating_system {
template_file_id = proxmox_virtual_environment_download_file.alpine_template.id
type = "alpine"
}
...
# Disk configuration (default)
disk {
datastore_id = "images-host"
size = 2
}
# Mount points for user data persistence
mount_point {
volume = "/storage-pool/lldap-data" # also tried "storage-pool:lldap-data"
path = "/data"
size = "128M"
shared = true
}
...
features {
nesting = true
}
} (I redacted all the general settings, that most likely do not play into this issue; here's the link to the full file, though it does not include any bind-mount related things as I did not commit/push them) Here's my repository, that contains most of my Terraform setup: https://github.com/divStar/homelab/ (I avoided uploading a few files). Do you have an idea why that is? |
Beta Was this translation helpful? Give feedback.
-
Ah - thank you! It works. Do you happen to know if there is a way to prevent the destruction of a volume mount when the container is destroyed? My sole reason to use bind-mounts is to have them in one place on some volume (e.g. in a ZFS pool / dataset) to know, that it will not be deleted even if for some strange reason the container is undeployed. Of course I'll set up backups and such, but restoring them into bind-mounts is easier than restoring them into those |
Beta Was this translation helpful? Give feedback.
Hi @windowsrefund 👋🏼
This config mounts "/mnt/bindmounts/shared" path from the host (PVE) under "/mnt/shared" path in the container. It requires the provider to be authenticated using
root
system user account (Linux PAM).You can find more about mount points in the Admin Guide section 11.4.4.
SSH access is not used in container resource.