Introduction
GitOps is a process for automating cloud deployment using Git, infrastructure-as-code, and CI/CD tools. Your code repository will be the single source of truth for your infrastructure. At any point in time, your infrastructure-as-code configuration will mirror the existing infrastructure in the cloud. GitOps reduces the effort of installing infrastructure tools and running multiple deployment commands locally, and replaces that with a single git push or a merge request. Afterward, your CI/CD tool will take over and deploy the infrastructure while you sit back and monitor the deployment job.
The use of CI/CD tools such as GitLab provides the additional advantage of keeping your repository DRY (don’t repeat yourself). That is, using GitLab’s ephemeral runners removes any auto-generated files by the infrastructure-as-code tool during runtime. Once the GitLab job is completed, the auto-generated files will be discarded by the short-lived ephemeral runner. An Example of auto-generated files is the lock file generated by Terraform and the backend.tf and provider.