0
0
GCPcloud~5 mins

Terraform GCP provider setup - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the Terraform GCP provider?
The Terraform GCP provider allows Terraform to manage and interact with Google Cloud Platform resources by translating Terraform configurations into API calls to GCP.
Click to reveal answer
beginner
How do you specify the GCP project and region in the Terraform provider configuration?
You specify the project and region inside the provider block using the 'project' and 'region' attributes, for example:<br>
provider "google" {
  project = "my-gcp-project"
  region  = "us-central1"
}
Click to reveal answer
intermediate
What authentication methods can Terraform use to connect to GCP?
Terraform can authenticate to GCP using:<br>- Application Default Credentials (ADC)<br>- Service Account JSON key file<br>- Environment variables pointing to credentials<br>This allows Terraform to securely access GCP resources.
Click to reveal answer
beginner
What is the minimum Terraform block needed to initialize the GCP provider?
A minimal provider block looks like:<br>
provider "google" {
  project = "your-project-id"
  region  = "your-region"
}
<br>This tells Terraform which GCP project and region to use.
Click to reveal answer
beginner
Why is it important to run 'terraform init' after adding the GCP provider?
'terraform init' downloads the GCP provider plugin and sets up the working directory so Terraform can communicate with GCP. Without it, Terraform cannot apply or plan changes.
Click to reveal answer
Which block in Terraform config specifies the GCP provider?
Aprovider "google" {}
Bresource "google" {}
Cmodule "google" {}
Dvariable "google" {}
How does Terraform authenticate to GCP using a service account?
ABy using the 'region' attribute
BBy specifying the project ID only
CBy running 'terraform apply' without config
DBy setting the 'credentials' attribute with the path to the JSON key file
What command must you run to download the GCP provider plugin after adding it to your config?
Aterraform plan
Bterraform init
Cterraform apply
Dterraform validate
Which attribute is NOT part of the GCP provider configuration?
Ainstance_type
Bregion
Ccredentials
Dproject
What environment variable can Terraform use to find GCP credentials automatically?
AGCP_PROJECT_ID
BTERRAFORM_CREDENTIALS
CGOOGLE_APPLICATION_CREDENTIALS
DGOOGLE_REGION
Explain how to set up the Terraform GCP provider from scratch.
Think about what Terraform needs to connect and manage GCP resources.
You got /3 concepts.
    Describe the role of the 'terraform init' command in the GCP provider setup.
    Consider what happens before you can plan or apply changes.
    You got /3 concepts.