0
0
Terraformcloud~10 mins

Why importing existing resources matters in Terraform - Test Your Understanding

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

Complete the code to import an existing AWS S3 bucket into Terraform state.

Terraform
terraform import aws_s3_bucket.my_bucket [1]
Drag options to blanks, or click blank then click option'
Amy-existing-bucket
Baws_s3_bucket.my_bucket
Cbucket_name
Dmy_bucket
Attempts:
3 left
💡 Hint
Common Mistakes
Using the Terraform resource name instead of the actual bucket name.
Using an incorrect or placeholder name.
2fill in blank
medium

Complete the Terraform resource block to define an imported AWS EC2 instance.

Terraform
resource "aws_instance" "[1]" {
  # Configuration will be managed after import
}
Drag options to blanks, or click blank then click option'
Anew_instance
Bimported_bucket
Cmy_s3_bucket
Dexisting_instance
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated resource names.
Using names that conflict with other resources.
3fill in blank
hard

Fix the error in the import command to correctly import an existing AWS VPC with ID 'vpc-123abc'.

Terraform
terraform import [1] vpc-123abc
Drag options to blanks, or click blank then click option'
Aaws_vpc.my_vpc
Bvpc-123abc
Cmy_vpc
Daws_vpc.vpc-123abc
Attempts:
3 left
💡 Hint
Common Mistakes
Using the resource ID as the resource address.
Using incorrect resource type or name.
4fill in blank
hard

Fill both blanks to complete the Terraform import command for an existing AWS IAM role named 'admin-role'.

Terraform
terraform import [1] [2]
Drag options to blanks, or click blank then click option'
Aaws_iam_role.admin
Baws_iam_role
Cadmin-role
Dadmin
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the resource address and resource ID.
Using incomplete resource addresses.
5fill in blank
hard

Fill all three blanks to define a Terraform resource block for an imported AWS RDS instance named 'db-instance' with identifier 'prod-db'.

Terraform
resource "[1]" "[2]" {
  identifier = "[3]"
  # Additional configuration after import
}
Drag options to blanks, or click blank then click option'
Aaws_db_instance
Bimported_db
Cprod-db
Daws_instance
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong resource types like 'aws_instance' for RDS.
Confusing resource name with identifier.
Leaving identifier blank or incorrect.