Terraform datatypes

From wikinotes

Primitive

Null

null

Strings

"abcd"
"line1\nline2"

# heredoc style multiline strings
<<HERE
line1
line2
HERE

# preserve indentation from first indent-level
<<-HERE
# ...
HERE

# string interpolation
"hello ${var.user_name}"

# template directive (ex. conditionals/loops)
"authorization %{if var.success } successful %{else} failed %{endif}"

%{ for foo in bar ~}  # '~}' indicates don't add whitespace for this line
%{ endfor ~}

# unicode characters from hex codepoint
"\uAABB"
"\uAABBCCDD"

Numbers

28
7.5

Bool

true
false

Collections

List

Lists are heterogenous, and may contain expressions.

["one", 2, "three"]

Map

Keys must be strings, but they can be non-string-literals.

{
  one = 1
  two = 2
  (var.number_three) = 3   # the string stored in 'var.number_three'
}