53 lines
1.1 KiB
Terraform
53 lines
1.1 KiB
Terraform
|
|
||
|
resource "proxmox_virtual_environment_file" "this" {
|
||
|
content_type = "snippets"
|
||
|
datastore_id = "local"
|
||
|
node_name = var.proxmox_node_name
|
||
|
|
||
|
source_raw {
|
||
|
data = templatefile("${path.module}/cloud-init.tpl.cfg", {
|
||
|
hostname = "ntp-s2",
|
||
|
ipv4_addr_cidr = "192.168.43.15/24"
|
||
|
ipv4_gw = "192.168.43.254"
|
||
|
})
|
||
|
file_name = "ntp-s2.cloud-config.yaml"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resource "proxmox_virtual_environment_vm" "this" {
|
||
|
name = "ntp-s2"
|
||
|
description = "Managed by Terraform"
|
||
|
started = true
|
||
|
on_boot = true
|
||
|
|
||
|
node_name = var.proxmox_node_name
|
||
|
vm_id = var.proxmox_vmid
|
||
|
|
||
|
cpu {
|
||
|
cores = 1
|
||
|
}
|
||
|
memory {
|
||
|
dedicated = 512
|
||
|
}
|
||
|
agent {
|
||
|
enabled = true
|
||
|
}
|
||
|
|
||
|
disk {
|
||
|
datastore_id = "local-lvm"
|
||
|
file_format = "qcow2"
|
||
|
interface = "scsi0"
|
||
|
file_id = "local:iso/noble-server-cloudimg-amd64.img"
|
||
|
size = "20"
|
||
|
}
|
||
|
|
||
|
initialization {
|
||
|
user_data_file_id = proxmox_virtual_environment_file.this.id
|
||
|
datastore_id = "local-lvm"
|
||
|
}
|
||
|
|
||
|
network_device {
|
||
|
bridge = "vmbr0"
|
||
|
}
|
||
|
}
|