Search⌘ K
AI Features

Solution Review: Create a VPC and Two Subnets

Understand how to create a reusable Terraform module that provisions a VPC and two subnets in AWS using variable CIDR inputs. Learn to define resources with dependencies, output the created components, and manage the module in a Terraform project for effective infrastructure as code.

Problem statement

Write a Terraform module that creates a VPC and two subnets. The module takes inputs for the CIDR ranges for the VPC and subnets and should return the created VPC and each subnet as an output. Create a Terraform project that uses the module and print the output of the module to the console

Running the project

Clicking the RUN button will run the following commands:

terraform init
terraform
...