initial commit
This commit is contained in:
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.terraform*
|
||||
*.log
|
||||
*.tfstate
|
||||
*.tfstate.backup
|
||||
|
||||
secret.tf
|
||||
vars.tf
|
||||
116
main.tf
Normal file
116
main.tf
Normal file
@@ -0,0 +1,116 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
proxmox = {
|
||||
source = "telmate/proxmox"
|
||||
version = "2.9.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "proxmox" {
|
||||
pm_api_url = var.proxmox_api_url
|
||||
|
||||
pm_api_token_id = var.apiTokenID
|
||||
pm_api_token_secret = var.apiToken
|
||||
|
||||
pm_tls_insecure = true
|
||||
pm_timeout = 1200
|
||||
|
||||
pm_log_enable = true
|
||||
pm_log_file = "terraform-plugin-proxmox.log"
|
||||
pm_log_levels = {
|
||||
_default = "debug"
|
||||
_capturelog = ""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resource "proxmox_vm_qemu" "k8master" {
|
||||
count = 1
|
||||
name = "FCOS-K3Master-1"
|
||||
|
||||
target_node = var.proxmox_host
|
||||
clone = var.template_name
|
||||
|
||||
pool = "${var.vm_pool}"
|
||||
|
||||
agent = 1
|
||||
os_type = "cloud-init"
|
||||
cores = 2
|
||||
sockets = 2
|
||||
cpu = "host"
|
||||
memory = 2048
|
||||
scsihw = "virtio-scsi-pci"
|
||||
bootdisk = "scsi0"
|
||||
vmid = "3120"
|
||||
|
||||
disk {
|
||||
slot = 0
|
||||
size = "10G"
|
||||
type = "scsi"
|
||||
storage = "${var.vm_storage_disk}"
|
||||
}
|
||||
|
||||
network {
|
||||
model = "virtio"
|
||||
bridge = "${var.vm_network_bridge}"
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = [
|
||||
network,
|
||||
]
|
||||
}
|
||||
|
||||
ssh_user = "${var.ssh_user}"
|
||||
sshkeys = "${var.ssh_key}"
|
||||
timeouts {
|
||||
create = "30m"
|
||||
delete = "2h"
|
||||
}
|
||||
}
|
||||
|
||||
resource "proxmox_vm_qemu" "k8runner" {
|
||||
count = 3
|
||||
name = "FCOS-K3Runner-${count.index + 1}"
|
||||
|
||||
target_node = var.proxmox_host
|
||||
clone = var.template_name
|
||||
|
||||
pool = "${var.vm_pool}"
|
||||
|
||||
agent = 1
|
||||
os_type = "cloud-init"
|
||||
cores = 2
|
||||
sockets = 2
|
||||
cpu = "host"
|
||||
memory = 2048
|
||||
scsihw = "virtio-scsi-pci"
|
||||
bootdisk = "scsi0"
|
||||
vmid = "313${count.index}"
|
||||
|
||||
disk {
|
||||
slot = 0
|
||||
size = "10G"
|
||||
type = "scsi"
|
||||
storage = "${var.vm_storage_disk}"
|
||||
}
|
||||
|
||||
network {
|
||||
model = "virtio"
|
||||
bridge = "${var.vm_network_bridge}"
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = [
|
||||
network,
|
||||
]
|
||||
}
|
||||
|
||||
ssh_user = "${var.ssh_user}"
|
||||
sshkeys = "${var.ssh_key}"
|
||||
timeouts {
|
||||
create = "30m"
|
||||
delete = "2h"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user