GCP Environment Variables

Adding a GCP project to your track also sets a list of environment variables that you can use in commands and scripts:

Environment variable

Description

INSTRUQT_GCP_PROJECTS

A comma-separated list of project names that can be used to fill ${NAME} in the variables below

INSTRUQT_GCP_PROJECT_${NAME}_PROJECT_NAME

This injects the project display name

INSTRUQT_GCP_PROJECT_${NAME}_PROJECT_ID

This injects the project ID

INSTRUQT_GCP_PROJECT_${NAME}_USER_EMAIL

This injects the email address of the end user that has access to the project

INSTRUQT_GCP_PROJECT_${NAME}_USER_PASSWORD

This injects the password of the end user

INSTRUQT_GCP_PROJECT_${NAME}_SERVICE_ACCOUNT_EMAIL

This injects the email address of the end user services account for this project

INSTRUQT_GCP_PROJECT_${NAME}_SERVICE_ACCOUNT_KEY

This injects the Base64 encoded key for the end user services account

INSTRUQT_GCP_PROJECT_${NAME}_ADMIN_USER_EMAIL

This injects the email address of the admin user (Admin credentials are only injected into lifecycle scripts)

INSTRUQT_GCP_PROJECT_${NAME}_ADMIN_USER_PASSWORD

This injects the password of the admin user (Admin credentials are only injected into lifecycle scripts)

INSTRUQT_GCP_PROJECT_${NAME}_ADMIN_SERVICE_ACCOUNT_EMAIL

This injects the email address of the admin services account (Admin credentials are only injected into lifecycle scripts)

INSTRUQT_GCP_PROJECT_${NAME}_ADMIN_SERVICE_ACCOUNT_EMAIL

This injects the Base64 encoded key for the admin services account (Admin credentials are only injected into lifecycle scripts)

Example

This example shows the id of the GCP project from a terminal by using two environment variables. The value of the INSTRUQT_GCP_PROJECTS environment variable is inserted in the INSTRUQT_GCP_PROJECT_${NAME}_PROJECT_ID environment variable.

To follow along:

  1. Start your GCP project track and start the first challenge.

  2. Move over to the Cloud CLI terminal and enter the following command:

    eval echo "\${INSTRUQT_GCP_PROJECT_${INSTRUQT_GCP_PROJECTS}_PROJECT_ID}"

    ↳ The terminal shows the id of your GCP project.

Last updated

Was this helpful?