Google Cloud Engineer interview question · Most asked

How do you run Terraform for Google Cloud safely in a team?

How you'd do it Asked in Cloud Engineer interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

Store state in a Cloud Storage backend (with object versioning; the GCS backend locks state natively), run plans and applies from CI with a dedicated service account authenticated through Workload Identity Federation, pin provider versions, and review plans on pull requests. Split state by environment and component so one apply can't touch everything.

Longer Answer

terraform {
  backend "gcs" {
    bucket = "acme-tfstate-prod"
    prefix = "network"
  }
  required_providers {
    google = { source = "hashicorp/google", version = "~> 7.0" }
  }
}
  • The CI service account has only the roles needed for that stack; humans impersonate it for break-glass.
  • Enable required APIs in Terraform (google_project_service) and beware of disabling them on destroy.
  • Use google_project_iam_member (additive) rather than _binding/_policy resources unless you intend to own the whole policy, which can remove others' access.
  • Drift: scheduled plans; Config Validator or policy checks on plans.

Key Points

  • GCS backend with versioning and locking.
  • CI with Workload Identity Federation, no keys.
  • Pin providers; split state.
  • Prefer additive IAM member resources.
  • Scheduled plans for drift.

Explanation

What interviewers look for

Safe state handling and the IAM resource gotcha specific to the Google provider.

More Google Cloud Engineer questions

← All Google Cloud Engineer questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake