Atlantis and GitOps: A Game-Changer in Infrastructure as Code Deployment

Explore how Atlantis and GitOps together transform Infrastructure as Code deployment. Learn the benefits and best practices for streamlined workflows.

Subscribe

Subscribe

Infrastructure management has significantly changed during the last few years. I can still remember my first few years working in IT, where I would often spend the entire day having to write Bash, write Powershell scripts, and maintain servers.

Today, everything is entirely different. Thanks to the use of the Cloud (both public and private) and to a new generation of tooling used to manage Infrastructure as Code (IaC), we are now closer to developers (with System Management know-how). We write code, build tests, automate projects, and spend time creating processes to guarantee our changes are not going to break anything.

IaC has offered us a solution for many problems, but it doesn’t come without its own set of issues. Teamwork can be challenging, and our code must be integrated and applied with the order, control, and security we want.

Atlantis is an Open Source tool that can help combat this problem, especially when using one of its methodologies, GitOps. In this article, we will provide a basic walkthrough of Atlantis and GitOps, which will ultimately help you to maximize productivity and enhance the overall quality of your code.

Interested in learning more? Fill out the form below and let’s chat!

[Insert the form from the original page here] Link to original post


What is GitOps?

Atlantis is an Open Source tooling to allows us to manage our Infrastructure thanks to Terraform and a methodology called GitOps.

GitOps is a series of practices that allows us to manage our infrastructure and its configuration using Git. Thus, our code repositories become our unique source of truth, containing its desired state.

GitOps uses the exact mechanisms used to manage applications' code to infrastructure. Thus, we would modify our infrastructure depending on the changes and actions from our repository. For instance, we could open a Pull Request (PR) and add extra information, like a cost estimation of the change or which modifications will occur.

Using GitOps offers some great advantages:

  • It gives us a lot of traceability on changes. Git allows us to keep track of changes done in the infrastructure and who created them or when they are completed

  • It allows us to conduct peer reviews, which helps in detecting errors between team members before they are applied

  • It provides a common framework between app developers and infra developers, which can reduce the friction between Dev and Ops

But there are also some minor caveats:

  • Peer reviewing can upgrade some quality standards, but it's not a silver bullet, and developers may disregard infrastructure testing

  • Learning programming skills is not widespread, and it can increase the difficulty of adding new people to the team


Atlantis

Atlantis is a lightweight application written in Go with a web interface that allows us to use GitOps over our Terraform code. It's not a SaaS solution; therefore, we need to deploy it in a server or a container orchestrator. Essentially, Atlantis executes remotely terraform plan and terraform apply and returns the result of the commands through comments in the linked repository.

Atlantis and GitOps A Game-Changer in Infrastructure as Code Deployment 2

In a simplified way, this is one of the workflows we can do with Atlantis:

  1. One developer makes some changes in the code, and he opens a PR / Merge Request in one branch

  2. Atlantis receives one notification about the new branch, and uses that code to execute the terraform plan

  3. The PR gets the output of the Terraform plan generated by Atlantis as a comment

  4. If the developer decides the PR is ready to be merged, he can comment atlantis apply in the PR to order Atlantis to apply the changes immediately. Depending on what we define, this step can be completely automatic

Thanks to the functionalities of Atlantis and the methodology it uses underneath, we can implement improvements to be more simple and continuous, while also increasing productivity and overall quality.

This first post is only introductory and will start a series where we will explain how to install and configure Atlantis as well as other extra functionalities.

If you want more information about this topic, please contact our team at sales@stratusgrid.com

stratusphere by stratusgrid 1

Versión en español:

Gestionar infraestructura es una de las cosas que más ha cambiado en los últimos años. Aún recuerdo mis primeros años en el sector, pasando mi jornada laboral creando scripts en Bash o Powershell y manteniendo o actualizando servidores casi constantemente.

Hoy en día todo ha cambiado mucho. Gracias al uso de las nubes, públicas y privadas, y a la proliferación de herramientas para gestionar infraestructura como código (IaC), ahora somos más parecidos a desarrolladores (con conocimientos de sistemas) y nos dedicamos a escribir código, realizar tests, diversas automatizaciones y a crear procesos para garantizar que nuestros cambios no vayan a romper nada.

La IaC nos ha permitido dar solución a muchos problemas, pero también ha generado otros. Trabajar en equipo puede ser desafiante y nuestro código debe ser integrado y aplicado con orden, control y seguridad.

Hoy vamos a presentar una herramienta que puede ayudarnos a lograr este propósito.

¿En qué consiste GitOps?

Atlantis es fundamentalmente, una herramienta Open Source que permite gestionar nuestra infraestructura gracias a Terraform y una metodología de trabajo llamada GitOps .

Llamamos GitOps a una serie de prácticas que nos permiten gestionar nuestra infraestructura y su configuración utilizando Git. De esta forma, nuestros repositorios de código se convierten en la única fuente de verdad, y contienen el estado deseado de la infraestructura.

GitOps traslada los mecanismos utilizados para gestionar el código de las aplicaciones a la infraestructura. De esta forma, podemos modificar nuestra infraestructura en función de los cambios y acciones realizados en nuestro repositorio. Por ejemplo, podríamos abrir un Pull Request y que una herramienta nos estime qué recursos van a ser añadidos, qué modificaciones va a sufrir nuestra infraestructura y el coste que va a tener en nuestra factura.

Usar GitOps tiene algunos puntos fuertes:

  • Proporciona una gran trazabilidad en los cambios. Los flujos de trabajo definidos permiten ver qué cambios se han ido haciendo sobre la infraestructura y quién los ha realizado o autorizado.

  • Permite la revisión del código de la infraestructura a través de pares, ayudando a detectar errores entre miembros del equipo antes de que éstos sean aplicados.

  • Proporciona un marco / lenguaje común entre desarrolladores de aplicaciones y desarrolladores de infraestructura que puede ayudar a reducir la fricción entre Dev y Ops.

     

Sin embargo, también aporta algunos pequeños inconvenientes:

  • La revisión entre pares puede mejorar ciertos estándares de calidad, pero es la panacea, y puede hacer que los desarrolladores descuiden el testing de su infraestructura.

  • Exige aprender ciertas prácticas de programación que no todo el mundo tiene y que puede conllevar una mayor dificultad a la hora de introducir nuevos miembros en el equipo.

Atlantis

Atlantis es una aplicación ligera, desarrollada en Go y con una interfaz web que nos permite realizar GitOps sobre nuestro código de Terraform. Para utilizarlo, tenemos que desplegarlo nosotros en un servidor o en algún orquestador de contenedores, puesto que, no ofrece ninguna solución en SaaS.

Resumiéndolo mucho, Atlantis ejecuta Terraform Plan y Terraform Apply de forma remota y nos devuelve el resultado a través de un comentario en el repositorio al que lo enlacemos.

Este sería, de forma simplificada, uno de los workflows que podemos realizar con Atlantis:

Atlantis and GitOps A Game-Changer in Infrastructure as Code Deployment 3

 

  1. Un desarrollador realiza una serie de cambios en su código y abre un Pull Request / Merge Request sobre una rama.

  2. Atlantis recibe la notificación de que una nueva rama ha sido abierta y utiliza ese código para ejecutar terraform plan.

  3. El MR recibe la salida del plan generado por Atlantis y lo adjunta como comentario en el mismo.

  4. Si el desarrollador decide que el MR está listo para ser mergeado, puede comentar "atlantis apply" para que Atlantis aplique los cambios. Dependiendo de lo que definamos en Atlantis, este paso puede ser totalmente automático.

Gracias a las funcionalidades de Atlantis y a la metodología que utiliza, podemos implementar, de forma sencilla y progresiva, mejoras para aumentar la productividad y la calidad del trabajo de los equipos que trabajan con Terraform.

Este primer post es sólo introductorio, pero inicia una serie, donde veremos cómo instalar y configurar Atlantis de forma sencilla, así como otras funcionalidades que aporta y que podemos implementar.

Si desea más información sobre este tema, póngase en contacto con nuestro equipo en sales@stratusgrid.com.

BONUS: Download Your FinOps Guide to Effective Cloud Cost Optimization Here ⤵️

FinOps-Guide-Downloadable (2)

Similar posts