Recall & Review
beginner
What is the purpose of configuring a GCS backend in Terraform?
A GCS backend stores Terraform state files remotely in Google Cloud Storage, enabling team collaboration and state locking.
Click to reveal answer
beginner
Which key information must be provided to configure a GCS backend in Terraform?
You must provide the bucket name, prefix (optional path inside the bucket), and optionally the credentials or project details.
Click to reveal answer
intermediate
How does Terraform ensure state consistency when using a GCS backend?
Terraform uses object locking features of GCS to prevent concurrent state changes and maintain consistency.
Click to reveal answer
beginner
Show a minimal valid Terraform configuration snippet for a GCS backend.
terraform {
backend "gcs" {
bucket = "my-terraform-state"
prefix = "terraform/state"
}
}
Click to reveal answer
intermediate
Why is it recommended to enable versioning on the GCS bucket used for Terraform state?
Versioning allows recovery of previous state files if the current state is corrupted or accidentally deleted.
Click to reveal answer
What does the 'prefix' attribute specify in a GCS backend configuration?
✗ Incorrect
The 'prefix' defines the path inside the bucket to organize state files.
Which command initializes Terraform with the configured GCS backend?
✗ Incorrect
'terraform init' sets up the backend and downloads necessary plugins.
What is a key benefit of using a remote backend like GCS for Terraform state?
✗ Incorrect
Remote backends allow multiple users to share and lock state files safely.
Which of these is NOT required in a GCS backend block?
✗ Incorrect
'region' is not a required attribute for GCS backend configuration.
What happens if you do not enable versioning on the GCS bucket used for Terraform state?
✗ Incorrect
Without versioning, old state files are lost if overwritten or deleted.
Explain how to configure a GCS backend in Terraform and why it is useful.
Think about storing state remotely for teamwork.
You got /5 concepts.
Describe best practices when using GCS as a Terraform backend.
Consider safety and organization of state files.
You got /4 concepts.