Study 344 TERRAFORM-ASSOCIATE HashiCorp Certified: Terraform Associate practice questions with explanations. 35 of them are free to try, no sign-up needed.
Buy to unlock all questions, full reading mode and PDFs.
About this question bank
Questions
344 in total
Free to try
35 questions (no sign-up)
Exam domains
9 domains
Price
JPY 1,500 (≈ US$10; shown in your local currency at checkout) · one-time payment · 3 months
PDF
Japanese–English · Chinese–English · Korean–English · English (for buyers)
Data version
2026-11
About this exam
This HashiCorp certification is aimed at beginner to intermediate Terraform users. It covers IaC concepts, the core Terraform workflow (init, plan, apply, destroy), HCL syntax, modules, state management, and HCP Terraform (formerly Terraform Cloud) features: the basics you need to use Terraform in real work.
Try a sample question
This is an original sample question written by itmoshi based on the exam objectives.
As the code and plan output show, you only renamed a resource in code from aws_instance.web to aws_instance.app, and terraform plan now wants to destroy and recreate the existing EC2 instance. You want to keep the instance and just point the state at the new address. You will not add a moved block to the code; you will use only the CLI. Which command should you run?
Exhibit
# Before
resource "aws_instance" "web" {
ami = "ami-0abc1234def567890"
instance_type = "t3.micro"
}
# After (only the resource name was changed)
resource "aws_instance" "app" {
ami = "ami-0abc1234def567890"
instance_type = "t3.micro"
}
$ terraform plan
...
Plan: 1 to add, 0 to change, 1 to destroy.
Bterraform state rm aws_instance.web, then terraform apply
Cterraform apply -replace=aws_instance.app
Dterraform state mv aws_instance.web aws_instance.app
Show answer and explanation
Answer:D terraform state mv changes the address in state, so the instance is not recreated.
Why it is correct
terraform state mv moves a resource recorded in state to another address, in effect renaming it. Afterwards aws_instance.app in state points to the existing instance, the add/destroy pair caused by the rename disappears from the plan (and if nothing else differs, plan shows no changes). It does not touch real infrastructure, so the instance is neither destroyed nor recreated.
The other options
✗ A The second argument to terraform import is the real resource ID (such as an instance ID, i-xxxx), not a resource address. Also, aws_instance.web would stay in state, so plan would still show it being destroyed. Use import to bring existing infrastructure under Terraform for the first time.
✗ B state rm only removes the object from state, so apply would create aws_instance.app as a new instance and leave the original unmanaged. Use it to stop managing a resource without destroying it.
✗ C -replace forces the resource at the given address to be recreated. No existing instance is bound to aws_instance.app yet, so there is nothing to replace, and aws_instance.web stays in state, so the plan still destroys web and creates app. Use it to deliberately rebuild a damaged or drifted resource.
Key takeaway
Renamed a resource or moved it into a module → state mv (or a moved block if you want it recorded in code). Bring an existing resource under management → import. Stop managing only → state rm. Rebuild on purpose → apply -replace.