Files
IaC/terraform/main.tf

57 lines
1.3 KiB
HCL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
terraform {
required_providers {
# Мы явно говорим: всё, что начинается с "proxmox_", брать из bpg/proxmox
proxmox = {
source = "bpg/proxmox"
version = "0.70.0"
}
}
backend "http" {}
}
provider "proxmox" {
endpoint = var.proxmox_api_url
api_token = "${var.proxmox_api_token_id}=${var.proxmox_api_token_secret}"
insecure = true
}
resource "proxmox_virtual_machine" "k8s_nodes" {
for_each = var.vm_nodes
node_name = "pve" # ЗАМЕНИ НА СВОЁ ИМЯ НОДЫ (pve, pve1 и т.д.)
name = each.value.name
vm_id = each.value.id
cpu {
cores = 2
type = "host"
}
memory {
dedicated = 4096
}
network_device {
bridge = "vmbr0"
}
disk {
datastore_id = "local-lvm"
file_id = "local:iso/debian-13.2.0-amd64-netinst.iso" # ПРОВЕРЬ ПУТЬ В PROXMOX
interface = "virtio0"
size = 20
}
initialization {
ip_config {
ipv4 {
address = "${each.value.ip}/24"
gateway = "10.33.33.1"
}
}
user_account {
username = "ubuntu"
keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPkMcT6PGm4xwBlwwwLkzdzTF/pgtADIcdejf5xALbxQ semaphore-gitea-key"] # Твой ключ
}
}
}