0
0
Terraformcloud~5 mins

Writing configuration for imported resources in Terraform - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of writing configuration for imported resources in Terraform?
It allows Terraform to manage existing infrastructure by matching the imported resource with its configuration, so future changes can be tracked and applied.
Click to reveal answer
beginner
After importing a resource, why must you write its configuration in Terraform files?
Because importing only adds the resource to the state file; without configuration, Terraform doesn't know how to manage or update the resource.
Click to reveal answer
beginner
True or False: Terraform import automatically creates the resource configuration file.
False. Terraform import only updates the state. You must manually write the resource configuration to match the imported resource.
Click to reveal answer
intermediate
What is a best practice when writing configuration for imported resources?
Use the exact resource attributes as they exist in the cloud provider to avoid unexpected changes during future Terraform runs.
Click to reveal answer
beginner
How can you verify that your imported resource configuration matches the actual resource?
Run 'terraform plan' to see if Terraform wants to make any changes. If no changes are planned, the configuration matches the resource.
Click to reveal answer
What does 'terraform import' do?
AAdds an existing resource to Terraform state without creating configuration
BCreates a new resource in the cloud provider
CDeletes a resource from Terraform state
DAutomatically writes resource configuration files
Why is it important to write configuration after importing a resource?
ATo speed up Terraform apply
BTo delete the resource automatically
CTo backup the resource in the cloud
DTo allow Terraform to manage and update the resource
What command helps you check if your imported resource configuration matches the actual resource?
Aterraform plan
Bterraform import
Cterraform destroy
Dterraform init
If 'terraform plan' shows changes after import and configuration, what does it mean?
AThe import failed
BThe configuration does not match the actual resource
CThe resource was deleted
DTerraform is broken
Which is a recommended step after importing a resource?
AIgnore the resource in Terraform
BRun terraform destroy immediately
CManually write the resource configuration to match the imported resource
DDelete the state file
Explain the process and importance of writing configuration for imported resources in Terraform.
Think about what import does and what Terraform needs to manage resources.
You got /5 concepts.
    Describe how you would verify that your imported resource configuration is correct and what to do if it is not.
    Use Terraform commands to compare configuration and actual resource.
    You got /5 concepts.