1) 테라폼 단순 변수 유형 (Terraform Simple Variable Type)

variable "a-string" {
  type = string
}

variabble "this-is-a-number" {
  type = number
}

variable "true-or-false" {
  type = bool
}
variable myvar {
  type = string
  default = "hello terraform"
}

variable mymap {
  type = map(string)
  default = {
    mykey = "my value"
    yourkey = "your value"
  }
}

variable mylist {
  type = list
  default = [1,2,3]
}
$ **terrform console**

> **var.myvar**
"hello terraform"

> **"${var.myvar}"**
"hello terraform"

> **var.mymap**
tomap({
  "mykey" = "my value"
  "yourkey" = "your value"
})

> **var.mymap["mykey"]**
"my value"

> **var.mylist**
tolist([
  1,
  2,
  3,
])

> **var.mylist[0]**
1
>

> **element(var.mylist, 1)**
2

> **slice(var.mylist, 0, 2)**
tolist([
  1,
  2,
])