Cheat Sheet - Terraform

Cheat Sheet - Terraform

String interpolation

"Hello, ${var.name}"

Multiline string

<<EOT
hello
world
EOT

AzureRM & authentication

  • Use Azure CLI when running Terraform locally
  • Use service principal or managed identity when running non-interactively

Assigning values to root module variables

  • Individually, with the -var command line option (plan, apply)
    • -var=key=value
  • In variable definitions (.tfvars) files, either specified on the command line or automatically loaded.
  • As environment variables.