Atlassian for Infrastructure as a Code (IaC)? Is it true!? IaC has been in the industry for quite some time already and has been proven in the most demanding environments.
For companies like Amazon, Netflix, Google, Facebook it is not only mission-critical but it is the business. Let’s briefly talk about what IaC actually is – IaC is an approach to infrastructure automation based on practices from software development. It emphasizes consistent, repeatable routines for provisioning and changing systems and their configuration. Changes are made to definitions and then rolled out to systems through unattended processes that include thorough validation.
The most important goals of IaC are:
- Support and enable efficient & stress-free change.
- Define, provision, and manage the resources needed.
- Quick and easy recovery from failures.
All this explains why and how paramount it is to have it in today’s rapidly changing IT infrastructure world.
That’s enough of IaC explanation, let’s talk about how TMC ALM helped her customers by introducing Atlassian Tools – like Bitbucket and Bamboo – to bring more efficiency to the whole process. If we look at the IaC definition once again we will notice that one of the most important thing in the entire IaC process is your infrastructure code/definition itself. This is what is going to be the base of the infrastructure and thus the versioning & maintenance of this code/definition is vital. Versioning of your infrastructure code is a fundamental part of the entire process.
Source: Microsoft: what-is-infrastructure-as-code
Who Needs Versioning, anyway?
Consider a scenario where you have multiple servers to maintain and provision the pool of resources. And the need to manage this is growing rapidly. This could lead your team struggling to maintain the consistency between servers and resources. Since there is no version controlling of your server configurations and definitions, you will hit a point where there are differences in versions and configurations across servers. This means that software that worked on some machines doesn’t work on others. Which leads to inconsistency across the servers, and this is called configuration drift.
This could mean a serious impact on the business. This is why versioning is absolutely vital in the process.
Versioning also helps you achieve the principles like:
- Easy reproduction of the systems
- Disposable systems
Versioning is the source of truth for the desired state of infrastructure. This is where the power of Atlassian Bitbucket – and optionally Bamboo – in combination with TMC ALM technical and product expertise comes to help.
That’s because of its features which makes it stand apart in comparison to the others. Bitbucket brings features like:
- “Free, Unlimited, Private Repositories” – Which could be a deal breaker when you have a lot of repositories to maintain – Cost Saving!
- “Integration Power” – Out of the Box Integration with Industry’s most renowned tool Jira, Trello to keep stakeholders in the loop and bringing more visibility to the whole process. Integration with Slack for effective communication.
- And a lot of other benefits like:
- “Enhanced Security” – Utilize IP whitelisting, enforce merge checks, enforce Two-factor authentication (2FA), or use Universal 2nd Factor (U2F) to secure your code with a second confirmation in addition to your password. Bitbucket’s SOC 2 Type II certification ensures your code is secure and that you’ll always have access.
- “Support for Distributed Teams” – With Bitbucket Data Center you get the smart mirroring which saves a lot of time cloning and pulling changes for your Geographically dispersed teams.
- “Flexible pull request workflows” – Tailor your pull request workflow to fit your team’s needs. Choose between 5 different merge strategies, create custom merge checks, and configure default reviewers.
Implementation using Bitbucket
Now that we have talked about the importance and benefits of the version control for your IaC lets talk about how we could proceed with the implementation and what are the best practices to follow:
- Select your Server Provisioning Automation tool (Ansible, Chef, Terraform, etc)
- Create a project/repository in Bitbucket to version your infrastructure.
- Decide the VCS strategy which suits your workflow. Take a look at this workflow strategy page to take a decision. Choosing the right workflow is extremely important to align your team, achieve consistency and efficiency.
- Select everything which needs to be versioned, put everything in VCS that is needed to build and rebuild elements of your infrastructure:
- Configuration definitions (cookbooks, manifests, playbooks, etc.)
- Configuration files and templates
- Test Code
- CI and CD Job Definitions
- Utility Scripts
- Source Code for compiled utilities and applications.
- Proceed with the CI and CD Pipeline.
We have reached to the point where we have constructed the fundamental part of the whole IaC process by versioning our infrastructure.
Now, what next?
Next is to follow the CI/CD Pipeline to automate the provisioning of the infrastructure.
For this we can use Bamboo to help us implement it.
Want to know how? Get an insight on the process in detail on how TMC ALM helped its customers. Implementing the IaC following the best practices with Bitbucket and other Atlassian tools.