Atlantis — server for automatic planning and applying Terraform via Pull Requests.
How it works:
terraform plan.atlantis apply.Installation (Docker):
1docker run -d \2 -p 4141:4141 \3 -e ATLANTIS_GITHUB_USER=myuser \4 -e ATLANTIS_GITHUB_TOKEN=xxx \5 -e ATLANTIS_WEBHOOK_SECRET=xxx \6 ghcr.io/runatlantis/atlantis:latest server
atlantis.yaml (in repository root):
1version: 32projects:3 - name: production-vpc4 dir: infrastructure/production/vpc5 workspace: default6 autoplan:7 when_modified: ["*.tf", "*.tfvars"]8 enabled: true9 apply_requirements: [approved, mergeable]10 workflow: custom11 - name: production-eks12 dir: infrastructure/production/eks13 workspace: default14 apply_requirements: [approved]1516workflows:17 custom:18 plan:19 steps:20 - init21 - run: terraform validate22 - plan:23 extra_args: ["-var-file", "terraform.tfvars"]24 apply:25 steps:26 - apply:27 extra_args: ["-var-file", "terraform.tfvars"]
Pre/Post workflow hooks:
1hooks:2 pre_plan:3 - run: tflint --config .tflint.hcl4 post_apply:5 - run: python notify_slack.py
Advantages: Code review for infrastructure, audit, automatic plan, locking.