Skip to content

About

多云 Terraform 示例:AWS · GCP · Aliyun · vSphere — 计算、网络、负载均衡的生产级最小可运行配置

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Examples

多云基础设施即代码(IaC)示例,覆盖 AWS / GCP / Aliyun / vSphere,提供计算、网络、负载均衡等常见场景的生产级最小可运行配置。

模块

目录 云平台 内容
aws/ec2/ AWS EC2 实例 + 弹性 IP + 安全组(SSH)+ S3 远端 State
aws/alb/ AWS ALB + HTTPS 监听器 + 目标组 + 健康检查 + CORS + 按域名路由
gcp/compute/ GCP GCE 实例 + 静态外部 IP + 防火墙 + Shielded VM + GCS 后端
gcp/loadbalancing/ GCP 全局 HTTPS 转发 + URL Map + 后端服务 + CORS 策略
aliyun/ecs/ Aliyun ECS 包月实例 + 弹性公网 IP + ESSD 加密云盘 + 自动续费
vsphere/vm/ vSphere Cloud Image 模板克隆 + cloud-init 注入(userdata/metadata)

快速上手

  1. 进入目标模块目录:
cd aws/ec2
  1. 编辑 main.tf,替换所有 # <-- 标记的占位值(profile、region、VPC ID、证书 ARN 等)。

  2. 执行:

terraform init
terraform plan
terraform apply

运维提示

  • 生产环境务必使用远端 State(S3 / GCS)并启用锁定,避免并发写入冲突。
  • 每次 apply 前先 plan,仔细审查变更摘要。
  • 为所有资源统一打标签(tags / labels),便于计费归属。
  • 凭据通过环境变量或 Vault 注入,不要写入 .tf 文件。
  • 定期更新 Provider 版本。

展示页

本仓库包含一个 index.html 介绍页,可直接部署到 Cloudflare Pages:

  1. 在 Cloudflare Pages 控制台连接此仓库。
  2. 输出目录设为 /,无需构建命令。
  3. 每次 push 自动部署。

About

多云 Terraform 示例:AWS · GCP · Aliyun · vSphere — 计算、网络、负载均衡的生产级最小可运行配置

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages