Using Atlantis for Terraform Pull Request Automation
Atlantis is an open-source TACOS (Terraform Automation and Collaboration Software) designed to enhance PR workflows for Terraform projects. It supports multiple VCS providers such as GitHub, Bitbucket, GitLab, and Azure DevOps, and can leverage both Terraform and Terragrunt workflows. Atlantis runs as a golang binary or Docker image and can be deployed on various platforms including VMs, Kubernetes, Fargate, etc. It provides a structured approach to ensure infrastructure changes are made in a controlled, transparent, and collaborative manner, integrating seamlessly with the existing pull request workflow used by development teams. Key steps of how Atlantis works include initialization, connecting to a VCS, detecting pull requests, automatic plan execution, commenting on plan output, manual approval, applying changes, executing apply, locking state, reporting status, logging and auditing, and custom workflows. The default Atlantis workflow involves making changes to a Terraform repository from a feature/hotfix branch, opening a PR against the main branch, triggering an atlantis plan, reviewing the plan within the pull request, providing approvals or feedback, issuing a command in a comment for approval, running terraform apply behind the scenes, reporting the status of the apply back to the pull request, and merging the pull request if successful. Atlantis enhances your workflow by extending Terraform's capabilities when working in a team, ensuring changes are collaborative, auditable, and consistent. It is useful for enhanced collaboration, pull request management, automation and consistency, integration with CI/CD systems, environment stability, and scaling infrastructure management. However, it has limitations such as workflow complexity, lack of direct mapping between projects and branches/tags, policy framework, no private registry, complex configuration process, and no drift detection. To install Atlantis on an EKS cluster, you need to follow several steps including setting up Git Host access credentials, creating a Service Account for the Amazon EBS CSI driver role, adding the Amazon EBS CSI add-on, preparing the Helm chart, installing the Helm Chart, configuring a repository to use Atlantis, and using Atlantis. Atlantis helps achieve key best practices when managing Terraform and Terragrunt projects such as secure server setup, version control and workspace management, improved collaboration, secure state management, change management, automating testing and validation, implementing RBAC, monitoring and enabling logging for Atlantis, native drift detection, scheduling tasks and Stack deletion, native module registry, and self-service infrastructure. Spacelift is an alternative to Atlantis and Terraform Cloud that offers more features and supports other tools apart from Terraform and Terragrunt. It provides a fully customizable workflow, native policies based on OPA, native drift detection, native module registry, and self-service infrastructure capabilities.
Company
Spacelift
Date published
Jan. 23, 2024
Author(s)
Flavius Dinu
Word count
2699
Language
English
Hacker News points
None found.