Terraform 项目教程:S3、CloudFront 和 Route53 的静态网站设置

Terraform 项目教程:S3、CloudFront 和 Route53 的静态网站设置

terraform-website-s3-cloudfront-route53Terraform scripts to setup an S3 based static website, with a CloudFront distribution and the required Route53 entries.项目地址:https://gitcode.com/gh_mirrors/te/terraform-website-s3-cloudfront-route53

项目目录结构及介绍

.
├── CHANGELOG.md
├── LICENSE
├── README.md
├── gitignore
├── site-main
│   ├── main.tf
│   ├── outputs.tf
│   └── variables.tf
├── site-redirect
│   ├── main.tf
│   ├── outputs.tf
│   └── variables.tf
└── r53-cname
    ├── main.tf
    ├── outputs.tf
    └── variables.tf
  • CHANGELOG.md: 记录项目的变更历史。
  • LICENSE: 项目的许可证信息。
  • README.md: 项目的基本介绍和使用说明。
  • gitignore: Git 忽略文件配置。
  • site-main: 主站点配置模块。
    • main.tf: 主站点的 Terraform 配置文件。
    • outputs.tf: 主站点的输出配置。
    • variables.tf: 主站点的变量定义。
  • site-redirect: 重定向站点配置模块。
    • main.tf: 重定向站点的 Terraform 配置文件。
    • outputs.tf: 重定向站点的输出配置。
    • variables.tf: 重定向站点的变量定义。
  • r53-cname: Route53 CNAME 记录配置模块。
    • main.tf: CNAME 记录的 Terraform 配置文件。
    • outputs.tf: CNAME 记录的输出配置。
    • variables.tf: CNAME 记录的变量定义。

项目的启动文件介绍

项目的启动文件主要是各个模块中的 main.tf 文件。以下是各个模块的启动文件介绍:

主站点 (site-main/main.tf)

module "website" {
  source = "github.com/skyscrapers/terraform-website-s3-cloudfront-route53//site-main"
  domain = var.domain
  # 其他配置项
}

重定向站点 (site-redirect/main.tf)

module "redirect" {
  source = "github.com/skyscrapers/terraform-website-s3-cloudfront-route53//site-redirect"
  domain = var.domain
  # 其他配置项
}

Route53 CNAME 记录 (r53-cname/main.tf)

module "dns-cname" {
  source = "github.com/skyscrapers/terraform-website-s3-cloudfront-route53//r53-cname"
  domain = var.domain
  target = module.site-main.website_cdn_hostname
  route53_zone_id = var.route53_zone_id
}

项目的配置文件介绍

主站点 (site-main/variables.tf)

variable "domain" {
  description = "The domain name for the main site"
  type        = string
}

# 其他变量定义

重定向站点 (site-redirect/variables.tf)

variable "domain" {
  description = "The domain name for the redirect site"
  type        = string
}

# 其他变量定义

Route53 CNAME 记录 (r53-cname/variables.tf)

variable "domain" {
  description = "The domain name for the CNAME record"
  type        = string
}

variable "route53_zone_id" {
  description = "The Route53 Zone ID where the CNAME entry must be created"
  type        = string
}

# 其他变量定义

以上是 Terraform 项目 terraform-website-s3-cloudfront-route53 的基本教程,涵盖了项目的目录结构、启动文件和配置文件的介绍。希望这些内容能帮助你更好地理解和使用该项目。

terraform-website-s3-cloudfront-route53Terraform scripts to setup an S3 based static website, with a CloudFront distribution and the required Route53 entries.项目地址:https://gitcode.com/gh_mirrors/te/terraform-website-s3-cloudfront-route53

  • 23
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

孔祯拓Belinda

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值