Slide 1

Slide 1 text

GitOps: Introduction to Atlantis

Slide 2

Slide 2 text

Bruno Russi Lautenschlager ● SRE @ iFood ● AWS Community Builder ● Pai de pet linktr.ee/bruno_russi

Slide 3

Slide 3 text

What is Infrastructure as Code ● Define your infrastructure as code instead of creating it manually ● Infrastructure can be easily reproduced

Slide 4

Slide 4 text

Types of IaC Not only infrastructure ● Network as Code ● Policy as Code ● Configuration as Code ● Security as Code

Slide 5

Slide 5 text

How usually people use IaC Not on a git repository ● Create and test locally infra files ● Execute from local machine

Slide 6

Slide 6 text

How usually people use IaC I have a repository but commit and push all on main/master No Review/Approval process ● No pull requests ● No code review ● No collaboration ● No automated tests

Slide 7

Slide 7 text

How usually people use IaC Apply the infrastructure locally ● Tooling version variations from one machine to another ● Many people have access to the infrastructure ● Difficulty tracking changes ○ Hard to know who performed it and when ○ No visibility of what is being applied and what has been applied

Slide 8

Slide 8 text

How usually people use IaC No defined environment ● No development/test environment for infra ● You will find the problems only after applying

Slide 9

Slide 9 text

Infra as code is very good and has many benefits, but often the process is 💩

Slide 10

Slide 10 text

Gitops: requirements Git repository - Version controlled - Team collaboration CI/CD - Lint Process - Test Process

Slide 11

Slide 11 text

GitOps: workflow 1. Make infrastructure changes 2. Create pull request (Visibility, RFC) 3. CI Pipeline (Lint, tests) 4. Approve by team (Review from team) 5. Applies infra files on infrastructure (Atlantis)

Slide 12

Slide 12 text

Atlantis

Slide 13

Slide 13 text

What is Atlantis? Atlantis is open-source https://github.com/runatlantis/atlantis https://www.runatlantis.io/

Slide 14

Slide 14 text

How Atlantis works? ● Atlantis is self-hosted. Your credentials don't leave your infrastructure ● Runs as a Golang binary or Docker image ● Can be deployed on VMs, Kubernetes, Fargate, etc ● Listens for webhooks from GitHub/GitLab/Bitbucket/Azure DevOps ● Runs terraform commands remotely and comments back with their output

Slide 15

Slide 15 text

How to configure? - Git Host - Create git access credentials - Deploy Atlantis - Configure webhooks - Configure provider credentials

Slide 16

Slide 16 text

How to configure Atlantis server? All the Altantis flags can be configured using: - Environment variables - Config yaml file - Flags on execution command

Slide 17

Slide 17 text

How to customize Atlantis workflows? ● Customize on server side with repos.yaml config file

Slide 18

Slide 18 text

How to customize Atlantis workflows? ● Customize on terraform repo with atlantis.yaml config file

Slide 19

Slide 19 text

Atlantis workflow: apply requirements Atlantis allows you to require certain conditions be satisfied before an Atlantis apply command can be run: ● Approved ● Mergeable

Slide 20

Slide 20 text

How to deploy?

Slide 21

Slide 21 text

How to deploy?

Slide 22

Slide 22 text

How Atlantis works? ● Atlantis plan example

Slide 23

Slide 23 text

Demo ⚡

Slide 24

Slide 24 text

Benefits - Automated process - No tolling version variation - No human failures - More transparent - Team collaboration - More quality in code - Any person can send a PR and propose a change - Greater security - Only the pipeline has access to infra - Centralized - Git is the source of truth (everything that passes is applied) - Just revert a commit and open an MR for rollback - Infra reflect what's in git

Slide 25

Slide 25 text

󰢨 Questions? 󰢡

Slide 26

Slide 26 text

Thank's

Slide 27

Slide 27 text

Reference ● https://www.runatlantis.io ● https://hub.docker.com/r/runatlantis/atlantis ● https://github.com/terraform-aws-modules/terraform-aws-atlantis ● https://github.com/msfidelis/atlantis-aws ● https://youtu.be/f5EpcWp0THw

Slide 28

Slide 28 text

No content