From your laptop you must deploy resources with Terraform using a service account; your Cloud Identity has iam.serviceAccountTokenCreator. Following Google best practices, how should you configure your local environment to act as that service account?
Choose an answer
Tap an option to check your answer.
Correct answer: 1. Run the following command from a command line: gcloud config set auth/impersonate_service_account service-account-name@project.iam.gserviceaccount.com. 2. Set the GOOGLE_OAUTH_ACCESS_TOKEN environment variable to the value that is returned by the gcloud auth print-access-token command..
Why this is the answer
The correct answer describes service account impersonation, a Google best practice for local development. By configuring gcloud to impersonate the service account, your personal credentials are used to obtain short-lived tokens for the service account, eliminating the need to store sensitive key files locally. This enhances security by reducing the risk associated with long-lived credentials. Option 1 (downloading a key file) is less secure as it involves storing a long-lived credential directly on your laptop, which is not a best practice. Option 3 (gcloud auth application-default login) authenticates as your personal identity, not the service account. Option 4 (Hashicorp Vault) is a valid solution for managing secrets in a production environment but is overly complex for configuring a local development environment to act as a service account, especially when a simpler, built-in gcloud impersonation method exists.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed