Terraform Commands/Random Features Flashcards
What does the terraform fmt command do
It is used to rewrite Terraform config files to take care of the overall formatting.
How does Terraform load config files if there are a number of them in the working directory?
Terraform loads the config files in the same directory in alphabetical order.
What file format will Terraform load using alphabetical order?
The files loaeded must end in either .tf or .tf.json to specify the format that is in use.
How can you report Terraform bugs?
You can report bugs in the Terraform Core Github or appropriate provider page
Whats debugging?
The process of finding the root cause of a specific issue.
What’s an important requirement for debugging?
Getting detailed log information.
Depending on the app, the approach to get detailed logs will differ.
What flag do you add to Terraform to output log information?
-v
If you need more log info you’d add more v’s.
Ex. -vvvv
How to get detailed logs?
You can set the TF_LOG environment variable to any value.
The value for TF_LOG can be set to the values below where TRACE is the most verbose and ERROR is the least verbose.
TRACE
DEBUG
INFO
WARN
ERROR
Can you store log from Terraform to a file?
Yes, you can set the TF_LOG_PATH environment variable to force the log to always be appended to a specific file when logging is enabled.
How to set the TF_VAR env variable in Windows?
The command,
set TF_LOG=VALUE
where VALUE is the log level (TRACE,DEBUG,etc)
The command
set TF_LOG_PATH=file.txt
saves the information to a text file
How to set the TF_VAR env variable in Linux?
export TF_LOG=VALUE
where VALUE is the log level (TRACE,DEBUG,etc)