Exam Terraform Associate All QuestionsBrowse all questions from this exam
Question 74

How is terraform import run?

    Correct Answer: D

    Terraform import is run by an explicit call. Terraform import can only import resources into the state and does not generate configuration. Before running terraform import, it is necessary to manually write a resource configuration block for the resource to which the imported object will be mapped. The command used is 'terraform import ADDRESS ID', where ADDRESS is the valid resource address and ID is the identifier of the resource to be imported.

Discussion
EltoothOption: D

I'm going with D based on this doc. "The current implementation of Terraform import can only import resources into the state. It does not generate configuration. A future version of Terraform will also generate configuration. Because of this, prior to running terraform import it is necessary to write manually a resource configuration block for the resource, to which the imported object will be mapped. While this may seem tedious, it still gives Terraform users an avenue for importing existing resources." https://www.terraform.io/cli/import/usage

Eltooth

https://www.terraform.io/cli/commands/import Usage: terraform import [options] ADDRESS ID Import will find the existing resource from ID and import it into your Terraform state at the given ADDRESS. ADDRESS must be a valid resource address. Because any resource address is valid, the import command can import resources into modules as well as directly into the root of your state. ID is dependent on the resource type being imported. If the ID is invalid, you'll just receive an error message. Warning: Terraform expects that each remote object it is managing will be bound to only one resource address, which is normally guaranteed by Terraform itself having created all objects. If you import existing objects into Terraform, be careful to import each remote object to only one Terraform resource address. If you import the same object multiple times, Terraform may exhibit unwanted behavior.

Ahmad_TerraformOption: D

By an explicit call

0ptimusOption: D

D is correct. I have tested it.

Clapton79Option: D

Latest version of Terraform can import as part of apply in case you have import {} clauses. Since this is not part of the answers, explicit call remains, answer D.

Power123Option: D

Correct answer is D