diff --git a/Terraform/providers.tf b/Terraform/providers.tf new file mode 100644 index 0000000..d5ad842 --- /dev/null +++ b/Terraform/providers.tf @@ -0,0 +1,16 @@ +terraform { + required_version = ">= 0.14" + required_providers { + proxmox = { + source = "registry.example.com/telmate/proxmox" + version = ">= 1.0.0" + } + } +} + +provider "proxmox" { + pm_tls_insecure = true + pm_api_url = "https://proxmox.jimsgarage.co.uk/api2/json" + pm_api_token_secret = "112e04a7-4f15-45c5-b1e1-624e90a55f8b" + pm_api_token_id = "root@pam!terraform" +} \ No newline at end of file diff --git a/Terraform/test-cloudinit.tf b/Terraform/test-cloudinit.tf new file mode 100644 index 0000000..70bb3cc --- /dev/null +++ b/Terraform/test-cloudinit.tf @@ -0,0 +1,94 @@ +resource "proxmox_vm_qemu" "cloudinit-k3s-master" { + # Node name has to be the same name as within the cluster + # this might not include the FQDN + target_node = "proxmox-dell" + desc = "Cloudinit Ubuntu" + count = 3 + onboot = true + + # The template name to clone this vm from + clone = "23.04-non-KVM" + + # Activate QEMU agent for this VM + agent = 0 + + os_type = "cloud-init" + cores = 2 + sockets = 2 + numa = true + vcpus = 0 + cpu = "host" + memory = 4096 + name = "k3s-master-0${count.index + 1}" + + cloudinit_cdrom_storage = "nvme" + scsihw = "virtio-scsi-single" + bootdisk = "scsi0" + + disks { + scsi { + scsi0 { + disk { + storage = "nvme" + size = 12 + } + } + } + } + + # Setup the ip address using cloud-init. + # Keep in mind to use the CIDR notation for the ip. + ipconfig0 = "ip=192.168.3.10${count.index + 1}/24,gw=192.168.3.1" + ciuser = "ubuntu" + nameserver = "192.168.200.11" + sshkeys = <