Courseiva
Deploying and Implementing a Cloud SolutionhardMultiple ChoiceObjective-mapped

Google ACE Deploying and Implementing a Cloud Solution Practice Question

A team is using Terraform to manage Google Cloud resources. They want to store the Terraform state file in a Cloud Storage bucket to enable collaboration. Which Terraform backend configuration should be used?

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-tf-state" prefix = "prod" } }

The 'gcs' backend in Terraform stores state in a Cloud Storage bucket. The 'bucket' attribute specifies the bucket name, and 'prefix' is optional for folder structure.

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-tf-state" } }

    Why it's wrong here

    The backend block is not a valid argument inside a provider block; provider blocks configure the Google Cloud provider credentials and settings, not where Terraform stores its state. Backend configuration must be declared within a terraform block, such as `terraform { backend "gcs" { ... } }`. Even if placed correctly, the backend itself would override local state and requires the `bucket` and `prefix` arguments.

  • terraform { backend "cloud-storage" { bucket = "my-tf-state" path = "prod" } }

    Why it's wrong here

    The backend type for Google Cloud Storage is `gcs`, not `cloud-storage`; Terraform will not recognize `cloud-storage` as a valid backend identifier. Additionally, the GCS backend uses `prefix` to set the state file's key within the bucket, not `path`, which is used by other backends like the remote one. Using `path` here would cause an invalid configuration error.

  • terraform { backend "gcs" { bucket = "my-tf-state" folder = "prod" } }

    Why it's wrong here

    Although `gcs` is the correct backend type, the argument for specifying where the state file lives inside the bucket is `prefix`, not `folder`. The `folder` key is not defined by the GCS backend, so Terraform would reject the configuration as invalid. This prefix can include slashes to create a logical directory structure, e.g., `prefix = "prod/network"`.

  • terraform { backend "gcs" { bucket = "my-tf-state" prefix = "prod" } }

    Why this is correct

    This is the correct way to configure remote state storage for Google Cloud using Terraform. The `terraform` block wraps the backend declaration, the type is `gcs` for Google Cloud Storage, and the `bucket` and `prefix` arguments accurately define the bucket name and the object key within that bucket. Using a distinct prefix like `"prod"` allows multiple environments or components to share the same bucket while keeping their state files isolated and easily retrievable.

About these practice questions

This ACE question is part of Courseiva's 769-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.