DEV Community

Rajesh Gunasekaran
Rajesh Gunasekaran

Posted on • Edited on

1

Step-by-Step Process of Atlantis Executing Terraform

Introduction

Atlantis is an essential tool for automating Terraform workflows. It provides a GitOps-style approach where Terraform plans and applies are triggered by pull requests (PRs). This step-by-step guide details how Atlantis processes Terraform changes when a developer submits a PR.

Atlantis automating Terraform workflows on Amazon EKS

Prerequisites

Before implementing Atlantis, ensure you have the following:

  • An Amazon EKS cluster with Atlantis deployed

  • A properly configured GitHub repository

  • AWS IAM roles and permissions set up for Terraform execution

  • Backend configuration for storing Terraform state (e.g., AWS S3 and DynamoDB)

Step 1: Developer Submits a PR with Terraform Changes

  • A developer modifies Terraform configuration files and pushes the changes to a feature branch.

  • A pull request (PR) is created against the main branch in the GitHub repository.

  • Atlantis automatically detects the PR and adds a comment indicating that a Terraform plan is in progress.

Step 2: Atlantis Runs terraform plan

  • Atlantis checks out the PR branch inside the EKS pod.

  • It executes terraform init to initialize the working directory.

  • It runs terraform plan to generate an execution plan.

  • Atlantis posts the output of terraform plan as a comment in the PR.

  • Developers review the plan and validate the proposed infrastructure changes.

Step 3: Reviewer Approves the Plan

  • If the plan looks good, an authorized reviewer (or the developer themselves) comments atlantis apply on the PR.

  • Atlantis detects the command and proceeds with applying the changes.

Step 4: Atlantis Runs terraform apply

  • Atlantis reinitializes the working directory and ensures the state is up-to-date.

  • It executes terraform apply to make the infrastructure changes.

  • Once completed, Atlantis updates the PR with the results of the apply command.

  • If successful, the infrastructure is updated, and Terraform state is stored in the configured backend.

Step 5: Merging the PR

  • After a successful apply, the PR is ready to be merged into the main branch.

  • The developer or reviewer merges the PR.

  • Atlantis automatically removes the workspace and cleans up temporary files related to the PR.

Step 6: Continuous Monitoring and Improvements

  • Regularly update Atlantis configurations and Terraform modules.

  • Implement policies and checks to ensure compliance.

  • Use Atlantis logging and monitoring to troubleshoot any issues.

Conclusion

By following this structured approach, teams can streamline their Terraform workflows, enhance collaboration, and maintain infrastructure as code best practices using Atlantis on Amazon EKS.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

👋 Kindness is contagious

Found this post helpful? A ❤️ or a friendly comment is always appreciated!

Okay