我在s3上托管了一个静态网站。
请参考下面的我的路线53别名设置和弃用警告:
路由的地形配置块53:
resource "aws_route53_zone" "primary" {
name = var.static_web_bucket
}
resource "aws_route53_record" "www" {
zone_id = aws_route53_zone.primary.zone_id
name = var.static_web_bucket
# setting up a DNS A record
type = "A"
alias {
# exported attribute for the domain of the website endpoint
name = aws_s3_bucket.cloud_cv.website_domain
# exported attribute for the Route 53 Hosted Zone ID for this bucket's region.
zone_id = aws_s3_bucket.cloud_cv.hosted_zone_id
evaluate_target_health = false
}
}
折旧警告
│ Warning: Deprecated attribute
│
│ on route53.tf line 13, in resource "aws_route53_record" "www":
│ 13: name = aws_s3_bucket.cloud_cv.website_domain
│
│ The attribute "website_domain" is deprecated. Refer to the provider
│ documentation for details.
│
│ (and one more similar warning elsewhere)
CCD_ 1资源状态的文档";website_domain";是n个导出的属性,并且它们不声明该属性已被取消缓存。我应该引用bucket_domain_name
吗?
我试图实现的是让以下别名指向我的s3网站:firstname-lastname-cloud-cv.com
。
有关所用版本的参考,请参阅以下内容:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~>4.0"
}
}
required_version = ">= 1.1.0"
}
提前感谢!
我同意他们缺少一些相关文档。我不得不做一些搜索,以了解为什么会出现贬低警告。整个aws_s3_bucket
website
配置块似乎已弃用。因此,现在不赞成在aws_s3_bucket
资源中配置网站设置,因此也不赞成引用这些设置。
新方法是使用一个单独的aws_s3_bucket_website_configuration资源,您可以访问该资源上的website_domain
属性。