DEMO QUESTIONS

Q1:

A terraform apply can not _________ infrastructure.

A: change

B: destroy

C: provision

D: import

Correct Answer: D
The terraform import command is used to import existing infrastructure into Terraform’s state. This allows Terraform to manage and destroy the imported infrastructure as part of the configuration. The terraform import command does not modify the configuration, so the imported resources must be manually added to the configuration after the import.Reference= [Importing Infrastructure]

Q2:

Which command lets you experiment with terraform expressions?

A: Terraform console

B: Terraform validate

C: Terraform env

D: Terraform test

Correct Answer: A
This is the command that lets you experiment with Terraform expressions, by providing an interactive console that allows you to evaluate expressions and see their results. You can use this command to test your expressions before using them in your configuration files.

Q3:

A senior admin accidentally deleted some of your cloud instances. What will Terraform do when you run terraform apply?

A: Tear down the entire workspace's infrastructure and rebuild it.

B: Build a completely brand new set of infrastructure.

C: Rebuild only the instances that were deleted.

D: Stop and generate an error message about the missing instances.

Correct Answer: C
Terraform detects infrastructure drift by comparing thestate filewith the actual infrastructure.

When an instance ismanually deleted, Terraformsees it as missingand marks it for recreation.

Running terraform apply willonly recreate the missing instanceswhile leaving the rest of the infrastructure unchanged.

Explanation of incorrect answers:

A (Tear down everything and rebuild)– Incorrect. Terraform does not destroy existing infrastructure unless explicitly told to.

B (Build a completely new set of infrastructure)– Incorrect. Terraform does not create duplicates unless configuration changes.

D (Stop and error out)– Incorrect. Terraform does not fail; itrebuilds missing resourcesautomatically.

Official Terraform Documentation Reference:

Handling Infrastructure Drift

Q4:

You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability. How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

A: Run the terraform fmt command during the code linting phase of your CI/CD process Most Voted

B: Designate one person in each team to review and format everyone's code

C: Manually apply two spaces indentation and align equal sign '=' characters in every Terraform file (*.tf)

D: Write a shell script to transform Terraform files using tools such as AWK, Python, and sed

Correct Answer: A
The terraform fmt command is used to rewrite Terraform configuration files to a canonical format and style. This command applies a subset of the Terraform language style conventions, along with other minor adjustments for readability. Running this command on your configuration files before committing them to source control can help ensure consistency of style between different Terraform codebases, and can also make diffs easier to read.You can also use the -check and -diff options to check if the files are formatted and display the formatting changes respectively2.Running the terraform fmt command during the code linting phase of your CI/CD process can help automate this process and enforce the formatting standards for your team.Reference= [Command: fmt]2

Q5:

You’ve used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without affecting the database. What is the best way to achieve this using Terraform?

A: Use the terraform state rm command to remove the VM from state file

B: Use the terraform taint command targeting the VMs then run terraform plan and terraform apply

C: Use the terraform apply command targeting the VM resources only

D: Delete the Terraform VM resources from your Terraform code then run terraform plan and terraform apply

Correct Answer: B
The terraform taint command marks a resource as tainted, which means it will be destroyed and recreated on the next apply. This way, you can replace the VM instance without affecting the database or other resources.Reference= [Terraform Taint]

Testimonials – Real Results From Real Students

Your success is our priority. We’re proud to share authentic reviews from students who trusted us, passed their exams, and reached their goals with confidence.
John Doe
John Doe
This site has been a game-changer for my certification journey. The materials are current, reliable, and best of all—free! It's clear they're committed to supporting the IT community.
Emma
Emma
I passed my CompTIA Security+ exam on the first try thanks to this site. Their practice exams and study guides are top-notch. Highly recommend it to anyone serious about IT certifications.
Liam
Liam
I’ve passed three certifications using this site. Their materials are detailed and well-structured, and the fact that it’s free makes it even better.
Isabella
Isabella
If you're studying for any IT certification, this should be your first stop. It’s comprehensive, organized, and constantly updated.
Benjamin
Benjamin
This website helped me prepare for multiple certifications, and today I’m working in cybersecurity. Without their free resources, I wouldn’t be here.

Frequently Asked Question (FAQ's)

Have questions? You’re not alone. We’ve answered the most frequently asked questions to help you feel confident and informed every step of the way.
What is Prep2Certs?

Prep2Certsis a premium service offering a comprehensive collection of exam questions and answers for over 1400 certification exams. It is regularly updated and designed to help users pass their certification exams confidently.

Please contact info@Prep2Certs.com and we will provide you with alternative payment options.

You can by Contacting our sales team.

Free updates are available for the duration of your subscription, after the subscription is expired, your access will no longer be available.