github.com/hashicorp/terraform-plugin-sdk@v1.17.2/terraform/testdata/apply-multi-var-comprehensive/child/child.tf (about)

     1  variable "num" {
     2  }
     3  
     4  variable "source_ids" {
     5    type = "list"
     6  }
     7  
     8  variable "source_names" {
     9    type = "list"
    10  }
    11  
    12  resource "test_thing" "multi_count_var" {
    13    count = var.num
    14  
    15    key = "child.multi_count_var.${count.index}"
    16  
    17    # Can pluck a single item out of a multi-var
    18    source_id = var.source_ids[count.index]
    19  }
    20  
    21  resource "test_thing" "whole_splat" {
    22    key = "child.whole_splat"
    23  
    24    # Can "splat" the ids directly into an attribute of type list.
    25    source_ids           = var.source_ids
    26    source_names         = var.source_names
    27    source_ids_wrapped   = ["${var.source_ids}"]
    28    source_names_wrapped = ["${var.source_names}"]
    29  }