concept

Count and list reordering

List positions determine count instance addresses, not labels. Removing or reordering elements can change retained instances; provider schema and replacement triggers determine the action.

Formal Syntax & Structure

terraform syntaxterraform
Count and list reordering

Working Example

Example Snippetterraform
variable "names" {  type    = list(string)  default = ["blue", "green", "amber"]  validation {    condition     = length(var.names) <= 5    error_message = "Use at most five names in this lab."  }}
resource "terraform_data" "card" {  count = length(var.names)  input = var.names[count.index]}
output "cards" {  value = terraform_data.card[*].output}
Terraform Reference