Instruqt Docs
  • 🚩Getting started
    • Overview
    • Setting up
      • Study Room
    • Quickstart
  • 🛤️Tracks
    • Manage tracks
      • Create tracks
      • Edit locally
      • Test tracks
      • Track logs
      • Track time limits
      • Track feedback
      • Developer workflow
      • Track tags
      • Track authors
      • Delete tracks
      • Custom layouts
      • Version control
      • Loading experience
    • Challenges
      • Create challenges
      • Challenge tabs
      • Challenge order
      • Skip challenges
      • Add quizzes
      • Assignment display
      • Assignment editor
    • Share tracks
      • Live Events
        • Instructor tools
      • Track invites
      • Embed tracks
      • Landing pages
  • 🏖️Sandboxes
    • Overview
    • Sandbox hosts
      • Add hosts
      • Custom VM images
      • Custom container images
      • Public images
      • Windows VMs
      • Website service
      • SSL certificates
    • Cloud accounts
      • Securing your cloud accounts
      • Cloud Client
      • AWS accounts
        • AWS Environment Variables
        • AWS Managed Policies
        • AWS IAM Policies
        • AWS SCP Policies
      • Azure subscriptions
        • Azure Environment Variables
        • Azure Roles
        • Azure Resource Providers
      • GCP projects
        • GCP Environment Variables
        • GCP IAM Permissions
    • Lifecycle scripts
      • Scripting overview
      • Track scripts
      • Challenge scripts
      • Example scripts
      • Helper scripts
    • UI Checks
    • Global Sandbox Settings
      • Hot start
      • Sandbox presets
      • Custom resources
      • Cloud services and regions
        • Allowed services and regions
    • Secrets and variables
      • Runtime variables
      • Runtime parameters
      • Secrets
  • ⚙️Settings
    • Integrations
      • Salesforce (Beta)
      • HubSpot (Beta)
      • HubSpot (Using zapier)
      • LTI
      • Version control
        • GitHub
    • Authentication
      • SSO
      • API keys
    • Platform
      • API
      • Webhooks
      • Track limits
  • 💡Reference
    • Feature overview
    • Instruqt CLI
      • Commands
      • Configuration files
      • Assets
    • Instruqt platform
      • Networking
      • Host machine types
      • Quotas and limits
      • Roles and permissions
      • Network access
      • Requirements
  • 🛟Resources
    • Content design tips
    • Advanced use cases
    • Templates
    • FAQ
      • Running Windows Client Hosts on Instruqt
      • Using Cleanup Scripts in SaaS and Cloud Environments
      • Instruqt Regional Configurations and Restrictions
      • Troubleshooting Instruqt CLI Authentication Issues
      • Copy a Track from One Organization to Another via CLI
      • Network Configuration: IP and MAC Address Control
      • Container Troubleshooting in Instruqt
Powered by GitBook
On this page
  • View secrets
  • Add a secret
  • Update a secret
  • Delete a secret
  • Add secrets to tracks

Was this helpful?

Edit on GitHub
  1. Sandboxes
  2. Secrets and variables

Secrets

How to use secrets in lifecycle scripts.

PreviousRuntime parametersNextIntegrations

Last updated 11 months ago

Was this helpful?

Secrets are a secure way to store and maintain sensitive values (e.g. credentials or API tokens) for use in . Secrets are write-only, which prevents all users from reading their values. Secrets are defined on team level, allowing them to be used by multiple tracks.

Secrets can only be created/updated by team Owners, and can be used by Content Creators.

View secrets

Follow the steps bellow to access the Secret management page.

  1. Click Settings -> Secrets.

  2. A table will show detailing all your teams current Secrets

  1. Open a new terminal.

  2. Enter the following command:

    instruqt secrets list

    ↳ Instruqt CLI lists all secrets for the currently configured team. The output looks something like this:

    ==> Listing secrets for team TEAM_NAME
        NAME              CREATED                 UPDATED                 DESCRIPTION
        SECRET_KEY_1      2022-08-16T13:43:43     2022-08-16T13:43:43     Description of secret one
        SECRET_KEY_2      2022-08-16T13:44:23     2022-08-16T15:23:06     Description of secret two
    

Add a secret

Follow the steps below to add a new secret to your team.

  1. Click Settings -> Secrets.

  2. Click the Create button on the top right of the page

  3. In the Name field, enter a name or key of the secret. Secrets only accept letters, numbers and underscores (e.g. MY_SECRET_KEY).

  4. In the Description field, enter a description of the secret.

  5. In the Value field, enter the actual secret value.

  6. Click Save Changes.

  1. Open a new terminal.

  2. Enter the following command:

    instruqt secrets create SECRET_NAME "SECRET_VALUE" \ 
        --description="SECRET_DESCRIPTION"

    ⇨ Replace SECRET_NAME with the name of the secret you would like to create. ⇨ Replace SECRET_VALUE with the value of the secret. ↳ Instruqt CLI creates the new secret. The output looks something like this:

    ==> Create secret SECRET_NAME for team TEAM_NAME
        OK

The description should help content creators understand how the Secret should be used. It's recommend to keep the descriptions brief but indicative of how the secret should be used.

Update a secret

  1. Click Settings -> Secrets.

  2. Click ••• on the secret you would like to update and select Update.

  3. In the Description field, enter a new description if applicable.

  4. In the Value field, enter the new secret value, this is mandatory for updates.

  5. Click Save changes.

  1. Open a new terminal.

  2. Enter the following command:

    instruqt secrets update SECRET_NAME "SECRET_VALUE" 

    ⇨ Replace SECRET_NAME with the name of the secret you would like to create. ⇨ Replace SECRET_VALUE with the value of the secret. ↳ Instruqt CLI creates the new secret. The output looks something like this:

    ==> Update secret SECRET_NAME for team TEAM_NAME
        OK

When updating a Secret the value is always required. If you would like update the description only the previous secret value should be used.

Delete a secret

  1. Click Settings -> Secrets.

  2. Click ••• on the secret you would like to delete and select Delete. ↳ A delete confirmation is shown

  3. Click Confirm. ↳ The secret is deleted and removed and not available on the secrets table.

  1. Open a new terminal.

  2. Enter the following command:

    instruqt secrets delete SECRET_NAME 

    ⇨ Replace SECRET_NAME with the name of the secret you would like to delete. ↳ Instruqt CLI creates the new secret. The output looks something like this:

    ==> Delete secret SECRET_NAME for team TEAM_NAME
        OK

Once a Secret has been deleted it will not be possible to recover the value that was previously stored.

Add secrets to tracks

  1. Click the track to which you want to give secret access.

  2. In the Sandbox section, click Edit to open the Sandbox page.

  3. Click + Add a secret.

  4. Select the secrets you would like access in your track scripts by clicking the checked box.

  5. Click Save.

Add the following code into config.yml, where SECRET_NAME is the name of the secret you would like to make use of in the tracks lifecycle scripts.

secrets:
- name: SECRET_NAME

↳ Your config.yml file should be similar to this:

version: "3"
secrets:
- name: MY_SECRET_KEY
- name: ANOTHER_SECRET_KEY

Example

Consider the following example, making an authorised curl request using a username and password: 1. Add a Secret with SITE_PASSWORD as the name and the password as the value.

2. Add the following to your lifecycle script:

curl --user name:${SITE_PASSWORD} http://www.example.com

To make use of a Secret value in a tracks the track must to be granted access to the secret.

Adding a Secret to your track sets an environment variable which is available for the duration of a tracks .

🏖️
lifecycle scripts
lifecycle scripts
lifecycle scripts