[ad_1]
Anybody who has adopted me on Social (or watched my Snack Minute appearances) is aware of that I’ve spent a whole lot of time speaking about Infrastructure as Code, particularly with regards to HashiCorp and Terraform. The flexibility to outline infrastructure by its meant end-state – whatever the order through which the sources used to create that state are outlined, and achieve this throughout private and non-private zones – is one thing superb to behold. That is very true as a result of these tasks will be contained inside a single folder, with only a few exterior dependencies. (Just one, actually – to have the Terraform binary put in on the system initiating the workflow.)
The problem for infrastructure builders
The contained nature and few dependencies make Terraform configuration one thing that lends itself naturally to being utilized in some type of steady integration/steady deployment (CI/CD) pipeline. Thus, using the identical instruments that software program builders do every day to drive infrastructure automation on the drop of a git push. The problem for infrastructure builders is that normal CI/CD processes must be tailored and examined in depth. The processes must cope with networks and materials requiring well-defined inventories and understanding of the present operating atmosphere. State isn’t one thing that’s typically thought of when compiling and constructing purposes as a result of the total supply of fact exists inside the undertaking or repository. This isn’t to trivialize the method of utility CI/CD, however merely to focus on that generally the instruments accessible aren’t at all times straightforward to construct or eat.
Utilizing the usual pull request (PR) workflow to drive automation
There may be a neater reply, nonetheless, and it leverages the usual pull request (PR) workflow that any infrastructure developer is accustomed to to drive automation (and archive the adjustments being made) inside any normal SCM accessible (together with on-prem and SaaS variations). Through the use of a bit of software program known as Atlantis, some webhooks, and Terraform HCL, we are able to carry out Terraform actions (plan, apply) simply by initiating a pull request from the characteristic department into fundamental with out having to arrange advanced CI/CD steps to outline every stage and motion to be carried out! In a matter of minutes you’ll be able to setup and check in your native workstation utilizing a GitHub account and ngrok.
When a pull request is imitated from the SCM, a webhook is fired to the Atlantis server, which can then pull down the dedicated HCL recordsdata within the characteristic department and carry out a terraform plan command. This output is then displayed inside the PR workflow as a remark, permitting all contributors within the repo to see the adjustments that shall be made out of the configuration. No extra native testing or configuration drift.

When every thing appears to be like good, you’ll be able to apply the adjustments by means of a easy PR remark…

… which can then carry out the configuration change on the tip goal utilizing Terraform and show the outcomes (the identical as can be seen when operating Terraform domestically) inside the PR.

Guarantee consistency of adjustments
Moreover, Atlantis ensures that a number of PRs can’t be opened concurrently inside the similar repository, guaranteeing that solely a single change is being processed at anyone time. This ensures consistency of adjustments and a linear archive of all operations archived inside the PR. As soon as the PR is closed and all adjustments have been made, the lock on the repository is cleared and additional adjustments will be made.
Reside demo of Atlantis in motion
For extra info, or a dwell demo of Atlantis in motion – be sure you try my Snack Minute episode (beneath) the place we dive deeper into the setup and operating of Atlantis. Once you’re able to strive it out your self, head over to https://www.runatlantis.io the place you’ll be able to discover a check drive or easy methods to allow Atlantis pull-request automation inside your personal repositories or group.
See Pull Request Automation in Motion with Cisco Software Centric Infrastructure.
For those who’re already utilizing Atlantis (or need assistance getting began), please depart me a remark beneath or tag me on Twitter together with your requests or use circumstances. I really like seeing folks constructing unimaginable issues with Terraform.
We’d love to listen to what you suppose. Ask a query or depart a remark beneath.
And keep linked with Cisco DevNet on social!
LinkedIn | Twitter @CiscoDevNet | Fb | Developer Video Channel
Share:
[ad_2]
