0
0
Terraformcloud~5 mins

Terraform import command - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the Terraform import command?
The Terraform import command is used to bring existing infrastructure resources into Terraform's management without recreating them.
Click to reveal answer
beginner
How does Terraform import affect the state file?
Terraform import adds the existing resource to the Terraform state file, allowing Terraform to track and manage it going forward.
Click to reveal answer
intermediate
Can Terraform import create resource configuration automatically?
No, Terraform import only updates the state file. You must manually write the resource configuration in your Terraform files to match the imported resource.
Click to reveal answer
beginner
What is the general syntax of the Terraform import command?
terraform import [options] <resource_type.resource_name> <resource_id>
Click to reveal answer
intermediate
Why is it important to match the resource configuration with the imported resource?
If the configuration does not match the imported resource, Terraform may try to change or recreate the resource during the next apply.
Click to reveal answer
What does the Terraform import command do?
AAdds existing resources to Terraform state
BCreates new resources in the cloud
CDeletes resources from the cloud
DGenerates Terraform configuration files automatically
After importing a resource, what must you do next?
AWrite matching resource configuration in Terraform files
BRun terraform destroy immediately
CNothing, Terraform manages it automatically
DDelete the resource manually
Which file does Terraform update when you run terraform import?
ATerraform output file
BTerraform configuration file
CTerraform variables file
DTerraform state file
What happens if the Terraform configuration does not match the imported resource?
ATerraform deletes the resource automatically
BTerraform ignores the difference
CTerraform may try to change or recreate the resource
DTerraform exports the resource
Which is the correct syntax for importing a resource?
Aterraform import i-1234567890abcdef0 aws_instance.myvm
Bterraform import aws_instance.myvm i-1234567890abcdef0
Cterraform import myvm aws_instance i-1234567890abcdef0
Dterraform import aws_instance i-1234567890abcdef0 myvm
Explain how the Terraform import command works and why it is useful.
Think about how Terraform tracks resources and what import changes.
You got /4 concepts.
    Describe the steps you take after running terraform import to fully manage a resource.
    Import updates state but configuration is needed for management.
    You got /4 concepts.