github.com/hashicorp/terraform-plugin-sdk@v1.17.2/terraform/testdata/apply-vars/main.tf (about) 1 variable "amis" { 2 default = { 3 us-east-1 = "foo" 4 us-west-2 = "foo" 5 } 6 } 7 8 variable "test_list" { 9 type = list(string) 10 } 11 12 variable "test_map" { 13 type = map(string) 14 } 15 16 variable "bar" { 17 default = "baz" 18 } 19 20 variable "foo" {} 21 22 resource "aws_instance" "foo" { 23 num = "2" 24 bar = var.bar 25 list = var.test_list 26 map = var.test_map 27 } 28 29 resource "aws_instance" "bar" { 30 foo = var.foo 31 bar = var.amis[var.foo] 32 baz = var.amis["us-east-1"] 33 }