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.
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.
21min
Perform CRUD Operations with Providers
Learn how Terraform providers interact with resources by serving as a bridge between Terraform and target APIs.
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.
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.
10min
Simplify Terraform Configuration with Locals
Use Terraform local values to simplify your configuration and avoid duplication of reused expressions.
10min
Output Data from Terraform
Use output values to export data about the resources Terraform manages. Hide sensitive output values.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
16min
Customize Modules with Object Attributes
Refactor a local module to organize related attributes with objects and make some attributes optional for module users.
13min
Use Checks to Validate Infrastructure
Use check blocks to define and evaluate assertions about your environment and resources.