Comment on page
Pisanie konfiguracji Terraform
Przydatny sposób na wskazanie Terraform, że niektóre zasoby powinny zostać usunięte wcześniej, nawet jeśli nie ma bezpośredniej zależności w konfiguracjach.
- 1.Wymagany argument
index_document
musi być ustawiony, jeślivar.website
nie jest pustą mapą. - 2.Opcjonalny argument
error_document
można pominąć.
main.tf
variable "website" {
type = map(string)
default = {}
}
resource "aws_s3_bucket" "this" {
# pomijamy...
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 1yr ago