Recall & Review
beginner
What is the purpose of the
import block in Terraform 1.5+?The
import block lets you bring existing infrastructure resources into Terraform's management by specifying their IDs directly in the configuration.Click to reveal answer
beginner
How do you specify the resource to import using the new import block syntax?You specify the resource address and the ID of the existing resource inside the <code>import</code> block, like this:<br><pre>import {
to = aws_instance.example
id = "i-1234567890abcdef0"
}</pre>Click to reveal answer
intermediate
Can you use multiple
import blocks in a single Terraform configuration?Yes, you can use multiple <code>import</code> blocks to import several resources at once, each with its own <code>to</code> and <code>id</code> values.Click to reveal answer
intermediate
What happens if you try to import a resource that is already managed by Terraform?Terraform will show an error because the resource is already tracked in the state. You should only import resources not yet managed.Click to reveal answer
advanced
Why is the import block syntax preferred over the old CLI import command?The import block syntax allows you to declare imports as part of your configuration files, making imports repeatable, version-controlled, and easier to automate.Click to reveal answer
What key fields must an
import block contain in Terraform 1.5+?✗ Incorrect
The
import block requires to (resource address) and id (existing resource ID) fields.Can the import block be used to create new resources in Terraform?
✗ Incorrect
The import block only brings existing resources under Terraform management; it does not create new resources.
Which Terraform version introduced the import block syntax?
✗ Incorrect
Terraform 1.5 introduced the import block syntax to declare imports in configuration files.
What is the benefit of declaring imports in Terraform configuration files?
✗ Incorrect
Declaring imports in config files makes them repeatable, version-controlled, and easier to automate.
If you want to import multiple resources, what should you do?
✗ Incorrect
You use multiple import blocks, each specifying one resource to import.
Explain how the import block syntax works in Terraform 1.5+ and why it is useful.
Think about how Terraform manages resources and why importing is needed.
You got /4 concepts.
Describe the steps to import an existing AWS instance using the import block syntax.
Focus on the syntax and the process flow.
You got /4 concepts.