DevOps Journey — How to get certified in Terraform
This month I have been putting my team through the Hashicorp Terraform Associate exam and decided to take the exam first myself to lead by example, this blog is to help my engineers to get over the line and pass the exam, and to help anyone else that is looking to sit the exam soon. I will keep this blog as interactive as always to mix it up in case you are bored of reading documentation and listening to people talk. I will also create a series of labs soon so look out for updates on my Twitter account @bradmccoydev.
This blog will focus on tips regarding how to prepare for the exam, and provide practice questions and answers. To study for this exam I highly recommend that you have practical experience as well as study the theory. The exam is a mixture of multi-choice questions, fill in the gaps, and type commands. You will get your exam results straight away after you finish the exam, to know if you passed or not. There is no free resit, so this one is important to get it right the first time. The cost of the exam is $70.50 USD, and you have one hour to complete around 57 questions. The exam is split into 9 different categories as listed below.
Contents
- Booking the exam
- Training for the exam
- Link to my Practice Questions on Github
- Interactive Practice Questions and answers
- What to expect on exam day
- Conclusion
1. Booking the exam
Booking the date of the exam in advance is important, this will keep you on track with your study, if you find you are not ready you can reschedule 24 hours in advance for free.
There is a cost involved for getting certified, each exam will cost $70.50 USD. When I have to pay for these exams I’m never worried about the price as it is a great investment into your career, If you are working your company should pay for this, If you need help convincing your boss, tell them to read a previous blog I have written regarding upskilling teams here this should help get buy-in.
The exam does not come with a free resit, so keep that in mind before you take it. To book your exam go here
2. Training for the exam
Training for the exam depends on how much experience you have already. HashiCorp Learn has done an amazing job on the training content so there is really no need to buy a course from another provider. If you are just starting off using Terraform I recommend the full Study Guide, and if you already have experience, you can just do the Exam Review.
3. Link to my Practice Questions on my Github
You can find Terraform Associate practice questions on my Github here. Please give the repo a star if you like them.
4. Interactive Practice Questions and answers
How do you upgrade to the latest acceptable version of the provider?
terraform init --upgrade
What is the command to initialize the directory?
What is the flag you should use to upgrade modules and plugins a part of their respective installation steps?
terraform init -upgrade
Installs the latest version of modules and plugins allowed within configured version constraints
If different teams are working on the same configuration. How do you make files have consistent formatting?
These command formats configurations (*.tf
) in the current directory for easy readability and consistency with terraform’s formatting conventions.
If different teams are working on the same configuration. How do you make files to have syntactically valid and internally consistent?
This command will check and report errors within modules, attribute names, and value types. If your configuration is valid, Terraform will return a success message.
What is the command to create infrastructure?
What is the command to show the execution plan and not apply (eg dry run)?
How do you inspect the current state of the infrastructure applied?
This outputs the current state that was recorded in the .tfstate
It shows a record of what resources Terraform has created and will manage/destroy going forward.
How do you list the resources from your state?
What is the command to list the workspaces?
terraform workspace list
What is the command to create a new workspace?
terraform workspace new <name>
What is the command to show the current workspace?
terraform workspace show
What is the command to switch the workspace?
terraform workspace select <workspace name>
What is the command to delete the workspace?
terraform workspace
delete <workspace name>What is the command you should use to list all the resources in the state file?
terraform state list
What is the command to pull the remote state?
terraform state pull
How do you save an execution plan?
terraform plan -out="plan-name"
You are applying the infrastructure with the command apply
and you don’t want to do interactive approval. Which flag should you use?
terraform apply -auto-approve
Used in DevOps pipelines type scenarios where STDIN is not available.
How do you preview the behavior of the command terraform destroy
?
terraform plan -destroy
5. What to expect on exam day
Before the exam, make sure you clean your desk, as you are allowed nothing on it, you will be asked to put the camera around your desk, under the keyboard, etc. Make sure you have no notes on the wall etc. You can find the exam handbook here. I recommend that you sign in to the exam portal 15 mins before the exam, as the proctors can take some time. You have 60 mins to answer the questions so if you are unsure guess the question flag it and move on and you can always go back at the end. Below is the badge that you will receive if you pass!
6. Conclusion
I hope you have enjoyed reading this blog, if you need any help or have any questions, please reach out to me on linked in or Twitter. For this exam, don't be in a rush to do it fast as there is no free resit, and you can only attempt the exam 3 times per year. Do as much real-life practice as you can whether that's at work or for a personal project, you can practice with cheap cloud resources to save money. The Terraform Documentation team has done a great job at the study resources available, so go through the docs as much as you can so that you understand. Good Luck!!
Please give me a clap if you liked it for feedback, and follow me for more blogs around DevOps!