Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a module source.
Terraform
module "network" { source = [1] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using module names instead of paths for source
Omitting quotes around the source path
✗ Incorrect
The source must be a relative path to the module directory, like "./modules/network".
2fill in blank
mediumComplete the code to pass a variable to a module.
Terraform
module "compute" { source = "./modules/compute" instance_type = [1] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around string values
Using underscores instead of dots in instance type
✗ Incorrect
Variable values must be strings enclosed in quotes, like "t2.micro".
3fill in blank
hardFix the error in the module output reference.
Terraform
output "subnet_id" { value = module.network.[1] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using camelCase or PascalCase instead of snake_case
Mismatching output names with module definitions
✗ Incorrect
Terraform output names are case-sensitive and usually snake_case, so subnet_id is correct.
4fill in blank
hardFill both blanks to define a module with variables and outputs correctly.
Terraform
module "storage" { source = [1] bucket_name = [2] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing module source with bucket name
Not quoting string values
✗ Incorrect
The source should be the module path "./modules/storage" and bucket_name a string like "storage-bucket".
5fill in blank
hardFill all three blanks to output a module's attribute with correct syntax.
Terraform
output "db_endpoint" { value = module.[1].[2]_[3] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong module name
Mixing up attribute parts or missing underscores
✗ Incorrect
The module name is 'database', and the output attribute is 'db_endpoint' combining 'db' and 'endpoint'.