Difference between revisions of "Terraform/Atlantis"

From Ever changing code
Jump to navigation Jump to search
(Created page with "[https://www.runatlantis.io/ Atlantis] allows for Terraform executiuons from Git hosting systems like GitLab, GitHub or AzureDevops usilyzing their webhooks. [https://www.ru...")
 
 
Line 40: Line 40:
```
```
</source>
</source>
= Resurces =
* [https://tech.loveholidays.com/enforcing-best-practice-on-self-serve-infrastructure-with-terraform-atlantis-and-policy-as-code-911f4f8c3e00 terraform-atlantis-and-policy-as-code]

Latest revision as of 17:54, 30 September 2021

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"
```

Resurces