Create Multiple Resources

Overview

This lesson covers different aspects of creating multiple instances of the same resource in Terraform.

In it, we’ll go over the following concepts:

  • The count resource meta-argument.

-The splat ([*]) operator.

  • The for loop in Terraform.

  • The for_each resource meta-argument.

Importance

These techniques and keywords are essential for a firm understanding of Terraform. This is particularly true for systems and applications that need to scale their resources. For example, we might want to create 100 AWS EC2 instances, or loop over a list of usernames creating accounts for each.

Multiple VPCs

We’ve created the ltthw_multiple directory and the main.tf file. In the main.tf file, we’ve added provider and resource.

Get hands-on with 1400+ tech skills courses.