Automate Terraform with Atlantis and GitLab

Atlantis is an infrastructure as code (IaC) tool to automate Terraform interactions within your GitLab/GitHub MR/PR workflow. This post uses the setup explained in an older post, where we used GitLab as Terraform backend. Instead of running terraform init/apply/plan on your local dev machine, you can now run it automagically when opening a merge request. This works by interacting via comments with Atlantis. Setup 1. Preparations First generate a personal access token for the gitlab user with scope api....

May 26, 2021 · 3 min · André Sterba

Gitlab as Terraform backend

I manage a few servers with some friends. We mostly rely on Terraform to update/change DNS records or create new VMs. Terraform use a state to store the last applied configuration of the managed infrastructure. The default location for this state is your local filesystem, but if you manage your infrastructure with multiple persons it must be shared. This can be problematic as it also contains secrets, like api tokens, so it should not be accessible for everyone....

January 23, 2021 · 2 min · André Sterba

Terraform and env variables

If you work with Terraform you might know the struggle setting the right environment variables. Especially if you work with different Terraform configurations on a daily basis. I found 2 tools (or a tool and a script) to make this much easier. The first is direnv which automagically sources env variables stored in a .envrc file if you change in a managed directory. $ mkdir direnv-test $ echo "export mykey=wasd" >> ....

January 8, 2021 · 2 min · André Sterba