Safe to run
Search
⌃K

Command line & Terraform - Account management

You have the option to manage your safe to run account via terraform or the CLI (as well as the online web app) - there are the instructions on how do this

Creating tokens

In order to set up organisations and applications using either Terraform or the command line tool you will first need to create a token on the admin portal.
To create a token, after logging in - select 'tokens' on the right hand action bar, and then click 'create token'
Do not share these tokens - they need to be kept secret
Once you have created a token, you can retrieve a copy of that key whenever you need it by going to https://app.safetorun.com

Creating an organisation

The next thing you'll need to do after creating an account and generating a token is to create an organisation.
In the web app
From the command line
Click "Configure" in order to use the interactive in-browser UI to create an organisation.
​
​
If you have previously created an organisation, type listOrgs to view the organisations you already have.
To create a new organisation, enter the following:
createOrg <your organisation ID> <Organisation name>
Once this is complete, verify that your organisation has been created by using the listOrgs command
listOrgs
To get started with the admin CLI, head over to: https://github.com/Safetorun/terraform-provider-safetorun And follow the readme.
To create a new organisation:
./safe_to_run_admin_api -a <token> create-org --organisation_id <org_id> --org_name <organisation name>
Next, to verify the creation:
./safe_to_run_admin_api -a <token> list-orgs

Create an application

An organisation can have many applications. In order to create an application, try the following command in the terminal
In the web app
From the command line
​
createApp <organisation ID from above> <Your application name>
In order to see your created applications for a particular organisation, you can use the following command:
listApps <organisation id> false
./safe_to_run_admin_api -a <token> create-app --organisation_id <orgId> --application_name <app name>
In order to see your created applications for a particular organisation, you can use the following command:
./safe_to_run_admin_api -a <token> list-apps --organisation_id <orgId>
The "false" flag above indicates whether or not to show the API keys of applications. Switch this to true will print out an API key.