Count for multiple instances
📖 Scenario: You are setting up a simple cloud infrastructure using Terraform. You want to create multiple identical virtual machines (instances) to handle web traffic.
🎯 Goal: Build a Terraform configuration that creates exactly three virtual machine instances using the count meta-argument.
📋 What You'll Learn
Create a resource block for an AWS EC2 instance named
aws_instance.web.Use the
count meta-argument to create exactly 3 instances.Set the
ami attribute to "ami-0c55b159cbfafe1f0".Set the
instance_type attribute to "t2.micro".💡 Why This Matters
🌍 Real World
Creating multiple virtual machines is common when you want to scale your application to handle more users.
💼 Career
Cloud engineers often use Terraform's count feature to efficiently manage multiple resources without repeating code.
Progress0 / 4 steps