Terraform challenges for beginners and advanced students and users.
The idea is simple: provide students with a single Terraform code base that has breaking changes introduced into it, then allow them to fix them.
!! WARNING !!
If you execute the following code against your AWS account you may incur a bill and financial obligations to AWS. Make sure you're prepared to cover the costs of running infrastructure inside of AWS before executing this Terraform code against your account.
Not "The DevOps Lounge" nor "OpsFactory Pty Ltd" will be responsible for any financial hardship you incur after using this code.
You're going to need the following to use these challenges:
- An AWS account
- An IAM User with access and secret keys for accessing the AWS API
- Terraform installed locally and working
We introduce the breaking changes using branches that stem from the primary branch called solution
. The branches that contain problems are called levels and follow the format level-N
where N
is the level, such as 1
, 2
, 7
or 12
, etc.
The main
branch is used only for documentation purposes and contains no code.
Please switch to the solution
branch and review the code - lint it, validate it, apply it, destroy it, etc. When you're ready, move onto branch level-1
and begin the process again, fixing the code as you go until you can successfully apply the code.
So as a student the recommended process for you looks a bit like this:
- Fork the repository
- Note: the
main
branch doesn't contain any Terraform code, only thisREADME.md
- Note: the
- Switch to the
solution
branch - Run
terraform init
(this step may fail) - Run
terraform validate
(this step may fail) - Run
terraform plan
(this step may fail) - Run
terraform apply
(this step may fail) - Run
terraform destroy
(this step will never fail due to potential financial implications) - Switch to the
level-1
branch and repeat the above steps, fixing the issues you face
At each level above the previous, the problems get harder and harder or just more annoying. It depends how I'm feeling ;-)
The repository's solution
branch represents a working solution. Should you get stuck, git switch solution
to move back to this working copy of the code.
This branch is the main branch all problems are stemmed from. This code is taken, broken, and the challenge is then presented back to you to solve.
If you're struggling to understand the above instructions, have found an issue with the repository or just want general assistance, please join The DevOps Lounge community and seek assistance in the #help
channel.
Yes, you can cheat. If you know even the basics of Git commits, you can easily work out a way of seeing what changes have taken place in past commits and cheat. It's up to you to determine if this is something that helps you learn or not. We all learn in different ways.