Terraform/Atlantis
Jump to navigation
Jump to search
Atlantis allows for Terraform executiuons from Git hosting systems like GitLab, GitHub or AzureDevops usilyzing their webhooks.
Local test run with Gitlab.com
```zsh
# Download Atlantis
wget https://github.com/runatlantis/atlantis/releases
# Start ngrok, so the git hosting systems can send events to your Atlantis instance
ngrok http 4141
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Session Expires 1 hour, 59 minutes
Version 2.3.40
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://737f-84-64-12-17.ngrok.io -> http://localhost:4141
Forwarding https://737f-84-64-12-17.ngrok.io -> http://localhost:4141
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
export HOSTNAME=gitlab.com
export ATLANTIS_URL=https://737f-84-64-12-17.ngrok.io # note ngrok has 2 hours time out
export SECRET=AAAAAAAAAAAA # this is locally generated secret/salt
export TOKEN=_1111111111111111111 # GitLab PAT (personal access token) User Settings > Access Tokens
export USERNAME=mygitlabuser
export REPOSITORY=myrepo
export REPO_ALLOWLIST="gitlab.com/${USERNAME}/${REPOSITORY}"
atlantis server \
--atlantis-url="$ATLANTIS_URL" \
--gitlab-user="$USERNAME" \
--gitlab-token="$TOKEN" \
--gitlab-webhook-secret="$SECRET" \
--gitlab-hostname="$HOSTNAME" \
--repo-allowlist="$REPO_ALLOWLIST"
```