Professional Cloud DevOps Engineer
Prepare and test your skills
Prepare and test your skills
Worked example. The correct answer is already marked and every option is explained below, so there is nothing to select here. To answer questions yourself, start the free trial.
Keep the momentum going with these hand-picked practice scenarios
Want more questions like this?
Get a free certification question every week.
Last updated
Your enterprise DevOps team is establishing an automated CI/CD pipeline in Google Cloud Build to produce secure, immutable golden VM images for Compute Engine workloads using HashiCorp Packer.
The pipeline must satisfy the following architectural and security requirements:
Which configuration and IAM permission setup should you implement?
Submit the community Packer builder to your project registry, grant the Compute Engine Instance Admin role (roles/compute.instanceAdmin.v1) to the Cloud Build service account, and configure cloudbuild.yaml to invoke packer build with image family and project parameters.
Deploy Jenkins on a Compute Engine instance with full Cloud Platform API scopes, install the GKE plugin, and use kpt to render Kubernetes manifests into disk images.
Grant the Project Editor role (roles/editor) to the default Compute Engine service account, and run a bash script step in Cloud Build that installs the Packer binary on the fly and creates standalone unversioned images.
Grant the Compute Image User role (roles/compute.imageUser) to the Cloud Build service account, and configure a Cloud Build step that executes startup scripts directly on live production VMs to configure dependencies in place.
Submit the community Packer builder to your project registry, grant the Compute Engine Instance Admin role (roles/compute.instanceAdmin.v1) to the Cloud Build service account, and configure cloudbuild.yaml to invoke packer build with image family and project parameters.
Automating golden machine image creation with HashiCorp Packer inside Google Cloud Build enables declarative, reproducible, and immutable VM image lifecycles. Cloud Build executes containerized build steps, using a prebuilt Packer builder container image stored in Artifact Registry or Container Registry to provision temporary instances, install hardened dependencies, and package the resulting disk into a Compute Engine image.
roles/compute.instanceAdmin.v1) role provides the necessary permissions to create, run, and delete temporary VM build instances and register machine images, without granting overly permissive roles like roles/editor or roles/owner.packer build inside the execution container, passing necessary project, zone, and template parameters directly through cloudbuild.yaml.image_family parameter ensures that downstream deployment tooling (like Terraform, MIG templates, or deployment scripts) can always query and reference the newest active image in the family.This solution implements Google Cloud best practices for image baking by leveraging containerized build steps and scoped predefined IAM roles. It eliminates manual intervention and prevents broad administrative privilege escalation across the cloud environment.
Deploy Jenkins on a Compute Engine instance with full Cloud Platform API scopes, install the GKE plugin, and use kpt to render Kubernetes manifests into disk images.
Grant the Project Editor role (roles/editor) to the default Compute Engine service account, and run a bash script step in Cloud Build that installs the Packer binary on the fly and creates standalone unversioned images.
Grant the Compute Image User role (roles/compute.imageUser) to the Cloud Build service account, and configure a Cloud Build step that executes startup scripts directly on live production VMs to configure dependencies in place.