169 lines
3.2 KiB
HCL
169 lines
3.2 KiB
HCL
# 开发环境变量定义
|
|
|
|
variable "environment" {
|
|
description = "环境名称"
|
|
type = string
|
|
default = "dev"
|
|
}
|
|
|
|
variable "project_name" {
|
|
description = "项目名称"
|
|
type = string
|
|
default = "mgmt"
|
|
}
|
|
|
|
variable "owner" {
|
|
description = "项目所有者"
|
|
type = string
|
|
default = "ben"
|
|
}
|
|
|
|
variable "cloud_providers" {
|
|
description = "要启用的云服务商列表"
|
|
type = list(string)
|
|
default = ["oracle"]
|
|
}
|
|
|
|
variable "vpc_cidr" {
|
|
description = "VPC CIDR 块"
|
|
type = string
|
|
default = "10.0.0.0/16"
|
|
}
|
|
|
|
variable "availability_zones" {
|
|
description = "可用区列表"
|
|
type = list(string)
|
|
default = ["a", "b"]
|
|
}
|
|
|
|
variable "common_tags" {
|
|
description = "通用标签"
|
|
type = map(string)
|
|
default = {
|
|
Environment = "dev"
|
|
Project = "mgmt"
|
|
ManagedBy = "terraform"
|
|
}
|
|
}
|
|
|
|
# Oracle Cloud 配置
|
|
variable "oci_config" {
|
|
description = "Oracle Cloud 配置"
|
|
type = object({
|
|
tenancy_ocid = string
|
|
user_ocid = string
|
|
fingerprint = string
|
|
private_key_path = string
|
|
region = string
|
|
compartment_ocid = optional(string)
|
|
})
|
|
default = {
|
|
tenancy_ocid = ""
|
|
user_ocid = ""
|
|
fingerprint = ""
|
|
private_key_path = ""
|
|
region = "ap-seoul-1"
|
|
compartment_ocid = ""
|
|
}
|
|
}
|
|
|
|
# 华为云配置
|
|
variable "huawei_config" {
|
|
description = "华为云配置"
|
|
type = object({
|
|
access_key = string
|
|
secret_key = string
|
|
region = string
|
|
project_id = optional(string)
|
|
})
|
|
default = {
|
|
access_key = ""
|
|
secret_key = ""
|
|
region = "cn-north-4"
|
|
project_id = ""
|
|
}
|
|
sensitive = true
|
|
}
|
|
|
|
# Google Cloud 配置
|
|
variable "gcp_config" {
|
|
description = "Google Cloud 配置"
|
|
type = object({
|
|
project_id = string
|
|
region = string
|
|
zone = string
|
|
credentials_file = string
|
|
})
|
|
default = {
|
|
project_id = ""
|
|
region = "asia-northeast3"
|
|
zone = "asia-northeast3-a"
|
|
credentials_file = ""
|
|
}
|
|
}
|
|
|
|
# AWS 配置
|
|
variable "aws_config" {
|
|
description = "AWS 配置"
|
|
type = object({
|
|
region = string
|
|
access_key = string
|
|
secret_key = string
|
|
})
|
|
default = {
|
|
region = "ap-northeast-2"
|
|
access_key = ""
|
|
secret_key = ""
|
|
}
|
|
sensitive = true
|
|
}
|
|
|
|
# DigitalOcean 配置
|
|
variable "do_config" {
|
|
description = "DigitalOcean 配置"
|
|
type = object({
|
|
token = string
|
|
region = string
|
|
})
|
|
default = {
|
|
token = ""
|
|
region = "sgp1"
|
|
}
|
|
sensitive = true
|
|
}
|
|
|
|
# HashiCorp Vault 配置 - 使用Tailscale IP而非localhost
|
|
variable "vault_config" {
|
|
description = "HashiCorp Vault 配置"
|
|
type = object({
|
|
address = string
|
|
token = string
|
|
})
|
|
default = {
|
|
address = "http://100.116.158.95:8200"
|
|
token = ""
|
|
}
|
|
sensitive = true
|
|
}
|
|
|
|
variable "vault_token" {
|
|
description = "Vault 访问令牌"
|
|
type = string
|
|
default = ""
|
|
sensitive = true
|
|
}
|
|
|
|
# SSH 公钥配置
|
|
variable "ssh_public_key" {
|
|
description = "SSH 公钥,用于访问云实例"
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
# Nomad 配置
|
|
variable "nomad_encrypt_key" {
|
|
description = "Nomad 集群加密密钥"
|
|
type = string
|
|
default = ""
|
|
sensitive = true
|
|
} |