Ajout de terraform

master
guppy 2023-04-24 16:41:15 +02:00
parent bb49a010d0
commit 20a72b0ce9
4 changed files with 108 additions and 8 deletions

View File

@ -1,9 +1,9 @@
$ANSIBLE_VAULT;1.1;AES256
37353062626136633932333231313436353531633263633638383037626231666339316565613861
3964666562613834633161656333323731633436653063320a396464646163643764373861353534
30343161363132326437326364636365613564376466666339633935623636633664316364336537
3838643439336165370a343338336364326538316532373161356433333933323437616639343032
66306162316261613965343830343638613235353133613130393238316336333437663838613535
62373531363961666433336537333637376263353238666662626633313264373365633831363237
66373461356637613837336230623431303138353166656335343864656535633961623239643436
61393761323032643237
30353263373166633833613433616631393336336263623035646263366632333033623565613062
3338333562343531623637306632633431363166643932310a626138366233653636643935653866
31343130333562313337396339346434323465636332313238666433356664306136653235396230
3865646339376535330a393862353163616665383065343838663662356235373333336566346633
36356466353866363835376637373638663933373463333362313137363863313766613366306337
39383162366361616264396130303436626639306133386466316564363966383138326236333933
38363264343039353830303361656238383866373661313731653039623132623432396665346234
61373532343863613836

65
terraform/main.tf 100644
View File

@ -0,0 +1,65 @@
resource "proxmox_vm_qemu" "control_plane" {
count = 1
name = "control-plane-${count.index}.k8s.cluster"
target_node = "${var.pm_node}"
clone = "debian-11-cloudinit-template"
os_type = "cloud-init"
cores = 2
sockets = "1"
cpu = "host"
memory = 2048
scsihw = "virtio-scsi-pci"
bootdisk = "scsi0"
disk {
size = "20G"
type = "scsi"
storage = "local-lvm"
iothread = 1
}
network {
model = "virtio"
bridge = "vmbr0"
}
# cloud-init settings
# adjust the ip and gateway addresses as needed
ipconfig0 = "ip=192.168.0.11${count.index}/24,gw=192.168.0.1"
sshkeys = file("${var.ssh_key_file}")
}
resource "proxmox_vm_qemu" "worker_nodes" {
count = 3
name = "worker-${count.index}.k8s.cluster"
target_node = "${var.pm_node}"
clone = "debian-11-cloudinit-template"
os_type = "cloud-init"
cores = 2
sockets = "1"
cpu = "host"
memory = 2048
scsihw = "virtio-scsi-pci"
bootdisk = "scsi0"
disk {
size = "20G"
type = "scsi"
storage = "local-lvm"
iothread = 1
}
network {
model = "virtio"
bridge = "vmbr0"
}
# cloud-init settings
# adjust the ip and gateway addresses as needed
ipconfig0 = "ip=192.168.0.12${count.index}/24,gw=192.168.0.1"
sshkeys = file("${var.ssh_key_file}")
}

View File

@ -0,0 +1,16 @@
terraform {
required_providers {
proxmox = {
source = "telmate/proxmox"
version = "2.9.0"
}
}
}
provider "proxmox" {
pm_parallel = 1
pm_tls_insecure = true
pm_api_url = var.pm_api_url
pm_password = var.pm_password
pm_user = var.pm_user
}

View File

@ -0,0 +1,19 @@
variable "pm_api_url" {
default = "https://proxmox.local:8006/api2/json"
}
variable "pm_node" {
default = "vm"
}
variable "pm_user" {
default = ""
}
variable "pm_password" {
default = ""
}
variable "ssh_key_file" {
default = "~/.ssh/id_rsa.pub"
}