TEDAI IAC
This project hosts terraform modules to deploy TED AI environment in AWS.
The Gitlab runner in AWS is responsible to deploy the environment updates after a successful Gitlab CI pipeline on main branch.
Requirements
- Terraform 1.3.9+
- AWS credentials with administration rights to create the bootstrap (S3 bucket and DynamoDB) to manages Terraform state
Project initialization
This must be done for a new environment only.
Before being able to use Gitlab CI pipeline to deploy Terraform updates, it is needed to create the configuration to hold the state. This is done with an S3 bucket and a DynamoDB table to handle concurrent execution.
This process is described in the following blogpost.
In summary:
- comment out the storage and other modules in main.tf
- comment out the backend s3 in the terraform provider
- plan and apply using your AWS profile, this will create the S3 bucket and DynamoDB tables
- uncomment the modules and backend from step 1 and 2 and plan+apply 4
Now, it is possible to update the terraform and plan/apply via a Gitlab CI pipeline. The state will be stored in S3 and used by the CI pipeline.
Terraform update process
- Create a branch from origin/main in Gitlab
- Update the modules and commit your changes on the branch. The Gitlab CI will validate the changes and create a plan for you to review
- Once validated, create a merge request in Gitlab, review it and merge it
- In the CI pipeline of the main branch, a new manual step is available: apply
- Check successful completion in apply step in Gitlab CI pipeline
TODO
- have a fully functional dev/test/prod environment setup, for the moment, only dev is supported.