• HashiCorp Developer

  • HashiCorp Cloud Platform
  • Terraform
  • Packer
  • Consul
  • Vault
  • Boundary
  • Nomad
  • Waypoint
  • Vagrant
Terraform
  • Install
  • Tutorials
    • About the Docs
    • Configuration Language
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
    • CDK for Terraform
    • Provider Use
    • Plugin Development
    • Registry Publishing
    • Integration Program
  • Registry(opens in new tab)
  • Try Cloud(opens in new tab)
  • Sign up
Terraform Home

Tutorials

Skip to main contentTutorials

Get Started

  • AWS
  • Azure
  • Docker
  • GCP
  • OCI
  • Terraform Cloud

Fundamentals

  • CLI
  • Configuration Language
  • Modules
  • Provision
  • State
  • Terraform Cloud

Use Cases

  • Applications
  • AWS Services
  • Azure Services
  • HashiCorp Products
  • IT/SaaS Providers
  • Kubernetes
  • Machine Images
  • Networking
  • Policy
  • Security

Certification Prep

  • Associate Prep (002)
  • Associate Prep (003)
  • Associate Tutorials (002)
  • Associate Tutorials (003)

Production

  • Automate Terraform
  • Enterprise Patterns
  • Terraform Enterprise

Integrations

  • CDK for Terraform
  • Community Providers
  • Custom Framework Providers
  • Custom SDK Providers
  • Secrets

  • Resources

  • Tutorial Library
  • Certifications
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  • Terraform Registry
    (opens in new tab)
  1. Developer
  2. Terraform
  3. Tutorials
  4. CLI

Use the Command Line Interface

Use the Terraform Command Line Interface (CLI) to manage infrastructure, and interact with Terraform state, providers, configuration files, and Terraform Cloud.

Start
16 tutorials
  •  
    12min
    Initialize Terraform Configuration
    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.
    • Terraform
  •  
    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.
    • Terraform
  •  
    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.
    • Terraform
  •  
    15min
    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.
    • Terraform
  •  
    7min
    Output Data from Terraform
    Output data about infrastructure with Terraform outputs. Provision a web application with Terraform, and use output values to export data about your application's infrastructure. Hide sensitive output values.
    • Terraform
  •  
    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.
    • Terraform
  •  
    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.
    • Terraform
  •  
    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.
    • Terraform
  •  
    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.
    • Terraform
  •  
    25min
    Import Terraform Configuration
    Import existing infrastructure into Terraform. In this tutorial, you will use Terraform import to manage an existing Docker container and learn important considerations to keep in mind when importing infrastructure into Terraform.
    • Terraform
  •  
    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.
    • Terraform
  •  
    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.
    • Terraform
  •  
    9min
    Migrate State to Terraform Cloud
    Migrate a state file to Terraform Cloud for secure storage and easy collaboration.
    • Terraform
  •  
    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.
    • Terraform
  •  
    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.
    • Terraform
  •  
    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.
    • Terraform
Give Feedback(opens in new tab)
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Give Feedback(opens in new tab)