45 lines
911 B
HCL

resource "proxmox_lxc" "postgresql" {
target_node = var.target_node
hostname = var.vm_hostname
ostemplate = var.ostemplate
password = "password"
ssh_public_keys = var.ssh_public_key
cores = var.lxc_resources.cores
memory = var.lxc_resources.memory
swap = var.lxc_resources.swap
rootfs {
storage = var.storage
size = var.size
}
network {
name = "eth0"
bridge = var.bridge
ip = "${var.ip_address}/24"
gw = var.gateway
firewall = true
}
start = true
connection {
type = "ssh"
host = var.ip_address
user = "root"
private_key = var.private_key
timeout = "2m"
}
provisioner "remote-exec" { # команды внутри
inline = [
"echo 'Контейнер запущен и готов'",
"apt-get update",
"apt-get install -y postgresql"
]
}
}