Use the Terraform Command Line Interface (CLI) to manage infrastructure, and interact with Terraform state, providers, configuration files, and Terraform Cloud.
Learn what Terraform does when you run `terraform init` in a working directory. Initialize the backend, install providers, download modules, and explore the lock file and .terraform directory.
17min
Create a Terraform plan
Learn how Terraform constructs an execution plan. Export a plan with the -out flag, review the plan contents, and apply a saved plan.
15min
Apply Terraform configuration
Learn how Terraform applies configuration to change your infrastructure. Provision a Docker container, introduce an apply error, note how Terraform handles errors, and perform basic troubleshooting.
19min
Customize Terraform configuration with variables
Customize infrastructure for a web application with Terraform. In this tutorial, you will use Terraform input variables, including lists, maps, strings, and booleans, to make the configuration for your infrastructure more flexible.
10min
Output data from Terraform
Use output values to export data about the resources Terraform manages. Hide sensitive output values.
10min
Manage Terraform versions
Update an existing configuration to work with a newer version of Terraform. Use the required_version setting to pin the Terraform versions for your projects. Manage different versions of Terraform across your team.
11min
Lock and upgrade provider versions
Manage your provider versions using the dependency lock file. Use version constraints to filter provider versions compatible with your configuration. Update your lock file to use a new provider version.
20min
Target resources
Apply changes to an AWS S3 bucket and bucket objects using resource targeting. Target individual resources, modules, and collections of resources to change or destroy. Explore how Terraform handles upstream and downstream dependencies.
19min
Manage resources in Terraform state
Create an EC2 instance and security group, and move a resource to another state file. Remove, replace, and re-import resources to manage state and reconcile drift in your infrastructure.
18min
Import Terraform configuration
Use configuration to import existing infrastructure into Terraform. Review important considerations when bringing infrastructure under Terraform management.
9min
Use refresh-only mode to sync Terraform state
Use refresh-only plans and applies to update Terraform state to match real-world infrastructure. Understand the implicit refresh behavior in Terraform plan and apply operations.
3min
Log in to Terraform Cloud from the CLI
Log into Terraform Cloud or Enterprise with the Terraform CLI to migrate state, trigger remote runs, and interact with Terraform Cloud.
9min
Migrate state to Terraform Cloud
Migrate a state file to Terraform Cloud for secure storage and easy collaboration.
15min
Troubleshoot Terraform
Interpret and fix a Terraform configuration with common configuration language errors and deploy an EC2 instance with security groups in AWS. Learn best practices for logging application errors and reporting bugs.
12min
Develop configuration with the console
Use the Terraform console to inspect resources and evaluate Terraform expressions before using them in configurations. Configure an S3 bucket with an IAM role to restrict access by IP address.
7min
Verify Terraform binary archives
Verify that the terraform executable is secure. Download, verify, and install HashiCorp's PGP public key. Download a Terraform archive and signed checksum. Verify that the Terraform archive matches the checksum file.