From 74e7d6ced9b9bd8bdf74c5407dd557a4ccbebcc3 Mon Sep 17 00:00:00 2001 From: Vezpi Date: Mon, 27 Jan 2025 14:36:15 +0000 Subject: [PATCH] add telmate-simple-vm terraform project --- terraform/telmate-simple-vm/provider.tf | 14 ++++ .../telmate-simple-vm/telmate-simple-vm.tf | 67 +++++++++++++++++++ terraform/telmate-simple-vm/variables.tf | 16 +++++ 3 files changed, 97 insertions(+) create mode 100644 terraform/telmate-simple-vm/provider.tf create mode 100644 terraform/telmate-simple-vm/telmate-simple-vm.tf create mode 100644 terraform/telmate-simple-vm/variables.tf diff --git a/terraform/telmate-simple-vm/provider.tf b/terraform/telmate-simple-vm/provider.tf new file mode 100644 index 0000000..f881103 --- /dev/null +++ b/terraform/telmate-simple-vm/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + proxmox = { + source = "telmate/proxmox" + version = "3.0.1-rc6" + } + } +} + +provider "proxmox" { + pm_api_url = var.proxmox_api_url + pm_api_token_id = var.proxmox_api_token_id + pm_api_token_secret = var.proxmox_api_token_secret +} diff --git a/terraform/telmate-simple-vm/telmate-simple-vm.tf b/terraform/telmate-simple-vm/telmate-simple-vm.tf new file mode 100644 index 0000000..d9f0190 --- /dev/null +++ b/terraform/telmate-simple-vm/telmate-simple-vm.tf @@ -0,0 +1,67 @@ + +resource "proxmox_vm_qemu" "cloudinit-test" { + name = "terraform-test-vm" + desc = "A test for using terraform and cloudinit" + tags = "test" + + target_node = "zenith" + + clone = "ubuntu-cloud" + + agent = 0 + + os_type = "cloud-init" + bios = "ovmf" + + cores = 2 + sockets = 1 + vcpus = 0 + cpu_type = "host" + memory = 2048 + + scsihw = "virtio-scsi-pci" + disks { + scsi { + scsi0 { + disk { + storage = "ceph-workload" + size = "4G" + } + } + scsi1 { + cloudinit { + storage = "ceph-workload" + } + } + } + + } + + network { + id = 0 + model = "virtio" + bridge = "vmbr0" + tag = 66 + } + + vga { + type = "std" + } + + # Setup the disk + + + # Setup the network interface and assign a vlan tag: 256 + + + # Setup the ip address using cloud-init. + boot = "order=scsi0" + # Keep in mind to use the CIDR notation for the ip. + ipconfig0 = "ip=dhcp" + ciuser = "vez" + ciupgrade = true + sshkeys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICxWxrBF6W6N2ZrzoKhTwDTZ49tlYzvki+4naHjo8DhB vez-key" + + + +} \ No newline at end of file diff --git a/terraform/telmate-simple-vm/variables.tf b/terraform/telmate-simple-vm/variables.tf new file mode 100644 index 0000000..a1f3845 --- /dev/null +++ b/terraform/telmate-simple-vm/variables.tf @@ -0,0 +1,16 @@ +variable "proxmox_api_url" { + description = "Proxmox URL endpoint" + type = string +} + +variable "proxmox_api_token_id" { + description = "Proxmox API token ID" + type = string + sensitive = true +} + +variable "proxmox_api_token_secret" { + description = "Proxmox API token secret" + type = string + sensitive = true +} \ No newline at end of file