Granting Minimal Permissions to a CI/CD Service Account for Terraform State
An organization is bootstrapping its Google Cloud environment and needs to establish a secure CI/CD pipeline that deploys infrastructure using Terraform. The pipeline must run in a dedicated project, and Terraform state must be stored in a Cloud Storage bucket. What is the most secure way to grant the CI/CD service account the minimal permissions required to manage the state bucket?
Quick Answer
The answer is to grant the service account the Storage Object Admin role on the specific Cloud Storage bucket. This is correct because it adheres to the principle of least privilege by scoping permissions to only object-level operations—like reading and writing Terraform state files—within that single bucket, rather than granting broader project-level storage access. On the Google Professional Cloud DevOps Engineer exam, this scenario tests your understanding of resource-level IAM versus project-level roles, often appearing as a trap where candidates mistakenly choose a project-wide role like Storage Admin. The key distinction is that the CI/CD pipeline runs in a dedicated project, but the state bucket itself is the resource requiring access control, making a bucket-specific role assignment the most secure approach. A helpful memory tip: think of the state bucket as a locked safe—you only give the pipeline the key to that safe (Object Admin), not the keys to the entire vault (Storage Admin).
⚠ Common exam trap
Candidates often confuse granting roles at the project level versus the resource level, mistakenly thinking project-level permissions are required for a single bucket, or they incorrectly assume that roles can be granted on a service account itself rather than on the resource being accessed.
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
✓
Grant the service account the Storage Object Admin role on the specific Cloud Storage bucket.
Granting the Storage Object Admin role (roles/storage.objectAdmin) on the specific Cloud Storage bucket follows the principle of least privilege. This allows the CI/CD service account to manage objects (including Terraform state files) within that bucket without granting broader permissions to other buckets or project-level storage operations. The pipeline runs in a dedicated project, but the state bucket itself is the resource that needs access control, making a resource-level role assignment the most secure approach.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Grant the service account the Storage Object Admin role on the service account itself.
Why it's wrong here
Roles are granted to identities, not on identities; this does not apply to the bucket.
- ✗
Grant the service account the Storage Object Admin role at the project level.
Why it's wrong here
Project-level role grants access to all buckets in the project, which is unnecessary.
- ✗
Grant the service account the Storage Admin role at the project level.
Why it's wrong here
Storage Admin is a broad role that grants full control over all storage resources in the project.
- ✓
Grant the service account the Storage Object Admin role on the specific Cloud Storage bucket.
Why this is correct
This grants minimal permissions to manage objects in that bucket only.
Go deeper
Related to this question
About these practice questions
One of 486 original PCDOE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on PCDOE
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A startup wants to implement infrastructure as code for their Google Cloud environment to ensure reproducibility. They are using Terraform and want to manage state securely. What is the recommended approach?
easy- A.Store Terraform state in a file in Cloud Shell home directory.
- B.Store Terraform state in Cloud Source Repositories as a YAML file.
- C.Store Terraform state locally on each developer's machine and use git to sync.
- ✓ D.Store Terraform state in a Cloud Storage bucket with object versioning enabled.
Why D: Storing Terraform state in a Cloud Storage bucket with object versioning enabled is the recommended approach because it provides a centralized, remote backend that supports state locking (via Cloud Storage's object lease mechanism) and version history for rollback. This ensures consistency across team members and protects against state corruption or accidental deletion, aligning with infrastructure as code best practices for reproducibility.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PCDOE 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 PCDOE exam.