refactor(terraform): structure directories by hypervisor (netcore/ and pve/)

This commit is contained in:
karpenok committed 2026-11-09 20:11:28 +07:00
1 parent 2b23809bc3
commit 2bc77b50f4
11 files changed
+105 -7

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/bpg/proxmox" {
version = "0.70.1"
constraints = "~> 0.70.0"
hashes = [
"h1:vd6g2B0GKtx5Q6XsJ34QzUMZMN89+wo6Z92/+eO3rjE=",
"zh:1f3ca7b12fad410a3689e30f058ce210a8f4e5a13b25c5862acb62c9a6859cd5",
"zh:2669b0548f039e874a9f84362960fb5a479144a9c5bd3c1626b3aa9ec2b41e26",
"zh:313be32be4665f0d170b4065d57e530486b575081be1e27d793c6c9ac6bb1d42",
"zh:360ace6cffba80029a14a3b155a9ffe6c55419236e6b933c011edee1c2e5fc60",
"zh:3bc6e7617ba7ed1db1a3c89242714a1a4484ead154784a8fa62633124e8ebfaa",
"zh:3cc33cedb2bafff05ddf293525e1251ea82480e8298b3bfe51a75fc0ab2e53a7",
"zh:61fba29acaed2382f58af39c920207f8d2e62f1be79caa5ef9fa5b60bd90c740",
"zh:97d1495869da236220168c818496a4b49576fab29ff7a031e41baafc82e767b6",
"zh:9ef6047197682930c8144b1faeeeb42247bf1b07048a6ac37ff18e7965df40fd",
"zh:b30d58f33159028ab9e1d62353df9443efacd920497636c573d20beb3ad6aae0",
"zh:bf931b6de0ceae50a82183ca23a314f646068495514f27fb78a9ca66b2275ad3",
"zh:e071099e8ae796a1a57ac55b3340ede4b497c2666b12a84809c3df0c7a851a42",
"zh:e35790628fd80ff201292765e28db9cacc0db194df884d37bc5bac52ed86113c",
"zh:f26e0763dbe6a6b2195c94b44696f2110f7f55433dc142839be16b9697fa5597",
"zh:f2ae152820737ca4435c0a96c74dd84fea2e0fa90a53c52658d1d3c5598af2aa",
]
}
+52
View File
@@ -0,0 +1,52 @@
resource "proxmox_virtual_environment_container" "core_net" {
description = "Managed by Terraform: core-net Ingress Gateway (Traefik)"
node_name = var.proxmox_node
vm_id = 902
unprivileged = true
started = true
initialization {
hostname = "core-net"
ip_config {
ipv4 {
address = "192.168.1.104/24"
gateway = "192.168.1.1"
}
}
user_account {
keys = var.ssh_public_keys
}
}
network_interface {
name = "eth0"
bridge = "vmbr10"
}
operating_system {
template_file_id = "local:vztmpl/debian-13-standard_13.6-1_amd64.tar.zst"
type = "debian"
}
cpu {
cores = 2
}
memory {
dedicated = 1024
swap = 512
}
disk {
datastore_id = "local-lvm"
size = 10
}
features {
nesting = true
keyctl = true
}
}
+25
View File
@@ -0,0 +1,25 @@
terraform {
required_version = ">= 1.5.0"
required_providers {
proxmox = {
source = "bpg/proxmox"
version = "~> 0.70.0"
}
}
# Хранение состояния в Gitea Package Registry (HTTP backend).
# При запуске через CI/CD параметры backend передаются через -backend-config
backend "http" {}
}
provider "proxmox" {
endpoint = var.proxmox_endpoint
api_token = var.proxmox_api_token
insecure = var.proxmox_insecure
ssh {
agent = true
}
}
+9
View File
@@ -0,0 +1,9 @@
output "core_net_id" {
description = "VMID контейнера core-net"
value = proxmox_virtual_environment_container.core_net.vm_id
}
output "core_net_ip" {
description = "IPv4 адрес контейнера core-net"
value = proxmox_virtual_environment_container.core_net.initialization[0].ip_config[0].ipv4[0].address
}
@@ -0,0 +1,7 @@
# Пример локальных переменных для разработки и тестирования
# Скопируйте в terraform.tfvars (файл уже в .gitignore)
proxmox_endpoint = "https://192.168.1.100:8006/"
proxmox_api_token = "root@pam!terraform=00000000-0000-0000-0000-000000000000"
proxmox_insecure = true
proxmox_node = "netcore"
+32
View File
@@ -0,0 +1,32 @@
variable "proxmox_endpoint" {
description = "URL Proxmox API (по умолчанию netcore)"
type = string
default = "https://192.168.1.100:8006/"
}
variable "proxmox_api_token" {
description = "API Token Proxmox в формате USER@REALM!TOKENID=UUID_SECRET"
type = string
sensitive = true
}
variable "proxmox_insecure" {
description = "Разрешить самоподписанные SSL-сертификаты Proxmox"
type = bool
default = true
}
variable "proxmox_node" {
description = "Имя ноды Proxmox"
type = string
default = "netcore"
}
variable "ssh_public_keys" {
description = "Список публичных SSH-ключей для доступа к создаваемым контейнерам"
type = list(string)
default = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF/yxhAs022l/8FlPlhyi7NeF3CvVGsev3B1HtKICO7M root_from_windows",
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEpwqB40k8QQq3k8160gfMKDaCJCX9qzvmuijfe3mO4I gitea-runner"
]
}