0
0
Terraformcloud~10 mins

Bulk import strategies in Terraform - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import a resource using Terraform CLI.

Terraform
terraform import [1] my_resource_id
Drag options to blanks, or click blank then click option'
Aimport.aws_instance
Bresource.aws_instance
Caws_instance.example
Dexample.aws_instance
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect resource address format.
Confusing resource type and resource name order.
2fill in blank
medium

Complete the code to import multiple resources using a script loop.

Terraform
for id in resource_ids; do terraform import [1] "$id"; done
Drag options to blanks, or click blank then click option'
Aaws_instance.example
Baws_instance
Cexample
Dresource.aws_instance
Attempts:
3 left
💡 Hint
Common Mistakes
Using only the resource type without the resource name.
Using only the resource name without the type.
3fill in blank
hard

Fix the error in the bulk import command by completing the missing part.

Terraform
terraform import -input=false -lock=false [1] resource_id
Drag options to blanks, or click blank then click option'
Aexample.aws_instance
Bresource.example
Caws_instance
Daws_instance.example
Attempts:
3 left
💡 Hint
Common Mistakes
Using only the resource type without the name.
Swapping the order of resource name and type.
4fill in blank
hard

Fill both blanks to create a Terraform script snippet that imports resources from a list.

Terraform
for id in resource_ids; do terraform import [1] "$id"; done
resource_address = "[2]"
Drag options to blanks, or click blank then click option'
Aaws_s3_bucket.mybucket
Baws_s3_bucket
Cmybucket
Dresource.aws_s3_bucket
Attempts:
3 left
💡 Hint
Common Mistakes
Using resource name alone in the import command.
Using incorrect resource address format.
5fill in blank
hard

Fill all three blanks to define a Terraform import command inside a loop with dynamic resource names.

Terraform
for id in ids; do terraform import [1].$[2] "$id"; done
resource_type = "[3]"
Drag options to blanks, or click blank then click option'
Aaws_instance
Bname
Dresource_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect variable names for resource name.
Mixing resource type and name in the wrong order.