118 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			HCL
		
	
	
	
			
		
		
	
	
			118 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			HCL
		
	
	
	
| # Nomad 多数据中心集群变量定义
 | |
| 
 | |
| variable "deploy_korea_node" {
 | |
|   description = "是否部署韩国节点 (Oracle Cloud)"
 | |
|   type        = bool
 | |
|   default     = true
 | |
| }
 | |
| 
 | |
| variable "deploy_us_node" {
 | |
|   description = "是否部署美国节点 (华为云)"
 | |
|   type        = bool
 | |
|   default     = true
 | |
| }
 | |
| 
 | |
| # Oracle Cloud 配置
 | |
| variable "oracle_config" {
 | |
|   description = "Oracle Cloud 配置"
 | |
|   type = object({
 | |
|     tenancy_ocid     = string
 | |
|     user_ocid        = string
 | |
|     fingerprint      = string
 | |
|     private_key_path = string
 | |
|     region           = string
 | |
|   })
 | |
|   sensitive = true
 | |
| }
 | |
| 
 | |
| variable "oracle_ubuntu_image_id" {
 | |
|   description = "Oracle Cloud Ubuntu 镜像 ID"
 | |
|   type        = string
 | |
|   default     = "" # 将通过数据源自动获取
 | |
| }
 | |
| 
 | |
| variable "oracle_subnet_id" {
 | |
|   description = "Oracle Cloud 子网 ID"
 | |
|   type        = string
 | |
| }
 | |
| 
 | |
| variable "oracle_security_group_id" {
 | |
|   description = "Oracle Cloud 安全组 ID"
 | |
|   type        = string
 | |
| }
 | |
| 
 | |
| # 华为云配置
 | |
| variable "huawei_config" {
 | |
|   description = "华为云配置"
 | |
|   type = object({
 | |
|     access_key = string
 | |
|     secret_key = string
 | |
|     region     = string
 | |
|   })
 | |
|   sensitive = true
 | |
| }
 | |
| 
 | |
| variable "huawei_ubuntu_image_id" {
 | |
|   description = "华为云 Ubuntu 镜像 ID"
 | |
|   type        = string
 | |
|   default     = "" # 将通过数据源自动获取
 | |
| }
 | |
| 
 | |
| variable "huawei_subnet_id" {
 | |
|   description = "华为云子网 ID"
 | |
|   type        = string
 | |
| }
 | |
| 
 | |
| variable "huawei_security_group_id" {
 | |
|   description = "华为云安全组 ID"
 | |
|   type        = string
 | |
| }
 | |
| 
 | |
| # 通用配置
 | |
| variable "common_tags" {
 | |
|   description = "通用标签"
 | |
|   type        = map(string)
 | |
|   default = {
 | |
|     Project     = "nomad-multi-dc"
 | |
|     Environment = "production"
 | |
|     ManagedBy   = "opentofu"
 | |
|   }
 | |
| }
 | |
| 
 | |
| variable "ssh_public_key" {
 | |
|   description = "SSH 公钥"
 | |
|   type        = string
 | |
| }
 | |
| 
 | |
| variable "allowed_cidr_blocks" {
 | |
|   description = "允许访问的 CIDR 块"
 | |
|   type        = list(string)
 | |
|   default     = ["0.0.0.0/0"] # 生产环境应该限制
 | |
| }
 | |
| 
 | |
| # Nomad 特定配置
 | |
| variable "nomad_version" {
 | |
|   description = "Nomad 版本"
 | |
|   type        = string
 | |
|   default     = "1.10.5"
 | |
| }
 | |
| 
 | |
| variable "nomad_encrypt_key" {
 | |
|   description = "Nomad 集群加密密钥"
 | |
|   type        = string
 | |
|   sensitive   = true
 | |
|   default     = "NVOMDvXblgWfhtzFzOUIHnKEOrbXOkPrkIPbRGGf1YQ="
 | |
| }
 | |
| 
 | |
| # 网络配置
 | |
| variable "vpc_cidr" {
 | |
|   description = "VPC CIDR 块"
 | |
|   type        = string
 | |
|   default     = "10.0.0.0/16"
 | |
| }
 | |
| 
 | |
| variable "availability_zones" {
 | |
|   description = "可用区列表"
 | |
|   type        = list(string)
 | |
|   default     = ["a", "b"]
 | |
| } |