0
0
Terraformcloud~10 mins

GCP provider setup 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 specify the GCP provider in Terraform.

Terraform
provider "google" {
  project = "[1]"
}
Drag options to blanks, or click blank then click option'
Amy-gcp-project
Baws-project
Cazure-project
Dlocal-project
Attempts:
3 left
💡 Hint
Common Mistakes
Using project names from other cloud providers like AWS or Azure.
Leaving the project field empty.
2fill in blank
medium

Complete the code to specify the region for the GCP provider.

Terraform
provider "google" {
  project = "my-gcp-project"
  region  = "[1]"
}
Drag options to blanks, or click blank then click option'
Aeurope-west1
Bus-east-1
Cus-central1
Dasia-southeast1
Attempts:
3 left
💡 Hint
Common Mistakes
Using AWS region names like 'us-east-1' which are invalid in GCP.
Leaving the region field blank.
3fill in blank
hard

Fix the error in the provider block by completing the missing attribute.

Terraform
provider "google" {
  project = "my-gcp-project"
  region  = "us-central1"
  [1] = "/path/to/credentials.json"
}
Drag options to blanks, or click blank then click option'
Acredentials
Bcredentials_path
Cauth_file
Dservice_account
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect attribute names like 'credentials_path' or 'auth_file'.
Not providing the path to the credentials file.
4fill in blank
hard

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

Terraform
variable "project_id" {
  type = string
}

variable "region" {
  type = string
}

provider "google" {
  project = "[1]"
  region  = "[2]"
}
Drag options to blanks, or click blank then click option'
Avar.project_id
Bvar.region
Cvar.project
Dvar.location
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect variable names like 'var.project' or 'var.location'.
Omitting the 'var.' prefix.
5fill in blank
hard

Fill all three blanks to configure the provider with project, region, and credentials variables.

Terraform
variable "project_id" {
  type = string
}

variable "region" {
  type = string
}

variable "credentials_path" {
  type = string
}

provider "google" {
  project  = "[1]"
  region   = "[2]"
  credentials = "[3]"
}
Drag options to blanks, or click blank then click option'
Avar.project_id
Bvar.region
Cvar.credentials_path
Dvar.keyfile
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names like 'var.keyfile' instead of 'var.credentials_path'.
Forgetting the 'var.' prefix.