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]}"
}Discussion 0
Join free to post in the discussion.
Related questions
- What terraform plan doesDevOps Engineer
- What terraform init doesDevOps Engineer
- Why Terraform keeps stateDevOps Engineer
- Immutable infrastructureDevOps Engineer
- Terraform state in a teamDevOps Engineer
- Console change shows up in planDevOps Engineer
- Bringing an existing bucket under TerraformDevOps Engineer
- Sensitive outputs and stateDevOps Engineer