0
0
Terraformcloud~30 mins

Terraform Registry modules - Mini Project: Build & Apply

Choose your learning style9 modes available
Using Terraform Registry Modules
📖 Scenario: You are setting up cloud infrastructure using Terraform. To simplify your work, you want to use a module from the Terraform Registry that creates a virtual private cloud (VPC) network.This project will guide you step-by-step to configure Terraform to use a Registry module, set variables, and apply the module to create a VPC.
🎯 Goal: Build a Terraform configuration that uses the official Terraform Registry module terraform-aws-modules/vpc/aws to create a VPC with a specific CIDR block and enable DNS support.
📋 What You'll Learn
Use the Terraform Registry module terraform-aws-modules/vpc/aws
Set the VPC CIDR block to 10.0.0.0/16
Enable DNS support and DNS hostnames
Output the VPC ID after creation
💡 Why This Matters
🌍 Real World
Using Terraform Registry modules helps you quickly build cloud infrastructure by reusing tested and community-approved code.
💼 Career
Cloud engineers and DevOps professionals often use Terraform modules to standardize and speed up infrastructure deployment.
Progress0 / 4 steps
1
Initialize Terraform configuration with provider
Create a Terraform configuration file that declares the aws provider with the region set to us-east-1.
Terraform
Need a hint?

Use the provider "aws" block and set region = "us-east-1".

2
Add the Terraform Registry VPC module
Add a module block named vpc that uses the source terraform-aws-modules/vpc/aws with version ~> 3.0.
Terraform
Need a hint?

Use a module "vpc" block with source and version attributes.

3
Configure the VPC module with CIDR and DNS settings
Inside the module "vpc" block, set cidr to "10.0.0.0/16", enable_dns_support to true, and enable_dns_hostnames to true.
Terraform
Need a hint?

Add the three variables inside the module block exactly as shown.

4
Output the VPC ID
Create an output block named vpc_id that outputs the value of module.vpc.vpc_id.
Terraform
Need a hint?

Use an output block with the name vpc_id and set value = module.vpc.vpc_id.