Explaining ‘<<-EOT’ found in Terraform Logs

or on giving instructions for passing a text of multiple lines into a command in Bash via heredoc.

When writing shell scripts you may be in a situation where you need to pass a multiline block of text or code to an interactive command, such as tee , cat, or sftp .

Terraform also supports a “heredoc” style of string literal inspired by Unix shell languages

~ jobspec                 = <<-EOT
job "com_acme:prod1:{
datacenters = ["eu-central-1a", "eu-central-1b", "eu-central-1c"]

affinity {
attribute = "${meta.rack}"
value = "clients"
weight = 100
}

type = "batch"

periodic {
cron = "36 * * * *"
prohibit_overlap = true
}
config {
- image = "0.98.0"
+ image = "0.99.0"
}
EOT

conventionally this identifier is in all-uppercase and begins with EO, meaning “end of”

--

--

Infrastructure Support Engineer/Technical Writer (snowplow.io) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pavol Kutaj

Infrastructure Support Engineer/Technical Writer (snowplow.io) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com