Terraform Konfigürasyonu Yazma
Terraform konfigürasyonlarında doğrudan bağımlılık olmasa bile bazı kaynakların daha önce silinmesi gerektiğine dair Terraform'a bir ipucu vermenin yararlı yolu.
- 1.
var.website
boş bir map değilse, zorunlu argümanindex_document
ayarlanmalıdır. - 2.İsteğe bağlı argüman
error_document
göz ardı edilebilir
main.tf
variable "website" {
type = map(string)
default = {}
}
resource "aws_s3_bucket" "this" {
# omitted...
dynamic "website" {
for_each = length(keys(var.website)) == 0 ? [] : [var.website]
content {
index_document = website.value.index_document
error_document = lookup(website.value, "error_document", null)
}
}
}
terraform.tfvars
website = {
index_document = "index.html"
}
Last modified 8mo ago