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

Removing an item from a count list

You remove "b" from the list below. terraform plan wants to destroy and recreate buckets you did not touch. Why, and what is the fix?

variable "names" { default = ["a", "b", "c"] }

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

Discussion 0

Join free to post in the discussion.

Related questions