Project: Create a VPC and Two Subnets
Try implementing a Terraform project.
We'll cover the following
Problem statement#
Write a Terraform module that creates a VPC and 2 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.
Project output after running the terraform apply command
Folder structure#
Let’s look into the folder structure of this project:
Terraform project files used to implement the project
Running the project#
Clicking the RUN button will run the following commands:
terraform init
terraform apply
Coding exercise#
Try to solve the above problem. If you can’t solve it, don’t give up. In the next lesson, we will discuss the solution in detail.
Good Luck!
This code requires the following environment variables to execute:
access_key_id
Not Specified...
secret_access_key
Not Specified...
/
vpc
output.tf
variables.tf
main.tf
main.tf
terraform.tfstate
terraform.tfstate.backup
- main.tf
Solution Review: Find the CIDR Range
Solution Review: Create a VPC and Two Subnets
Mark as Completed
Report an Issue