Bird
0
0

In a Google Cloud Build YAML file, how do you pass a secret named MY_SECRET from Secret Manager as an environment variable SECRET_VALUE to a build step?

medium📝 Predict Output Q5 of 15
GCP - Cloud Functions
In a Google Cloud Build YAML file, how do you pass a secret named MY_SECRET from Secret Manager as an environment variable SECRET_VALUE to a build step?
Asecrets: - secret: MY_SECRET secretEnv: SECRET_VALUE: MY_SECRET
Bsecrets: - secretEnv: SECRET_VALUE: MY_SECRET
Csecrets: - secret: MY_SECRET secretEnv: SECRET_VALUE: MY_SECRET
Dsecrets: - kmsKeyName: projects/my-project/locations/global/keyRings/my-keyring/cryptoKeys/my-key secretEnv: SECRET_VALUE: MY_SECRET
Step-by-Step Solution
Solution:
  1. Step 1: Recall Cloud Build secret syntax

    Secrets are referenced with 'secret' key and mapped to env vars under 'secretEnv'.
  2. Step 2: Identify correct YAML structure

    secrets: - secret: MY_SECRET secretEnv: SECRET_VALUE: MY_SECRET correctly uses 'secret' and maps to SECRET_VALUE environment variable.
  3. Final Answer:

    secrets: - secret: MY_SECRET secretEnv: SECRET_VALUE: MY_SECRET -> Option A
  4. Quick Check:

    Cloud Build secret syntax = secret + secretEnv mapping [OK]
Quick Trick: Use 'secret' and 'secretEnv' keys to map secrets to env vars [OK]
Common Mistakes:
  • Using kmsKeyName instead of secret
  • Missing 'secret' key
  • Incorrect indentation or keys

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes