initial commit

This commit is contained in:
2023-12-18 07:56:18 -06:00
commit 0e141e4b27
3 changed files with 101 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
terraform {
backend "http" {}
required_providers {
proxmox = {
source = "TheGameProfi/proxmox"
version = "2.9.15"
}
}
}
provider "proxmox" {
pm_parallel = 3
pm_tls_insecure = false
pm_api_url = var.pm_api_url
pm_api_token_id = var.pm_api_token_id
pm_api_token_secret = var.pm_api_token_secret
pm_debug = false
}

View File

@@ -0,0 +1,35 @@
resource "proxmox_vm_qemu" "master" {
count = var.master.count
ciuser = "administrator"
vmid = "${var.vlan}${var.master.ip[count.index]}"
name = "rke-m-${var.appname}${format("%02d", count.index + 1)}"
target_node = var.master.node[count.index]
clone = var.master.template
qemu_os = "other"
full_clone = true
agent = 1
cores = var.master.cores
sockets = 1
cpu = "host"
memory = var.master.memory
scsihw = "virtio-scsi-pci"
bootdisk = "scsi0"
boot = "c"
onboot = false
network {
model = "virtio"
bridge = var.bridge
tag = var.vlan
firewall = false
}
lifecycle {
ignore_changes = [
network,
]
}
#Cloud Init Settings
ipconfig0 = "ip=192.168.20.${var.master.ip[count.index]}/24,gw=192.168.20.1"
searchdomain = var.searchdomain
nameserver = var.dnsserver
sshkeys = var.sshkeys
}

View File

@@ -0,0 +1,48 @@
variable "dnsserver" {
type = string
}
variable "sshkeys" {
type = string
}
variable "vlan" {
type = number
}
variable "bridge" {
type = string
}
variable "appname" {
type = string
}
variable "searchdomain" {
type = string
}
variable "pm_api_url" {
type = string
}
variable "pm_api_token_id" {
type = string
}
variable "pm_api_token_secret" {
type = string
}
variable "master" {
description = "Defaults of master nodes in K3S"
type = object({
count = number
template = string
cores = number
memory = number
node = list(string)
ip = list(number)
})
}