Juju vs Infrastructure as Code Tools
by Canonical on 4 January 2021
Summary
- Infrastructure as Code (IaC) tools, like Terraform, CloudFormation and Pulumi, ensure easily reproducible infrastructure setups.
- Juju focuses on the lifecycle and relations of applications.
- Juju and IaC tools mostly operate on different layers of abstraction.
- Use Juju to manage any application, from simple web application/database combinations to complex platforms like Kubeflow and OpenStack.
- Use IaC tools to provision service roles, network configurations or managed services.
There are several tools available for provisioning and managing infrastructure resources, such as low-level network configurations, service roles, or K8s clusters, using the Infrastructure as Code (IaC) approach. IaC is a DevOps practice that uses idempotent operations to ensure easily reproducible infrastructure. Among the most popular IaC tools are Hashicorp Terraform, AWS CloudFormation and Pulumi (by the startup that shares the same name).
Terraform is an open-source IaC tool that uses declarative configuration files, written in a Domain Specific Language (DSL) called Hashicorp Configuration Language (HCL). Terraform can provision resources across multiple public and private clouds; it uses a state file to keep track of the resources it manages and a dependency graph to determine the order of modifications. Terraform has a strong community that contributes to its public registry with Modules and Providers. Modules are reusable Terraform configurations. Providers extend Terraform’s support for managing infrastructure providers.
Pulumi is also open source and supports provisioning infrastructure across multiple cloud providers. It is similar to Terraform in many respects, the key difference being that Pulumi uses general-purpose programming languages to describe the infrastructure. This allows developers to use the languages and tools they are already familiar with in the DevOps process, including unit and functional testing tools which is often difficult with Terraform-managed infrastructure without the use of additional third-party utilities
CloudFormation is AWS’s template-driven IaC tool. While originally proprietary and limited to AWS resources, at the end of 2019 AWS released an open-source CloudFormation CLI, allowing users to manage third-party and private resources. Similar template-driven tools are offered by other public cloud providers, such as Google Cloud Deployment Manager and Azure Resource Manager.
Juju, on the other hand, is an open-source tool for model-driven application management. The powerful combination of Juju’s Charmed Operator Lifecycle Manager (OLM) with Charmed Operators, packaged as “Charms”, enables the management of an application’s complete lifecycle, including deployment, configuration and upgrades across multiple clouds and substrates. Juju provisions machines and containers as needed for the applications placed on the model. Charms can be written using any general-purpose language, the preferred method using the Charmed Operator Framework with Python.
While there is some overlap between the capabilities of Juju and IaC tools, they mostly operate on different layers of abstraction.
It is possible to deploy applications with IaC tools by using either raw Kubernetes YAML or Helm Charts, but it is very difficult to express advanced deployment scenarios with them. Whereas Juju can handle all sorts of scenarios, from simple web application/database combinations to complex platforms like Kubeflow and OpenStack.
Finally, IaC tools compliment Juju’s capabilities when there is a need for fine-grained service roles, network configurations, secret rotations or configuration of managed services.