Project: Find the CIDR Range
Test your knowledge by implementing two parts of a Terraform project
Problem statement#
There will be two parts of this project. Let’s first look into their problem statements.
Output#
Subfolder part1
creates the VPC with the Name
tag set to Kevin
. Subfolder part2
shows how to look this up by data block and output it.
Now, let’s see what should be the output for both of the folders.
part1
#
The following should be the output after running terraform apply
in the part1
folder:
aws_vpc.vpc: Creating...
aws_vpc.vpc: Creation complete after 7s [id=vpc-08c1764b885f93805]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
part2
#
After running terraform apply
in the part2
folder, the CIDR range should be printed on the screen.
Folder structure#
Let’s look into the folder structure of this project:
part1
#
Implement the solution of part 1 of the problem in this folder.
part 2
#
Implement the solution of part 2 of the problem in this folder.
Running the project#
You can use the following commands to run the project:
📝Note: Please use the
cd
command to move to the specific folder and run the commands.
part1
#
Inside the part1
folder, run commands:
terraform init
terraform apply
part2
#
Inside the part2
folder, run commands:
terraform init
terraform apply
📝Note: Clicking the RUN button will move you to the
part1
folder and runterraform init
commands.
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!
/
- main.tf