20+ practice questions focused on Read, generate and modify configuration — one of the most tested topics on the HashiCorp Terraform Associate TF-004 exam. Each question includes a detailed explanation so you learn why the right answer is correct.
Start Read, generate and modify configuration PracticeAn operator runs 'terraform plan' and sees that a resource will be replaced. They want to avoid destroying the resource, but still apply other changes. What should they do?
Explanation: To avoid destroying the resource while still applying other changes, the operator should use the `ignore_changes` lifecycle argument on the attribute that is causing the replacement. This tells Terraform to ignore changes to that specific attribute, so it will not plan a replacement. Other changes (e.g., to other attributes) can still be applied. Option A (`terraform apply -replace`) explicitly forces the replacement of a resource, which involves destroying the old one, directly contradicting the operator's goal to avoid destruction. Option B (`create_before_destroy`) does not prevent destruction; it only changes the order so the new resource is created before the old one is destroyed, but the old resource is still ultimately destroyed. Option D (`prevent_destroy`) would block any destroy operation, but it would also cause the apply to fail if a replacement is required, preventing other changes from being applied.
Which THREE statements about Terraform modules are correct?
Explanation: Terraform modules are a fundamental way to organize and reuse configuration. They can be sourced from various locations, including local file paths (Option A), allowing for modular development within a single project using relative or absolute paths (e.g., `source = "./modules/network"`). Additionally, modules can be published to and consumed from the Terraform Registry (Option D), which serves as a central repository for sharing reusable infrastructure code. To allow calling modules to access specific values or resources defined within a module, modules expose output values using `output` blocks (Option E), making them accessible to parent modules or the root configuration.
When running terraform apply on a configuration that creates an AWS EIP resource referencing `aws_instance.web.id`, you receive the error: "Error: Missing required argument: The argument "instance" is required, but no definition was found." Given this configuration, what is the most likely cause of this error?
Explanation: The error 'Missing required argument: The argument "instance" is required, but no definition was found.' indicates that the `aws_eip` resource is missing the `instance` argument. Among the given options, the most likely cause is a syntax error in the `ami` attribute of `aws_instance.web`, which would prevent the instance resource from being created. This could lead to a situation where the EIP resource does not have a valid instance to reference, resulting in the missing argument error. While the error message itself points to a missing argument, the root cause can be a syntax error in a dependent resource that causes Terraform to skip or fail to create that resource, thereby leaving the EIP resource without a required input. Other options are incorrect: A refers to an irrelevant output block, B uses non-existent syntax, and C misattributes the error to a missing `depends_on`, which does not affect argument definition.
Which TWO of the following are valid ways to reference a value from a Terraform configuration?
Explanation: The explanation for option B states 'locals are accessed using `local.name` only', which is incorrect. If `local.example` is a map or object (e.g., `locals { example = { value = "foo" } }`), then `local.example.value` is a perfectly valid way to reference a value. Therefore, option B should be considered a valid reference. The explanation for option E dismisses `aws_instance.example.id` by stating it's 'not considered a 'value' from the configuration in the context of this question focusing on input variables, locals, and module outputs.' However, resource attributes are fundamental values derived from a Terraform configuration. While the 'EXAM TRAP' note suggests a focus on specific namespaces (`var`, `local`, `module`, `data`), the stem itself does not define this narrow scope. Syntactically, `aws_instance.example.id` is a valid way to reference a value. Given that options A (`var.environment`), B (`local.example.value`), C (`module.example.arn`), and E (`aws_instance.example.id`) are all syntactically valid ways to reference a value from a Terraform configuration, the question asking for 'Which TWO' is fundamentally flawed as it has more than two correct answers.
A configuration creates multiple AWS instances using count. The developer wants to output the IDs of all instances. Which output block is valid? (Choose the best answer.)
Explanation: All three output blocks are valid ways to reference the IDs of instances created with `count`. In Terraform, `aws_instance.web.*.id` uses the legacy splat syntax, `aws_instance.web[*].id` uses the newer splat expression, and `[for i in aws_instance.web : i.id]` uses a `for` loop to iterate over the list of resources. All three produce the same result: a list of instance IDs.
+15 more Read, generate and modify configuration questions available
Practice all Read, generate and modify configuration questions1. Baseline your knowledge
Start with 10 questions to gauge your current understanding of Read, generate and modify configuration. This tells you whether you need a concept refresher or just practice.
2. Review every explanation
For each question — right or wrong — read the full explanation. Understanding why an answer is correct is more valuable than knowing the answer itself.
3. Focus on exam traps
Read, generate and modify configuration questions on the TF-004 frequently use trap wording. Look for subtle differences in answers that test your precision, not just general knowledge.
4. Reach 80% consistently
Do repeated sessions until you score 80%+ three times in a row. Then move to mixed-mode practice to test cross-topic recall under realistic conditions.
The exact number varies per candidate. Read, generate and modify configuration is tested as part of the HashiCorp Terraform Associate TF-004 blueprint. Practicing with targeted Read, generate and modify configuration questions ensures you can handle any format or difficulty that appears.
Yes. Courseiva provides free TF-004 practice questions across all exam topics and domains. The platform includes topic-based practice, mock exams, missed-question review, bookmarked questions, and readiness tracking — no account required.
Difficulty is subjective, but Read, generate and modify configuration is a high-priority exam concept tested in multiple ways — direct recall, scenario analysis, and command-output interpretation. Consistent practice is the best way to build confidence.
Launch a full Read, generate and modify configuration practice session with instant scoring and detailed explanations.
Start Read, generate and modify configuration Practice →