Courseiva
Understand Terraform's purposemediumMultiple ChoiceObjective-mapped

TF-004 Understand Terraform's purpose Practice Question

A team has been managing their AWS infrastructure using a collection of Bash scripts that create resources in a specific order. They frequently encounter issues where resources are created out of order or not properly cleaned up. They want to adopt a more reliable approach that ensures consistent provisioning and teardown. Which action best aligns with Terraform's purpose?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Convert the scripts into Terraform configuration files and use remote state.

Terraform's purpose is to manage infrastructure declaratively, handling dependencies and state. Converting to Terraform configs and using the plan/apply workflow ensures consistent provisioning. Continuing with scripts or using Ansible for provisioning are less effective.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Continue using the Bash scripts but add more error handling.

    Why it's wrong here

    While improved error handling is beneficial, Bash scripts are inherently imperative, meaning they specify *how* to achieve a desired state rather than *what* the desired state is. This approach makes managing complex infrastructure challenging, as scripts lack an inherent understanding of resource dependencies and cannot automatically determine the correct order of operations or ensure idempotency. This often leads to brittle, difficult-to-maintain infrastructure as code that is prone to order-of-operation issues.

  • Use Terraform but only store state locally on the lead engineer's machine.

    Why it's wrong here

    Storing Terraform state locally on a single machine severely hinders team collaboration, as other engineers cannot access or update the infrastructure's current state, leading to inconsistencies and potential overwrites. Furthermore, local state is vulnerable to data loss if the machine fails or the file is accidentally deleted, making it impossible to manage or destroy the provisioned resources reliably. This approach negates many benefits of Terraform for team environments and introduces significant operational risks.

  • Convert the scripts into Terraform configuration files and use remote state.

    Why this is correct

    Converting to Terraform configuration files leverages a declarative approach, allowing the team to define the desired end state of their AWS infrastructure, rather than the steps to get there. Terraform automatically builds a dependency graph, ensuring resources are provisioned in the correct order and handling updates efficiently. Utilizing remote state, such as in an S3 bucket with DynamoDB locking, enables secure team collaboration, prevents concurrent modifications, and maintains a consistent, shared record of the infrastructure's actual state.

  • Rewrite the scripts as Ansible playbooks for provisioning.

    Why it's wrong here

    While Ansible is excellent for configuration management and orchestration, it is primarily an imperative tool designed for managing existing servers and applications, not for provisioning cloud infrastructure from scratch. Unlike Terraform, Ansible does not inherently manage a persistent state file that tracks the lifecycle of provisioned resources, making it less suitable for creating, updating, and destroying cloud resources reliably. Its focus is on *how* to configure, rather than *what* infrastructure to create and manage over its full lifecycle.

About these practice questions

Courseiva writes every TF-004 question from scratch — 428 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This TF-004 practice question is part of Courseiva's free HashiCorp certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the TF-004 exam.