0
0
GCPcloud~10 mins

Modules for reusability in GCP - Interactive Code Practice

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

Complete the code to declare a module source in Terraform.

GCP
module "network" {
  source = "[1]"
}
Drag options to blanks, or click blank then click option'
Anetwork-module
Bterraform-network
Cgcp-network
D./modules/network
Attempts:
3 left
💡 Hint
Common Mistakes
Using a module name instead of a path for source.
Omitting the source attribute.
2fill in blank
medium

Complete 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'
Aregion
Blocation
Czone
Darea
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different variable name than defined in the module.
Forgetting to pass required variables.
3fill in blank
hard

Fix 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'
Amachine-type
Bn1-standard-1
C"n1-standard-1"
Dstandard-1
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around string values.
Using invalid variable names.
4fill in blank
hard

Fill 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'
Anetwork
Bname
Cid
Dnet
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect module or output names.
Confusing output variable names with resource names.
5fill in blank
hard

Fill 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'
A./modules/storage_bucket
Bus-east1
Cmy-gcp-project
Dstorage_bucket_module
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect source paths.
Passing variables without quotes.
Using wrong variable names.