0
0
Terraformcloud~20 mins

Bulk import strategies in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Bulk Import Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Architecture
intermediate
2:00remaining
Choosing the best bulk import method for large resource sets

You have thousands of existing cloud resources to manage with Terraform. Which bulk import strategy is most efficient and scalable?

AManually write all resource blocks in Terraform and skip importing existing resources.
BManually run terraform import for each resource one by one using a shell script loop.
CUse terraform import with a generated script that runs imports in parallel batches.
DDelete all existing resources and recreate them with Terraform from scratch.
Attempts:
2 left
💡 Hint

Think about automation and speed when importing many resources.

Configuration
intermediate
2:00remaining
Terraform import command for multiple resources

You want to import multiple AWS S3 buckets into Terraform state using a script. Which command snippet correctly imports all buckets listed in a file named buckets.txt?

Aterraform import aws_s3_bucket.* buckets.txt
Bfor bucket in $(cat buckets.txt); do terraform import aws_s3_bucket.$bucket $bucket; done
Cterraform import aws_s3_bucket.buckets.txt buckets.txt
Dterraform import aws_s3_bucket $bucket < buckets.txt
Attempts:
2 left
💡 Hint

Consider how to loop over each bucket name and run import separately.

service_behavior
advanced
2:00remaining
Effect of importing resources without matching configuration

What happens if you run terraform import on a resource that is not defined in your Terraform configuration files?

ATerraform imports the resource into state but will ignore it during plan and apply until configuration exists.
BTerraform imports the resource into state but will show it as 'tainted' until configuration is added.
CTerraform throws an error and refuses to import the resource without matching configuration.
DTerraform imports the resource and automatically creates a default configuration block.
Attempts:
2 left
💡 Hint

Think about how Terraform manages state versus configuration.

security
advanced
2:00remaining
Security risks during bulk import of cloud resources

Which security risk is most relevant when performing bulk import of existing cloud resources into Terraform state?

ATerraform may overwrite resource permissions during import causing privilege escalation.
BBulk import deletes existing resources to recreate them with default security settings.
CTerraform import automatically disables resource encryption during import.
DImporting resources requires exposing sensitive credentials in scripts or logs.
Attempts:
2 left
💡 Hint

Consider what credentials and data are needed to run import commands safely.

Best Practice
expert
2:00remaining
Best practice for managing state consistency during bulk import

When importing thousands of resources in bulk, what is the best practice to ensure Terraform state consistency and avoid conflicts?

ALock the remote state backend and run imports sequentially or in controlled batches.
BRun all imports concurrently on multiple machines writing to the same remote state backend.
CDisable state locking and run imports in parallel to speed up the process.
DExport the state to local files and merge manually after imports complete.
Attempts:
2 left
💡 Hint

Think about how Terraform prevents state corruption during concurrent operations.