Migrate from Terraform templates to OpenTofu components
Problem statement
On GitLab 18.0 the Terraform templates that we are using in the deployment project will be deprecated. The deprecation will take effect due to changes in the Terraform license.
Proposed solution
We can replace the Terraform template with the OpenTofu Gitlab component. We can follow the migration guide provided in the OpenTofu Gitlab component project.
Related links
- Warning message
- OpenTofu
- GitLab strategy about OpenTofu
- Migration guide from Terraform template to OpenTofu component
Implementation plan
-
Update handbook list of upstream tools by including the opentofu component version and opentofu version. -
Use gitlab.com/components/opentofu/job-templatesinstead of terraform template -
Configure the Opentofu component to point to the correct state_nameandroot_dir -
Migrate fmtjob. We should have a fmt job for all envs -
Migrate validatejob. We should have a validate job for all envs -
Refactor existing build devandbuild prodin smaller jobs -
Migrate buildjob to use opentofu -
Refactor existing push images devandpush images prodin one job namedpush imagesand use parallel jobs -
Refactor existing deploy devanddeploy prodin smaller jobs -
Migrate deployjob to use opentofu -
Migrate destroy-devto use opentofu. -
Add instructions on how to install opentofu and update apply.sh -
Update Readme if needed -
Update all other docs
Testing
- You can test all migrated jobs in a MR pipeline
- Test deploy commands first on your local environment and then on dev and finally on prod.
Improvements
- Use OpenTofu instead of Terraform
- Reduce the pipelines length by using parallel jobs speeding up dev efforts
Edited by Nick Ilieskou