🚀Getting Started
We use Gitpod to develop the platform. You can have a complete development environment to test all the components and features with one click using the following button.
Gitpod is free for 50 hours every month, so you dont have to worry for testing the application.
Running Terrakube in Gitpod is like running the platform in any Kubernetes distribution in Azure, Aws or GCP, so you will be able to use all the features available with one single click without installing any software in your computer and the environment should be ready in only 1 or 2 minute.
Terrakube API uses an in memory database, it will be deleted and preloaded with default information in every startup.
Gitpod Environment Information.
A file called GITPOD.md will have the information for the entire workspace
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181385377-c25610e5-f39b-48f4-aa5c-3bfafce54794.png&width=768&dpr=4&quality=100&sign=b79452b6&sv=1)
The configuration is generated dynamically using the following bash script. This is executed by Gitpod in the environment startup process.
If for some reason we need to execute the script again, it needs to be executed form the /workspace/terrakube folder
The development environment will have the following information:
Groups |
---|
TERRAKUBE_ADMIN |
TERRAKUBE_DEVELOPERS |
AZURE_DEVELOPERS |
AWS_DEVELOPERS |
GCP_DEVELOPERS |
User | Password | Member Of |
---|---|---|
admin | TERRAKUBE_ADMIN, TERRAKUBE_DEVELOPERS | |
aws | AWS_DEVELOPERS | |
azure | AZURE_DEVELOPERS | |
gcp | GCP_DEVELOPERS |
Start Development Environment
To run all the Terrakube components run the following task:
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181374024-a8f546ba-dbf7-4ac9-a74b-04ff8759f165.png&width=768&dpr=4&quality=100&sign=686b8171&sv=1)
After a couple of seconds all the components will be running, you can start/stop/restart any component as needed.
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181374080-c7486a32-b4f2-41d3-9112-5861e3fdc8d9.png&width=768&dpr=4&quality=100&sign=6db16d44&sv=1)
Login Development Environment
After the application startup is completed, we can login to the development environment, to get the URL you can execute the following command:
The Terrakube login will look like this example:
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181138967-401c142a-9366-4d1b-8506-1c667f5ab543.png&width=768&dpr=4&quality=100&sign=7f4619c2&sv=1)
Dex Authentication.
The Gitpod environment is using an OpenLDAP tha is connected to a Dex using the LDAP connector. The OpenLDAP configuration(users and groups) can be found in the following file:
The Dex configuration file is generated dynamically and will be available in the following file:
The template that is used to generate the Dex configuration file can be found in this path:
Dex login page should look like this example:
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181138996-f6ae507f-c3cf-460a-bc12-60ed6cb2e159.png&width=768&dpr=4&quality=100&sign=2deb71c9&sv=1)
Sample Organizations
The development environment will be preloaded with 4 organizations(azure, gcp, aws and simple), this information is loaded inside the API startup and the scripts to load the information can be found in the following xml files
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181139038-ff3c449a-7c4a-4346-b1d1-08a150b99307.png&width=768&dpr=4&quality=100&sign=4d991d1a&sv=1)
Sample Teams
Depending of the selected organization and user you will see different information available.
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181139272-3d73ece3-718c-43ec-aaaf-8cff7ddef227.png&width=768&dpr=4&quality=100&sign=915614d7&sv=1)
Sample Modules
Each organization is preloaded with some modules that can be found in Github like the following:
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181139092-c82fb7b1-6423-4159-ba74-8d842468ab75.png&width=768&dpr=4&quality=100&sign=9aeeeca7&sv=1)
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181139125-8cbe1cc8-9149-4ab7-bd5f-a5430bafb792.png&width=768&dpr=4&quality=100&sign=c1c28e63&sv=1)
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181139149-a052e4b0-ad63-49f9-bb52-8dfbb1c54915.png&width=768&dpr=4&quality=100&sign=16940b22&sv=1)
Templates
Each organization is preloaded with the following templates to run Terrakube jobs:
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181139239-ee39bb71-e52d-43ca-b791-075701d4d9eb.png&width=768&dpr=4&quality=100&sign=2ce28c6a&sv=1)
For more information of how to use templates please refer to the following repository
Workspaces
All the organization have different empty workspaces, the Simple organization can be used for testing because the workspace is using a basic terraform file with the following resources:
null_resource
time_sleep
Other workspaces can be created but they will be deleted on each restart unless are added inside the initialization scripts:
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181139337-624bdfcc-684b-4531-9cac-6cc6455232de.png&width=768&dpr=4&quality=100&sign=1048a242&sv=1)
API Testing
Gitpod has the thunder-client installed to easily test the API without using the UI.
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181368786-86e18f0f-f04a-49cd-a7c3-345329f2550e.png&width=768&dpr=4&quality=100&sign=602561d3&sv=1)
All the environment variables for the collection are generated on each Gitpod workspace startup The environment variables template can be found in the following directory:
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181370059-449ea154-ebff-4da7-b498-46cee1437f42.png&width=768&dpr=4&quality=100&sign=e5deb8c6&sv=1)
To authenticate the thunder client you can use Dex Device Code Authentication using the following request
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181369061-41cf588c-c5de-41cf-8c81-2d09ae34d416.png&width=768&dpr=4&quality=100&sign=73bb997a&sv=1)
The response should look like the following and you can use the verification_uri_complete to finish the device authentication.
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181369527-9fe35c68-9753-4c59-886a-871795549a56.png&width=768&dpr=4&quality=100&sign=2cd06dc9&sv=1)
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181369588-5a9d26f5-bcf8-439c-8aaa-03ab2eff5a1f.png&width=768&dpr=4&quality=100&sign=86e22e63&sv=1)
Once the Dex device code authentication is completed you can use the following request to get the access token.
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181369778-e183a4d6-2506-4960-8824-08b66b4ee1c5.png&width=768&dpr=4&quality=100&sign=8c344aa0&sv=1)
Now you can call any method available in the API without the UI
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181369869-eddae1d5-0b13-4e6a-b484-3fcefc665d4d.png&width=768&dpr=4&quality=100&sign=810a8ff4&sv=1)
Terraform Login Protocol
Terraform login protocol can be tested using the thunder-client collection:
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181377967-b0178cf5-9378-4305-a6c8-d516c6882f12.png&width=768&dpr=4&quality=100&sign=3cd81897&sv=1)
The response should look similar to the following:
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181378021-61ec1041-842c-4b58-bcb3-14df2aeb3ad3.png&width=768&dpr=4&quality=100&sign=e45c2813&sv=1)
Terraform Module Protocol
There is one example of terraform module protocol inside the thunder-client collection that you can be used for testing purposes executing the following two request.
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181378277-c58250be-1dec-4351-a91e-ae66e0417826.png&width=768&dpr=4&quality=100&sign=4b813c7e&sv=1)
The response should look like the following:
Getting versions for the module
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181378462-e2ddb743-5dfe-40f9-b780-db948635f237.png&width=768&dpr=4&quality=100&sign=a3a10c37&sv=1)
Getting zip file for the module
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181378504-39aa618f-2d5f-4873-a4c5-3c4e64795191.png&width=768&dpr=4&quality=100&sign=ae7b8642&sv=1)
OpenAPI Spec
The specification can be obtained using the following request:
![](https://docs.terrakube.io/~gitbook/image?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F4461895%2F181378782-4cd46efc-a4ea-472f-9547-9e1d22cc91e5.png&width=768&dpr=4&quality=100&sign=56b3842f&sv=1)