Enable Debug Logging for Terraform

15 minutes
  • 2 Learning Objectives

About this Hands-on Lab

Hey there, Gurus! Welcome to the lab! This lab will demonstrate how to enable debug logging in Terraform, which can be used to further look into an issue with Terraform and to give information to HashiCorp when submitting a bug report. Let the bug reporting begin!

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Enable Debug Logging
  1. In the terminal, once you’re logged in to your instance, change to the Enable_Debug_Logging directory.
  2. In the Enable_Debug_Logging directory, edit the variables.tf file and add in your ami and subnet_id from the resource_ids.txt file.
  3. In the Enable_Debug_Logging directory, create a directory called logs.
  4. Enable Terraform debug logging.
  5. Set the logging path to a file called terraform_logs.txt in your logs directory.
  6. Initialize your working directory.
  7. Check the Terraform version.
  8. Deploy your resources.
Confirm the Log was Written to the Directory
  1. Check your logs directory for the the terraform_logs.txt file.
  2. Examine the log file.

Additional Resources

You are an admin who supports one of the largest online comic book retailers in the world. You are one of a handful of admins who have been assigned to use Terraform to manage the company's cloud deployments. You are being asked to enable Terraform’s debug logging to help troubleshoot some Terraform issues. Enable debug logging with the TRACE log level, output the logs to a file called terraform_logs.txt in a directory called logs, and confirm the logs' creation to complete this lab. Let’s get started!

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?