github.com/mehmetalisavas/terraform@v0.7.10/terraform/test-fixtures/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"
    10  }
    11  
    12  variable "test_map" {
    13      type = "map"
    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 = "${join(",", var.test_list)}"
    26      map = "${join(",", keys(var.test_map))}"
    27  }
    28  
    29  resource "aws_instance" "bar" {
    30      foo = "${var.foo}"
    31      bar = "${lookup(var.amis, var.foo)}"
    32      baz = "${var.amis["us-east-1"]}"
    33  }