This guide will help you set up Atlantis for your GitOps repository to enable Terraform and Helm automation via GitHub comments.
- GitHub Personal Access Token or GitHub App
- Domain name for Atlantis (or use port-forwarding for testing)
- Kubernetes cluster with ArgoCD running
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click "Generate new token (classic)"
- Give it a name like "Atlantis GitOps"
- Select scopes:
repo(Full control of private repositories)write:discussion(Write team discussions)admin:org(if using organization webhooks)
- Copy the token (you won't see it again!)
If you prefer using a GitHub App:
- Go to GitHub Settings → Developer settings → GitHub Apps
- Click "New GitHub App"
- Fill in:
- GitHub App name:
atlantis-gitops - Homepage URL:
https://atlantis.yourdomain.com - Webhook URL:
https://atlantis.yourdomain.com/events - Webhook secret: Generate a random string
- GitHub App name:
- Select permissions:
- Repository permissions:
- Contents: Read
- Issues: Write
- Pull requests: Write
- Metadata: Read
- Subscribe to events:
- Pull request
- Issue comment
- Pull request review
- Repository permissions:
- Download the private key
Edit helm/atlantis/values.yaml:
atlantis:
env:
# Update these values
ATLANTIS_REPO_ALLOWLIST: "github.com/nwthomas/gitops" # Your repo
ATLANTIS_ATLANTIS_URL: "https://atlantis.yourdomain.com" # Your domain
GITHUB_USER: "nwthomas" # Your GitHub username
# If using GitHub App, uncomment and set:
# GITHUB_APP_ID: "123456" # Your GitHub App IDCreate the secret with your GitHub token:
# For Personal Access Token
kubectl create secret generic atlantis-secrets \
--from-literal=github-token="YOUR_GITHUB_TOKEN" \
-n atlantis
# For GitHub App (also include the private key)
kubectl create secret generic atlantis-secrets \
--from-literal=github-token="YOUR_GITHUB_TOKEN" \
--from-file=github-app-key=path/to/your/private-key.pem \
-n atlantis- Go to your repository settings → Webhooks
- Click "Add webhook"
- Fill in:
- Payload URL:
https://atlantis.yourdomain.com/events - Content type:
application/json - Secret: (if using GitHub App, use the webhook secret)
- Events: Select "Let me select individual events"
- Pull requests
- Issue comments
- Pull request reviews
- Payload URL:
- Click "Add webhook"
- Commit and push your changes to the repository
- ArgoCD will automatically deploy Atlantis
- Check the deployment:
kubectl get pods -n atlantis
kubectl get svc -n atlantis
kubectl get ingress -n atlantis- Create a test pull request that modifies files in the
/helmdirectory - Comment on the PR:
atlantis plan - Atlantis should respond with a plan
- If the plan looks good, comment:
atlantis apply - Atlantis will apply the changes
atlantis plan- Run terraform planatlantis apply- Apply terraform changesatlantis plan -p <project>- Plan specific projectatlantis apply -p <project>- Apply specific projectatlantis unlock- Unlock a locked workspaceatlantis help- Show help
Atlantis monitors these directories:
/helm/*- Helm charts/terraform- Terraform configurations/argocd/apps/*- ArgoCD applications
- User Restriction: Only
nwthomascan run Atlantis commands - Approval Required: All changes require PR approval
- Mergeable Required: PR must be mergeable before applying
- Repository Allowlist: Only your specific repository is allowed
kubectl logs -f deployment/atlantis -n atlantis- Go to your repository → Settings → Webhooks
- Click on your webhook
- Check "Recent Deliveries" for any failed deliveries
- Webhook not working: Check the webhook URL and secret
- Permission denied: Verify GitHub token has correct permissions
- Atlantis not responding: Check logs and ensure the service is running
- Terraform errors: Check the terraform configuration and state
If you don't have a domain set up yet:
kubectl port-forward svc/atlantis 4141:4141 -n atlantisThen use http://localhost:4141 as your webhook URL temporarily.
- GitHub Token: Store securely and rotate regularly
- Webhook Secret: Use a strong, random secret
- RBAC: Atlantis has minimal required permissions
- Network: Use HTTPS for webhook URLs
- Monitoring: Monitor Atlantis logs for suspicious activity
- Set up monitoring for Atlantis
- Configure backup for Atlantis data
- Set up alerting for failed plans/applies
- Consider setting up Atlantis for multiple repositories