Initial commit: Terraform configurations for multiple cloud providers

This commit is contained in:
Ben User
2026-02-01 06:36:02 +00:00
commit 70f160b396
58 changed files with 1813 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 4.0.0"
}
}
}
provider "oci" {
# 使用 ~/.oci/config 中的配置
# 如果 ~/.oci/config 已正确配置,以下参数可以省略
# 或者显式指定配置(可选)
# tenancy_ocid = "your-tenancy-ocid"
# user_ocid = "your-user-ocid"
# fingerprint = "your-fingerprint"
# private_key_path = "~/.oci/oci_api_key.pem"
# region = "us-phoenix-1"
}
module "vcn" {
source = "../../modules/vcn"
compartment_id = var.compartment_id
vcn_name = "${var.environment}-vcn"
cidr_block = "10.1.0.0/16" # 生产环境使用不同的 CIDR
dns_label = "prodvcn"
}
module "compute" {
source = "../../modules/compute"
compartment_id = var.compartment_id
instance_name = "${var.environment}-instance"
shape = "VM.Standard4.2" # 生产环境使用更高的规格
subnet_id = "ocid1.subnet.oc1..example" # 这里应该使用实际的子网 OCID
}

View File

@@ -0,0 +1,11 @@
variable "compartment_id" {
description = "生产环境的 Compartment OCID"
type = string
default = "ocid1.compartment.oc1..example"
}
variable "environment" {
description = "环境名称"
type = string
default = "prod"
}