0
0
GCPcloud~10 mins

Terraform GCP provider setup - Interactive Code Practice

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

Complete the code to specify the Terraform provider for Google Cloud Platform.

GCP
provider "google" {
  project = "my-project-id"
  region  = "us-central1"
  [1] = "4.0"
}
Drag options to blanks, or click blank then click option'
Aapi_version
Bprovider_version
Cgcp_version
Dversion
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'provider_version' instead of 'version'.
Using 'gcp_version' or 'api_version' which are invalid.
2fill in blank
medium

Complete the code to set the credentials file path for the GCP provider.

GCP
provider "google" {
  credentials = file("[1]")
  project     = "my-project-id"
  region      = "us-central1"
}
Drag options to blanks, or click blank then click option'
A/path/to/keyfile.txt
B/path/to/credentials.json
C/path/to/config.yaml
D/path/to/secret.key
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-JSON file for credentials.
Using a path with wrong file extension.
3fill in blank
hard

Fix the error in the provider block by completing the missing attribute for specifying the region.

GCP
provider "google" {
  project     = "my-project-id"
  [1] = "us-west1"
  credentials = file("/path/to/credentials.json")
}
Drag options to blanks, or click blank then click option'
Alocation
Bzone
Cregion
Darea
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'zone' instead of 'region' in the provider block.
Using 'location' or 'area' which are invalid attributes.
4fill in blank
hard

Fill both blanks to configure the provider with project and region variables.

GCP
provider "google" {
  project = var.[1]
  region  = var.[2]
  credentials = file("/path/to/credentials.json")
}
Drag options to blanks, or click blank then click option'
Aproject_id
Bregion_name
Cregion
Dproject
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'project_id' instead of 'project' variable.
Using 'region_name' instead of 'region' variable.
5fill in blank
hard

Fill all three blanks to define variables for project, region, and credentials file path.

GCP
variable "[1]" {
  type        = string
  description = "The GCP project ID"
}

variable "[2]" {
  type        = string
  description = "The GCP region"
}

variable "[3]" {
  type        = string
  description = "Path to the GCP credentials JSON file"
}
Drag options to blanks, or click blank then click option'
Aproject
Bregion
Ccredentials_path
Dcredentials_file
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'credentials_file' instead of 'credentials_path'.
Using inconsistent variable names that don't match usage.