0
0
Terraformcloud~10 mins

Writing configuration for imported resources 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 define a resource block for an imported AWS S3 bucket.

Terraform
resource "aws_s3_bucket" "[1]" {
  bucket = "my-imported-bucket"
}
Drag options to blanks, or click blank then click option'
Aimported_bucket
Bmy_bucket
Cbucket_resource
Ds3bucket
Attempts:
3 left
💡 Hint
Common Mistakes
Using the actual bucket name as the resource block name (it should be a local name).
Including spaces or special characters in the resource name.
2fill in blank
medium

Complete the code to import an existing AWS EC2 instance by specifying its ID.

Terraform
resource "aws_instance" "example" {
  instance_id = "[1]"
}
Drag options to blanks, or click blank then click option'
Ainstance-01
Bi-1234567890abcdef0
Cec2-instance
Daws_instance_1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a made-up name instead of the real instance ID.
Confusing the resource name with the instance ID.
3fill in blank
hard

Fix the error in the Terraform resource block by completing the missing attribute for an imported AWS VPC.

Terraform
resource "aws_vpc" "main" {
  cidr_block = "[1]"
}
Drag options to blanks, or click blank then click option'
A192.168.0.0/24
Bvpc-12345678
C10.0.0.0/16
Dvpc-main
Attempts:
3 left
💡 Hint
Common Mistakes
Using the VPC ID instead of the CIDR block.
Using an invalid IP range format.
4fill in blank
hard

Fill both blanks to correctly define an imported AWS security group with a description and a VPC ID.

Terraform
resource "aws_security_group" "[1]" {
  name        = "imported_sg"
  description = "[2]"
  vpc_id      = "vpc-0abc1234def56789"
}
Drag options to blanks, or click blank then click option'
Aimported_sg
BSecurity group for imported resources
Cdefault_sg
DImported security group
Attempts:
3 left
💡 Hint
Common Mistakes
Using the VPC ID as the resource name.
Leaving the description empty or unclear.
5fill in blank
hard

Fill all three blanks to complete the Terraform configuration for an imported AWS RDS instance with allocated storage, engine type, and instance class.

Terraform
resource "aws_db_instance" "[1]" {
  allocated_storage    = [2]
  engine               = "[3]"
  instance_class       = "db.t3.medium"
  identifier           = "my-imported-db"
}
Drag options to blanks, or click blank then click option'
Aimported_db
B20
Cmysql
Dpostgres
Attempts:
3 left
💡 Hint
Common Mistakes
Using the engine name as the resource name.
Putting the storage size in quotes (it should be a number).
Using an unsupported engine name.