Help for the VSCode editor.
-
Which environment variable should be used to export the logs to a specific path?
Refer to the documentation
RevealTF_LOG_PATH
-
Can you export the debug logs from terraform just by setting TF_LOG_PATH environment variable and providing a path as the value to this variable?
Refer to the documentation
Reveal
`NO'
This variable sets the path for log files to be written. It has no effect unless
TF_LOG
is also set. -
We have a configuration directory called /root/terraform-projects/ProjectA. Enable logging with the log level set to ERROR and then export the logs the path /tmp/ProjectA.log.
-
Set the environment variables
Reveal
cd /root/terraform-projects/ProjectA export TF_LOG=ERROR export TF_LOG_PATH=/tmp/ProjectA.log
This variable sets the path for log files to be written. It has no effect unless
TF_LOG
is also set. -
Deploy
terraform init terraform apply
-
-
Which Log Level provides the most details when you run terraform commands?
Refer to the documentation
RevealTRACE
-
Now navigate to /root/terraform-projects/ProjectB. We already have a main.tf file created for provisioning an AWS EC2 instance
Apply the resource
cd /root/terraform-projects/ProjectB terraform init terraform apply
-
Now, try running a terraform plan again. What is the effect?
terraform plan
Note what will happen from the output of the above
-
Why is the resource called ProjectB being replaced?
Again, examine the plan output. The reason for replacement will be found there.
RevealReource is tainted
-
Untaint the resource called ProjectB so that the resource is not replaced any more.
Revealterraform untaint aws_instance.ProjectB
You can run
terraform plan
again the verify.