Upload files to "/"

This commit is contained in:
Alex Devera 2025-09-30 09:06:27 +00:00
commit 016fbf2469
3 changed files with 60 additions and 0 deletions

45
main.tf Normal file
View file

@ -0,0 +1,45 @@
terraform {
required_providers {
proxmox = {
source = "Telmate/proxmox"
version = ">= 3.0.0" # подбери подходящую версию под твой PVE
}
}
}
provider "proxmox" {
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_tls_insecure = true
}
resource "proxmox_vm_qemu" "vm" {
name = var.name
vmid = var.vmid
target_node = var.target_node
clone = var.clone_template # имя шаблона, если клонируем
os_type = "cloud-init" # если шаблон cloud-init
cpu {
cores = 2
sockets = 1
type = host
}
memory = 2048
scsihw = "virtio-scsi-single"
# пример сетевого блока
network {
id = 0
model = "virtio"
bridge = var.bridge # обычно vmbr0
}
# cloud-init параметры (если шаблон cloud-init)
ciuser = var.ci_user
cipassword = var.ci_password
ipconfig0 = var.ipconfig0 # e.g. "ip=192.168.1.50/24,gw=192.168.1.1" или "ip=dhcp"
sshkeys = file(var.ssh_pubkey_path)
# если нужно можно добавить disk {} или disks {} в зависимости от версии провайдера
}

3
terraform.tfvars Normal file
View file

@ -0,0 +1,3 @@
pm_api_url = "https://192.168.31.30:8006/api2/json"
pm_api_token_id = "tofu@pve!infra" # твой токен ID
pm_api_token_secret = "f9f493f5-c6a0-4541-9000-e747d3216516"

12
variables.tf Normal file
View file

@ -0,0 +1,12 @@
variable "pm_api_url" {}
variable "pm_api_token_id" {}
variable "pm_api_token_secret" {}
variable "target_node" { default = "pve" }
variable "name" { default = "otf-vm-1" }
variable "vmid" { default = 101 }
variable "clone_template" { default = "ubuntu-cloud-template" }
variable "bridge" { default = "vmbr0" }
variable "ci_user" { default = "alex" }
variable "ci_password" { default = "470389" }
variable "ipconfig0" { default = "ip=dhcp" }
variable "ssh_pubkey_path" { default = "~/.ssh/id_rsa.pub" }