terraform apply verbose

Terraform apply command verbose output examples 2025

Added specific context about the Terraform command, included 'output examples' for clarity, and the year 2025 to ensure the results are current and relevant.

Understanding Terraform's apply Command with Verbose Output

Terraform, a popular Infrastructure as Code (IaC) tool developed by HashiCorp, simplifies the process of building, changing, and versioning infrastructure safely and efficiently. One of its core commands, terraform apply, is used to execute the actions outlined in a previous terraform plan, ensuring that the intended infrastructure matches the desired state defined in your configuration files. However, to gain deeper insights into what Terraform is doing during this process, utilizing verbose output can be particularly helpful for debugging and operational transparency.


What is terraform apply?

The terraform apply command is crucial in the Terraform workflow. It takes a Terraform plan and implements it, creating, updating, or destroying resources according to your defined infrastructure configuration. By default, terraform apply will show a summary of what it plans to do and will ask for your approval before making changes.

Basic Usage

To execute Terraform apply, you typically run the command:

terraform apply

If you want to skip the approval prompt, you can use the -auto-approve flag:

terraform apply -auto-approve

Enabling Verbose Output

Verbose output in Terraform allows you to see detailed logs that depict what actions Terraform is executing behind the scenes. This information can be critical when troubleshooting issues or getting more insights into the resource management process.

How to Enable Verbose Mode

To enable verbose output when running terraform apply, you can set the TF_LOG environment variable, specifying the log level. Here’s how you can do this:

  1. Set the environment variable: For example, to enable debug-level logging:

    export TF_LOG=DEBUG
    

    Alternatively, for more general information, you might use:

    export TF_LOG=TRACE
    
  2. Run the command: After setting the log level, simply run:

    terraform apply
    

This configuration will produce detailed log output, including internal Terraform operations, API calls, and more.

Example of Verbose Output

When you run terraform apply in verbose mode, you can expect to see output similar to the following:

2025/08/08 12:00:00 [DEBUG] module.web_server: creating EC2 instance
2025/08/08 12:00:00 [DEBUG] provider.aws: making API call to AWS
2025/08/08 12:00:00 [TRACE] API response received: { "InstanceId": "i-1234567890abcdef0" }
2025/08/08 12:00:00 [INFO] Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

This detailed output will show each step involved in the apply process, including interactions with the cloud provider’s API and the status of resource creation or modification.


Benefits of Using Verbose Output

Improved Debugging

Verbose output helps users understand where things might be going wrong. If a resource fails to create, the logs can provide insight into the API calls made and the error messages returned.

Visibility into Terraform Operations

Seeing all the operations that Terraform performs can help teams grasp the full lifecycle of their infrastructure changes, making it easier to manage complex deployments.

Monitoring For Changes

Verbose logging can be useful in a CI/CD pipeline context where monitoring infrastructure changes is critical for auditing or rollback strategies.


Conclusion

Using the terraform apply command with verbose output is an essential practice for anyone looking to get deeper insights into their infrastructure management process. By setting the TF_LOG environment variable, Terraform users can enable detailed logging that can assist in debugging and understanding the application's behavior. This functionality is invaluable for both novice and experienced users, allowing for more efficient infrastructure management and troubleshooting.

For additional reading on the terraform apply command and its options, you can refer to the official Terraform Command Reference.

Sources

10
1
Terraform Apply - When to Run & Quick Usage Examples
Spacelift

Terraform apply is a core command in the Terraform workflow. See what is it used for, available options & examples. Auto approve explained.

2
Terraform Verbose: Quick Guide for Debugging ...
Cyberpanel

Terraform verbose mode gives detailed output to help you debug and get some insight into what Terraform is doing behind the scenes.

3
Terraform Commands, Examples and Best Practices
Env0

The output will be: When you run terraform apply, Terraform always runs terraform plan first. Then you will get a prompt ...

4
terraform test command reference
Developer

Example: Test Output Format Options. Below is a contrived example of Terraform testing that makes assertions about the values of local variables true and false ...

5
23 Terraform CLI Commands & Examples
Spacelift

In this post, I'll highlight the commonly used commands used on the Terraform CLI so you can get straight into the action without the pain!

6
Terraform Apply Command | Options, Examples and Best ...
Env0

The terraform apply command executes planned actions, creating, updating, or deleting infrastructure resources to match the new state outlined in your IaC.

7
Terraform Cheat Sheet: Terraform Command Guide
Cherryservers

Explore essential Terraform commands with examples in this cheat sheet. Learn to initialize, plan, apply, and manage cloud infrastructure ...

8
terraform apply command reference
Developer

The `terraform apply` command executes the actions proposed in a Terraform plan to create, update, or destroy infrastructure.

9
How to enable debug logging when using Terraform?
Suse

This article details how to enable debug output and set the log location for Terraform commands such as terraform apply.

10
running terraform apply only for new outputs
Stack Overflow

I want to add an output to use in terraform_remote_state data source for example: output "acm_certificate_arn" { value = module.acm_certificate.