Skip to content
RED SAGSkills
hard20 pts · first answer countsterraforminfrastructure-as-code

count vs for_each in Terraform

You create three S3 buckets using count over the list ["logs", "images", "backups"]. You remove "logs" from the list. What does terraform plan show, and how do you avoid it?

resource "aws_s3_bucket" "b" {
  count  = length(var.names)
  bucket = "acme-${var.names[count.index]}"
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions