--- title: "Atlantis" type: entity tags: - devops - iac - terraform - gitops - cicd created: 2026-04-26 --- # Atlantis ## Definition Atlantis 是一个开源的**Terraform CI/CD 工具**,通过与 GitHub/GitLab 深度集成,将 Terraform 的 plan 和 apply 操作转移到 Pull Request(PR)评论层面,实现基础设施即代码的协作式自动化部署。 ## Core Model: PR-Driven IaC Atlantis 的核心理念:**每个 Pull Request 都是一次 Terraform 操作**。 ``` Developer Atlantis AWS Accounts │ │ │ │ 1. Open PR │ │ │───────────────────────>│ │ │ │ 2. !atlantis plan │ │ │───────────────────────>│ │ │<───────────────────────│ 3. terraform plan │ 4. Post plan result │ │ │<───────────────────────│ │ │ 5. Review & Approve │ │ │───────────────────────>│ │ │ │ 6. !atlantis apply │ │ │───────────────────────>│ │ │<───────────────────────│ 7. terraform apply │ 8. Merge PR │ │ │───────────────────────>│ │ ``` **来源**: [[ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments]] ## Key Features | 特性 | 说明 | |------|------| | **PR 评论触发** | 无需独立 CI 账号,开发者在 PR 上评论即可 | | **并行 plan/apply** | 多模块并发执行,提升部署效率 | | **锁定机制** | 防止多 PR 同时操作同一模块产生冲突 | | **跨账户访问** | 通过 IAM 角色实现多 AWS 账户部署 | | **零额外基础设施** | 只需一台 EC2 共享账户实例 | **来源**: [[ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments]] ## Comparison: Atlantis vs Jenkins | 维度 | Atlantis | Jenkins | |------|----------|---------| | 触发方式 | PR 评论 | SCM 轮询/定时 | | 初始化速度 | 快速(按需) | 慢(Jenkins 预配置) | | 代码克隆 | 单次 | 多次 | | 测试执行 | 并行 | 顺序 | | 架构复杂度 | 简单 | 复杂(持续叠加功能) | | Terraform 专用 | ✅ 是 | ❌ 通用(需配置) | | PR 协作 | ✅ 原生 | ❌ 无 | **来源**: [[ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments]] ## Micro Focus Usage Micro Focus 在 Labs Landing Zone 中使用 Atlantis 替代 Jenkins 进行 Terraform IaC 部署: - 每个 Landing Zone 共享账户部署单台 EC2 实例 - GitHub Enterprise Webhook 接收 PR 事件 - 服务账号负责评论/合并/关闭 PR - Atlantis 在 merge 前即应用变更 **局限性**: Atlantis 当前不支持 EKS 部署,需通过 Jenkins + Terragrunt 模块替代。 **来源**: [[ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments]], [[ctp-topic-39-implementing-eks-in-the-aws-lab-landing-zone]] ## Related Entities - [[Terraform]] — Atlantis 操作的核心 IaC 工具 - [[Gruntwork]] — Terragrunt 的开发者(Atlantis 生态伙伴) ## Related Concepts - [[GitOps]] — Atlantis 是 GitOps 在 Terraform 领域的实现工具 - [[CI/CD Pipeline]] — Atlantis 提供 CI/CD 能力 ## Related Sources - [[ctp-topic-32-using-atlantis-cicd-for-infrastructure-deployments]] - [[ctp-topic-39-implementing-eks-in-the-aws-lab-landing-zone]]