HashiCorp Certified: Terraform Associate — Question 261

When should Terraform configuration files be written when running terraform import on existing infrastructure?

Answer options

Correct answer: D

Explanation

The correct answer is D because Terraform requires the configuration files to define the desired state of the infrastructure before importing. Option A is incorrect as it implies that imports can occur without any configuration, which can lead to inconsistencies. Option B is misleading since Terraform does not automatically generate configuration files during an import, and option C suggests writing files after the import, which contradicts the need for pre-existing configurations.