0
0
Terraformcloud~20 mins

Terraform import command - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform Import Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Terraform import command behavior

What does the terraform import command do when executed?

AIt adds an existing cloud resource to the Terraform state without modifying the resource.
BIt creates the resource in the cloud provider based on the Terraform configuration.
CIt deletes the resource from the cloud provider and removes it from the Terraform state.
DIt updates the Terraform configuration files to match the existing cloud resource.
Attempts:
2 left
💡 Hint

Think about whether terraform import changes the actual cloud resource or just Terraform's knowledge of it.

Configuration
intermediate
2:00remaining
Correct syntax for Terraform import command

Which of the following is the correct syntax to import an AWS S3 bucket named my-bucket into Terraform resource aws_s3_bucket.example?

Aterraform import aws_s3_bucket.example aws_s3_bucket.my-bucket
Bterraform import aws_s3_bucket.example bucket/my-bucket
Cterraform import aws_s3_bucket.example my-bucket
Dterraform import aws_s3_bucket.example s3://my-bucket
Attempts:
2 left
💡 Hint

Remember the format is terraform import <resource_type.resource_name> <resource_id>.

Architecture
advanced
2:00remaining
Impact of importing resources on Terraform state and configuration

After importing an existing cloud resource into Terraform state using terraform import, what must you do to ensure Terraform manages the resource correctly in future runs?

ANo further action is needed; Terraform automatically updates configuration files.
BManually add the matching resource block to the Terraform configuration files.
CDelete the resource from the cloud and recreate it with Terraform.
DRun <code>terraform refresh</code> to update the configuration files automatically.
Attempts:
2 left
💡 Hint

Think about how Terraform knows what to manage after importing.

security
advanced
2:00remaining
Security considerations when using Terraform import

Which security risk is most relevant when using terraform import to add existing cloud resources to Terraform state?

ATerraform import can expose sensitive resource data in the state file if not handled securely.
BTerraform import automatically grants admin permissions to all users.
CTerraform import deletes resource access policies during import.
DTerraform import disables encryption on imported resources.
Attempts:
2 left
💡 Hint

Consider what information Terraform state files contain and how they are stored.

service_behavior
expert
2:00remaining
Behavior of Terraform import with resources having dependencies

You import a resource that depends on another resource not yet managed by Terraform. What happens when you run terraform plan after the import?

ATerraform will show no changes since the imported resource is in state.
BTerraform will fail with an error about missing dependencies.
CTerraform will automatically import the dependent resource as well.
DTerraform will plan to create the dependent resource since it is missing from the state.
Attempts:
2 left
💡 Hint

Think about how Terraform handles resources defined in configuration but not in state.