Managing Contexts with tcloud CLI
Contexts in tcloud CLI allow you to manage multiple authentication configurations and switch between different Thalassa Cloud environments easily. This is particularly useful when working with multiple organisations, regions, or environments (production, staging, development).
What are Contexts?
A context is a named configuration that stores:
- API endpoint URL
- Authentication credentials (token or OIDC settings)
- Organisation identifier
- Default region (if applicable)
Contexts are stored locally and can be easily switched between using the --context flag or by setting a default context.
Basic Context Operations
Creating a Context
tcloud context create <context-name> \
--api=<api-endpoint> \
--token=<personal-access-token> \
--organisation=<org-slug>Example:
tcloud context create production \
--api=https://api.thalassa.cloud \
--token=pat_1234567890abcdef \
--organisation=my-companyCreating Contexts with OIDC
tcloud context create <context-name> \
--api=<api-endpoint> \
--client-id=<oidc-client-id> \
--client-secret=<oidc-client-secret> \
--organisation=<org-slug>Example:
tcloud context create enterprise \
--api=https://api.thalassa.cloud \
--client-id=my-oidc-client \
--client-secret=my-oidc-secret \
--organisation=myorgListing Contexts
View all available contexts:
tcloud context listOutput example:
NAME API ENDPOINT ORGANISATION
production https://api.thalassa.cloud my-companyUsing a Context
Method 1: Using the –context flag
tcloud --context=production me
tcloud --context=staging kubernetes listMethod 2: Setting a default context
# Set default context
tcloud context use production
# Now use commands without --context flag
tcloud me
tcloud kubernetes listAdvanced Context Management
Working with Multiple Organisations
If you have access to multiple organisations, create separate contexts for each, or switch between organisation using the context use-organisation sub command:
# Production organisation
tcloud context create prod-org \
--api=https://api.thalassa.cloud \
--token=prod_token \
--organisation=production-org
# Development organisation
tcloud context create dev-org \
--api=https://api.thalassa.cloud \
--token=dev_token \
--organisation=development-orgCustom API Endpoints
For self-hosted or custom Thalassa Cloud installations:
tcloud context create on-premise \
--api=https://my-company.thalassa.cloud \
--token=on_prem_token \
--organisation=on-premise-orgContext Configuration File
Contexts are stored in a configuration file. The location varies by operating system:
- Linux/macOS:
~/.tcloud - Windows:
%APPDATA%\tcloud
Best Practices
Security Considerations
- Never share context files - They contain sensitive authentication information
- Use different tokens for different contexts when possible
- Regularly rotate tokens and update contexts