Skip to content

Instantly share code, notes, and snippets.

@AlexAtkinson
Last active June 5, 2023 17:23
Show Gist options
  • Save AlexAtkinson/600d457ed816cc6e3c1c061ebb90e233 to your computer and use it in GitHub Desktop.
Save AlexAtkinson/600d457ed816cc6e3c1c061ebb90e233 to your computer and use it in GitHub Desktop.
Env0

Env0

Env0 is an IaC Control Plane.

Admin Helper Functions

You can add these to your .bashrc to improve your API workflow. Note that most of these require the following environment variables.

  • ENV0_ORGANIZATION_ID
  • ENV0_AUTH_TOKEN

Get Cloud Credential ID

function env0_get_cred_id {
  CRED_NAME=$1
  curl -sS -X GET \
    "https://api.env0.com/credentials?organizationId=$ENV0_ORGANIZATION_ID" \
    -H 'accept: application/json' \
    -H "authorization: Basic $ENV0_AUTH_TOKEN" \
    -H 'content-type: application/json' | \
    jq -r --arg cred "$CRED_NAME" '.[] | select( .name == $cred ) | .id'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment