Infrastructure as Code project to deploy lab infrastructure and configure instances. Working with Atrium, Gitlab CI, Terraform, Cloud-init, bash scripts and Scaleway.
## How does it work ?
### How does it work ?
The template will provision several resources (including your instances) to the Scaleway cloud provider using Terraform and Gitlab CI.
After provisioning, configuration of the instances and deployment of the services (Atrium and TTYD) will be done using Cloud-init and bash scripts.
The FORGE (Gitlab) manage the Infrastructure with Terraform at any state, plan, creation, modification and destruction with the CI. The FORGE store and will provide the configuration information
such as credentials to Terraform only during the running state to improve security. Then, informations are destroyed with the Gitlab Agent container.
> All your information must be stored in Gitlab and passed as variable to Terraform.
On run state, Terraform will create, modify and destroy infrastructure resources in Scaleway to match the configuration described in the configuration files.
### How the deployment is managed ?
**Resources deployed :**
The whole project is managed by Gitlab using the Gitlab CI.
Launching the pipeline will start the deployment of your infrastructure in 3 steps.
Terraform will perform a "fake deployment" and initialize everything he needs before deploying.
After performing, you will be able to see the plan of the future creation/modification/destruction in the log of the pipeline.
If the modification could lead to break changes and errors, you must not launch the next step of the pipeline.
**Creation :**
Terraform will be applying the exact changes you reviewed in the Plan step.
**Destruction :**
Terraform will destroy the resources he managed to create (or manually imported one).
After the resources provisionned with Terraform, Cloud-init will configure the instances by running bash scripts, creating files... And 3 services will be running for each instance.
## How can I use it ?
**Running services :**
### Step 0 : Prerequisite
- Atrium (Reverse proxy, TLS encryption and HTTPS to the others hosted services)
- Code-server
- Webtop
**On The Forge (Gitlab)**, you must have or ask for the right to fork the repository.
After deployment, each resource can be accessed though HTTPS depending on their count number :
From my instances, I should be able to access the variables as user-data using the command `scw-userdata <my-variable>` after declaring them in Terraform.