Terraform Commands/Random Features Flashcards

1
Q

What does the terraform fmt command do

A

It is used to rewrite Terraform config files to take care of the overall formatting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does Terraform load config files if there are a number of them in the working directory?

A

Terraform loads the config files in the same directory in alphabetical order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What file format will Terraform load using alphabetical order?

A

The files loaeded must end in either .tf or .tf.json to specify the format that is in use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you report Terraform bugs?

A

You can report bugs in the Terraform Core Github or appropriate provider page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Whats debugging?

A

The process of finding the root cause of a specific issue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s an important requirement for debugging?

A

Getting detailed log information.

Depending on the app, the approach to get detailed logs will differ.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What flag do you add to Terraform to output log information?

A

-v

If you need more log info you’d add more v’s.

Ex. -vvvv

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to get detailed logs?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Can you store log from Terraform to a file?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to set the TF_VAR env variable in Windows?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to set the TF_VAR env variable in Linux?

A

export TF_LOG=VALUE

where VALUE is the log level (TRACE,DEBUG,etc)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly