nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-003 · Question #212

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

The correct answer is C. Rebuild only the instances that were deleted. Terraform detects infrastructure drift by comparing the state file with the actual infrastructure. When an instance is manually deleted, Terraform sees it as missing and marks it for recreation. Running terraform apply will only recreate the missing instances while leaving the…

Navigate Terraform workflow

Question

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

Options

  • ATear down the entire workspace's infrastructure and rebuild it.
  • BBuild a completely brand new set of infrastructure.
  • CRebuild only the instances that were deleted.
  • DStop and generate an error message about the missing instances.

How the community answered

(33 responses)
  • A
    3% (1)
  • B
    6% (2)
  • C
    79% (26)
  • D
    12% (4)

Explanation

Terraform detects infrastructure drift by comparing the state file with the actual infrastructure. When an instance is manually deleted, Terraform sees it as missing and marks it for recreation. Running terraform apply will only recreate the missing instances while 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; it rebuilds missing resources

Topics

#terraform apply#state reconciliation#drift remediation

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-003 Practice