• 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. Configuration Language

Write Terraform Configuration

Learn Terraform configuration language by example. Write configurations to manage multiple pieces of infrastructure and iterate over structured data. Deploy and manage related infrastructure by referring to resources in other configurations.

Start
18 tutorials
  •  
    11min
    Define Infrastructure with Terraform Resources
    Create an EC2 instance, then use the Terraform Registry to create a security group to make it publicly accessible. Learn how Terraform resources define infrastructure as code through arguments, attributes, and dependencies.
    • Terraform
    • Video
  •  
    20min
    Perform CRUD Operations with Providers
    Learn how Terraform providers interact with resources by serving as a bridge between Terraform and target APIs.
    • Terraform
    • Video
  •  
    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
  •  
    13min
    Protect Sensitive Input Variables
    Protect sensitive values from accidental exposure using Terraform sensitive input variables. Provision a web application with Terraform, and mark input variables as sensitive to restrict when Terraform prints them out to the console.
    • Terraform
  •  
    10min
    Simplify Terraform Configuration with Locals
    Use Terraform local values to simplify your configuration and avoid duplication of reused expressions.
    • 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
  •  
    14min
    Query Data Sources
    Use a data source to configure an EC2 instance with an appropriate AMI for the current region. Use a remote state data source to share data between Terraform projects and to support multiple availability zones.
    • Terraform
  •  
    10min
    Create Resource Dependencies
    Create an implicit dependency between an EC2 instance and its Elastic IP using variable interpolation. Create explicit dependencies on an S3 Bucket and SQS Queue with depends_on. Learn how Terraform creates independent resources in parallel.
    • Terraform
  •  
    9min
    Manage Similar Resources with Count
    Manage similar Terraform resources using the count argument. Create a VPC with a load balancer and EC2 instances. Then use count to manage a configurable number of similar AWS EC2 instances across multiple subnets.
    • Terraform
  •  
    15min
    Manage Similar Resources with For Each
    Provision similar infrastructure components by iterating over a data structure with the for_each argument. Duplicate an entire VPC including a load balancer and multiple EC2 instances for each project defined in a map.
    • Terraform
  •  
    12min
    Perform Dynamic Operations with Functions
    Use templatefile and lookup functions to generate dynamic user data for an EC2 instance and find a region-specific AMI.
    • Terraform
  •  
    11min
    Create Dynamic Expressions
    Make your Terraform configurations more dynamic and reusable with expressions. Use locals to assign expressions to variables for reuse, conditionals to declare if/then scenarios, and the splat expression to return attributes from complex value types.
    • 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
  •  
    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
  •  
    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
  •  
    14min
    Use Configuration to Move Resources
    Use the configuration-driven workflow to change Terraform resource IDs. Refactor configuration to move resources into modules using the `moved` block.
    • Terraform
  •  
    16min
    Validate Modules with Custom Conditions
    Add condition blocks to a module that deploys an application in an AWS VPC to validate that DNS and EBS support are enabled, and that the appropriate number of subnets are configured.
    • Terraform
  •  
    16min
    Customize Modules with Object Attributes
    Refactor a local module to organize related attributes with objects and make some attributes optional for module users.
    • 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)