a0cf1e6cef
- Corrigir tipos Hetzner: CPX não existe, usar CX (Intel shared vCPU) - CX23 (2 vCPU, 4GB) equivalente ao CAX11 - CX33 (4 vCPU, 8GB) equivalente ao CAX21 - CX43 (8 vCPU, 16GB) equivalente ao CAX31 - Corrigir location no autoscaler para amd64 (nbg1→fsn1) - Remover gitlab-pool do autoscaler (substituído pelo Gitea) - Aumentar worker-pool max para 30 - Corrigir Floating IP e Load Balancer hardcoded em nbg1 - Corrigir stdin em read interativo: usar < /dev/tty e read -p - Corrigir cleanup de namespace: lidar com Terminating e finalizers - Corrigir CNPG: nome do deployment, secret e endpointURL duplo - Aulas afetadas: 08, 09, 10, 11, 12, 14, 17
95 lines
2.7 KiB
Terraform
95 lines
2.7 KiB
Terraform
############################################################
|
|
# Variables for Hetzner Talos Kubernetes Cluster
|
|
############################################################
|
|
|
|
# ==========================================================
|
|
# AUTENTICAÇÃO
|
|
# ==========================================================
|
|
|
|
variable "hcloud_token" {
|
|
type = string
|
|
description = "Hetzner Cloud API token"
|
|
sensitive = true
|
|
}
|
|
|
|
# ==========================================================
|
|
# CONFIGURAÇÃO DO CLUSTER
|
|
# ==========================================================
|
|
|
|
variable "enable_ha" {
|
|
type = bool
|
|
description = "Enable HA mode with 3 control plane nodes"
|
|
default = true
|
|
}
|
|
|
|
variable "enable_loadbalancer" {
|
|
type = bool
|
|
description = "Enable Hetzner Load Balancer for HA access to control plane and ingress"
|
|
default = true
|
|
}
|
|
|
|
variable "environment" {
|
|
type = string
|
|
description = "Environment name (prod, staging, dev)"
|
|
default = "prod"
|
|
|
|
validation {
|
|
condition = contains(["prod", "staging", "dev"], var.environment)
|
|
error_message = "Environment deve ser: prod, staging ou dev."
|
|
}
|
|
}
|
|
|
|
# ==========================================================
|
|
# SSH
|
|
# ==========================================================
|
|
|
|
variable "ssh_public_key" {
|
|
type = string
|
|
description = "Public SSH key for emergency access to nodes"
|
|
}
|
|
|
|
# ==========================================================
|
|
# TALOS
|
|
# ==========================================================
|
|
|
|
variable "talos_image_id" {
|
|
type = number
|
|
description = "ID da imagem Talos customizada na Hetzner (criada na aula-07). Obtenha com: hcloud image list --type snapshot"
|
|
}
|
|
|
|
variable "talos_version" {
|
|
type = string
|
|
description = "Talos version to use"
|
|
default = "v1.11.2"
|
|
|
|
validation {
|
|
condition = can(regex("^v[0-9]+\\.[0-9]+\\.[0-9]+$", var.talos_version))
|
|
error_message = "talos_version deve seguir o formato semântico: v1.2.3"
|
|
}
|
|
}
|
|
|
|
# ==========================================================
|
|
# ARQUITETURA
|
|
# ==========================================================
|
|
|
|
variable "arch" {
|
|
type = string
|
|
description = "Arquitetura dos nodes: arm64 (CAX - Ampere Altra, melhor custo) ou amd64 (CX - Intel, mais disponível)"
|
|
default = "arm64"
|
|
|
|
validation {
|
|
condition = contains(["arm64", "amd64"], var.arch)
|
|
error_message = "arch deve ser arm64 ou amd64."
|
|
}
|
|
}
|
|
|
|
# ==========================================================
|
|
# LABELS CUSTOMIZADAS
|
|
# ==========================================================
|
|
|
|
variable "custom_labels" {
|
|
type = map(string)
|
|
description = "Custom labels to add to all resources"
|
|
default = {}
|
|
}
|