Many of you will already be using Infrastructure as Code (IaC) day to day but for some, choosing the right tool to ensure success is the real first stumbling block. So with so many options, how should you go about choosing the one that’s right?
In the Microsoft corner there’s; PowerShell, Azure Resource Manager (ARM), Bicep and in the 3rd party corner HashiCorp Terraform each offer benefits and drawbacks. The choice comes down to your team’s skills, the complexity of your environment, and your cloud strategy.
PowerShell is probably the best known of the 4 tools, originally releasing way back in 2006, its been used by everyone and their dog for everything from AD user account creation to documentation automation and SMTP transport. While not strictly an IaC tool, it’s a go-to for many professionals managing cloud and hybrid environments and using Az modules combined with simple list like CSVs can hold its own deploying resources at scale.
Code snippet – PowerShell script to create a VM
Pros:
Flexibility: PowerShell will interact with Azure, on-premises services and third party APIs.
Familiarity: Many IT teams already possess PowerShell skills.
Granular Control: Offers precise control over resource configurations.
Cons:
No Declarative Syntax: PowerShell scripts describe step-by-step processes rather than desired end states, making it harder to ensure consistency in deployments.
Complex Deployments: Managing large-scale infrastructure becomes challenging compared to other IaC tools.
Use Case:
Small-scale deployments or one-off configurations.
ARM templates are JSON-based, declarative files that define Azure resource configurations. It is Microsoft’s original native IaC solution and specifically designed to work with Azure.
Code snippet – ARM template to deploy a VM
Pros:
Azure Native: Integrated with Azure, ensuring compatibility and support for all the latest Azure services, ARM is what the GUI experience uses in the background.
Declarative Syntax: Ensures deployments are consistent and repeatable every time.
Comprehensive: Supports complex dependencies and advanced configurations.
Cons:
Verbose Syntax: JSON can become unwieldy and difficult to manage for large deployments.
Steep Learning Curve: Debugging and error handling can be time-consuming, love finding indent mistakes?
Limited Reusability: Modularisation is less straightforward compared to other tools.
Use Case:
Enterprises deeply invested in Azure.
Deployments requiring fine-grained configurations and advanced dependency handling.
Bicep is the latest IaC tool from Microsoft, It’s infinitely more user-friendly and human readable than ARM. Bicep is a domain specific language (DSL) for Azure that simplifies the authoring of ARM templates and brings it closer to 3rd party tools like Terraform and CloudFormation.
Code snippet – Bicep template to deploy a VM
Pros:
Simplified Syntax: Easier for real world people to read compared to ARM templates.
Azure Native: Translates directly to ARM templates when deployed, ensuring full compatibility with the latest Azure resources.
Reusable Modules: Works great when used in modules for repeatable structured deployments.
Integrated Tooling: Integrates with Azure CLI and Visual Studio Code.
Planning: Supports ‘What if’ deployments for planning deployments
Cons:
Azure Specific: Not suitable for managing resources outside Azure.
ARM Limitations: Inherits challenges like debugging from ARM templates.
Use Case:
Teams looking for a modern, Azure-native IaC tool.
Organizations already using ARM templates but seeking a more streamlined approach.
Terraform is a IaC tool that supports deploy and configuration of infrastructure across multiple providers, both on-premises and cloud including; Azure, AWS, GCP, VMWare and FortiGate. As HashiCorp work directly with partners and they now support over 4800 providers across more than 250 vendors all using the same language: HashiCorp Configuration Language (HCL).
Code snippet – Terraform to deploy a VM
Benefits:
Multi-Everything Support: Ideal for managing resources across different platforms; Public/Private cloud or on-premises.
Modularity: Excels with module support.
Active Community: Extensive documentation and plugin ecosystem. –Terraform Registry
State Management: Tracks infrastructure state, enabling incremental updates with full planning before deployment.
Challenges:
Learning Curve: HCL differs from ARM but teams using ARM should be able to adapt.
State File: Collaboration can be tricky without proper processes in place, consider splitting state files where possible.
Lagging Azure Features: May not support the latest Azure features as quickly as native tools as HashiCorp need the API from Azure to be exposed.
Use Case:
Multi-cloud or hybrid cloud environments.
Organisations prioritizing modularity and version control.
Teams with a strong DevOps focus.
What to consider when choosing?
When choosing the businesses approach to IaC for Azure, make sure to factor in the following:
Your Environment: If your infrastructure is purely Azure-based, Bicep or ARM templates may be good enough. For multi-cloud setups or setups that require configuration of more than just the base resource, Terraform is the better choice.
Team Skills: Make use of the skills your team already has, there’s no point trying to reinvent the wheel. If they’re familiar with PowerShell, it could be an easier starting point.
Complexity: For complex deployments, tools like Bicep and Terraform offer better management and module support than PowerShell or ARM templates.
Future: Think about scalability and what could happen in the future. Nothing’s truly future proof but Terraform’s modular approach and multi-cloud support make a good case for it.
Integration: How does the tool fit into your existing CI/CD pipelines or deployment process.
Final Thoughts
I personally prefer Terraform for its multi-cloud support and the transferable skill it offers. However, the right choice depends on the makeup of the team you have and your aspirations for the future.
PowerShell gives you the ease of use and quick start, ARM templates provide full Azure support, Bicep simplifies ARM and Terraform delivers the versatility of multi-everything. Start by understanding the business requirements, then you should easily be able to select the tool that best works for your cloud strategy and team.