github.com/hugorut/terraform@v1.1.3/src/terraform/testdata/eval-context-basic/main.tf (about)

     1  variable "number" {
     2    default = 3
     3  }
     4  
     5  variable "string" {
     6    default = "Hello, World"
     7  }
     8  
     9  variable "map" {
    10    type = map(string)
    11    default = {
    12      "foo" = "bar",
    13      "baz" = "bat",
    14    }
    15  }
    16  
    17  locals {
    18    result = length(var.list)
    19  }
    20  
    21  variable "list" {
    22    type    = list(string)
    23    default = ["red", "orange", "yellow", "green", "blue", "purple"]
    24  }
    25  
    26  resource "test_resource" "example" {
    27    for_each = var.map
    28    name     = each.key
    29    tag      = each.value
    30  }
    31  
    32  module "child" {
    33    source = "./child"
    34    list   = var.list
    35  }
    36  
    37  output "result" {
    38    value = module.child.result
    39  }