Google ACE Deploying and Implementing a Cloud Solution Practice Question
A team is using Terraform to manage GCP infrastructure. They want to store the state file in a Cloud Storage bucket with versioning enabled. Which backend configuration is correct?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
terraform { backend "gcs" { bucket = "my-bucket" prefix = "terraform/state" } }
To use Cloud Storage as a backend, you must specify 'bucket' and optionally 'prefix' for the state file path. The provider block is for the Google provider, not state storage.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
provider "google" { backend "gcs" { bucket = "my-bucket" } }
Why it's wrong here
Placing the `backend "gcs"` block inside a `provider "google"` block is invalid syntax. Backend configuration is a special construct that must appear only inside a `terraform` block, while provider blocks are used solely for provider-specific settings such as project, region, or credentials. Terraform will reject this configuration with a syntax error because `backend` is not a supported argument of a provider block.
- ✓
terraform { backend "gcs" { bucket = "my-bucket" prefix = "terraform/state" } }
Why this is correct
This is the correct configuration because it uses the required `terraform` block with a `backend "gcs"` block, and includes both the `bucket` name (where the state file is stored) and a `prefix` (the object path within the bucket). The backend type is exactly `"gcs"`, and this syntax registers Google Cloud Storage as the remote state backend, enabling shared state and locking across the team.
- ✗
terraform { backend "gcs" { bucket = "my-bucket" versioning = true } }
Why it's wrong here
The argument `versioning = true` is not a recognized option for the GCS backend block. Backend configuration for `"gcs"` supports fields like `bucket`, `prefix`, `credentials`, and `encryption_key`, but bucket versioning is managed as a bucket property—usually by setting `versioning { enabled = true }` inside a `google_storage_bucket` resource. Terraform will fail with an unsupported argument error because versioning is not a backend-level setting.
- ✗
terraform { backend "cloud-storage" { bucket = "my-bucket" } }
Why it's wrong here
The backend name `"cloud-storage"` does not exist in Terraform; the correct backend type for Google Cloud Storage is `"gcs"`. Backend names are case-sensitive and must match exactly, so this configuration would fail during `terraform init` with an invalid backend type error. Even though the block is inside a `terraform` block, the misspelled backend name is the fatal issue here.
Go deeper
Related to this question
About these practice questions
Courseiva writes every ACE question from scratch — 769 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.