Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a module source in Terraform.
GCP
module "network" { source = "[1]" }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a module name instead of a path for source.
Omitting the source attribute.
✗ Incorrect
The source attribute specifies the path to the module directory. Using a relative path like './modules/network' correctly points to the module folder.
2fill in blank
mediumComplete the code to pass a variable named 'region' to the module.
GCP
module "storage" { source = "./modules/storage" [1] = "us-central1" }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different variable name than defined in the module.
Forgetting to pass required variables.
✗ Incorrect
The variable name must match the input variable defined in the module. 'region' is the correct variable to pass the region value.
3fill in blank
hardFix the error in the module call by completing the missing attribute.
GCP
module "compute" { source = "./modules/compute" machine_type = [1] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around string values.
Using invalid variable names.
✗ Incorrect
String values must be enclosed in quotes. Without quotes, Terraform treats it as a variable or keyword, causing an error.
4fill in blank
hardFill both blanks to define a module output that returns the module's network name.
GCP
output "network_name" { value = module.[1].[2] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect module or output names.
Confusing output variable names with resource names.
✗ Incorrect
The output accesses the module named 'network' and retrieves its output variable 'name'.
5fill in blank
hardFill all three blanks to create a module call with source, region variable, and project variable.
GCP
module "storage_bucket" { source = "[1]" region = "[2]" project = "[3]" }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect source paths.
Passing variables without quotes.
Using wrong variable names.
✗ Incorrect
The source is the local path to the module folder. The region and project variables are passed as strings matching expected inputs.