Migrating from Proprietary to Open-Source IaC Tools
Migrating from Proprietary to Open-Source IaC Tools:
What You Need to Know In the ever-evolving world of Infrastructure as Code (IaC) and security, new open-source alternatives to popular proprietary tools have emerged. This blog post will explore OpenTofu and OpenBao, open-source replacements for Terraform and Vault respectively, and discuss the broader market trends in open-source software.
OpenTofu:
The Open-Source Alternative to Terraform What is OpenTofu? OpenTofu is an open-source fork of Terraform, initiated by the Linux Foundation in response to HashiCorp's decision to change Terraform's license from open-source (Mozilla Public License v2.0) to the more restrictive Business Source License (BSL) in August 2023. OpenTofu aims to maintain the core functionality of Terraform while ensuring it remains truly open-source and community-driven.
Key points about OpenTofu:
It's a drop-in replacement for Terraform Maintains compatibility with existing Terraform configurations and providers Supported by major cloud providers and tech companies Governed by the Linux Foundation Why Consider Migrating? Open-source commitment: OpenTofu ensures long-term availability under an open-source license. Community-driven development: Benefit from rapid improvements and fixes from a global developer community. Potential for new features: OpenTofu may develop unique capabilities over time. License concerns: If your organization has concerns about Terraform's new BSL, OpenTofu provides an alternative. What Has Changed? As of now, the changes between Terraform and OpenTofu are minimal, which is good news for those considering migration. Here are the key differences:
Binary name: The terraform command becomes tofu. State file: The default state file is named terraform.tfstate, but OpenTofu can read this without issues.
Configuration files: .tf and .tfvars files remain unchanged.
Provider plugins: OpenTofu uses the same provider plugins as Terraform.
Backend configuration: Remains the same, including support for remote state storage.
Migration Steps
Install OpenTofu: You can download it from the official OpenTofu GitHub repository. Many package managers now offer OpenTofu as an option.
Rename your Terraform binary (optional): If you want to keep both Terraform and OpenTofu, you can rename the OpenTofu binary to tofu.
Update your CI/CD pipelines: Replace terraform commands with tofu in your scripts and pipelines.
Test your existing configurations: Run tofu init and tofu plan to ensure everything works as expected.
Gradually migrate your projects: Start with non-critical environments to build confidence.
Update documentation and team practices: Ensure your team is aware of the change and update any internal documentation. Potential Challenges While the migration process is generally straightforward, be aware of these potential challenges:
Team familiarity: Your team will need to adapt to the new tofu command.
Third-party tools: Some tools that integrate with Terraform might not immediately support OpenTofu.
Enterprise features: If you're using HashiCorp's enterprise features, verify that OpenTofu meets your needs.
Install OpenTofu
Step 1: Install OpenTofu
For Linux (using package manager)
For macOS (using Homebrew)
Step 2: Verify Installation
Step 3: Update CI/CD Scripts
Example: Update a bash script
Step 4: Update Terragrunt Configuration
Edit terragrunt.hcl file
Step 5: Update Version Constraints (if necessary)
Edit
versions.tf
or
main.tf
Step 6: Initialize OpenTofu
Step 7: Run a plan to check for any issues
Step 8: Apply changes
Step 9: Update any custom scripts or aliases
Example: Update a bash alias
Step 10: For Terragrunt users, update any Terragrunt-specific scripts
Step 11: Test Terragrunt with OpenTofu
Step 12: Update documentation
Optional: If keeping both Terraform and OpenTofu
Create a script to switch between them
OpenBao:
The Open-Source Alternative to HashiCorp Vault In addition to OpenTofu, another important development in the open-source infrastructure space is OpenBao, which serves as a drop-in replacement for HashiCorp Vault.
What is OpenBao?
OpenBao is an open-source fork of HashiCorp Vault, created in response to Vault's license change from MPL 2.0 to BSL. Like OpenTofu, OpenBao aims to maintain compatibility with existing Vault configurations while ensuring continued open-source development.
Key points about OpenBao:
Designed as a drop-in replacement for HashiCorp Vault Maintains API compatibility with Vault Focuses on security and secret management Community-driven development under an open-source license Migrating from Vault to OpenBao The migration process from Vault to OpenBao is similar to the Terraform to OpenTofu migration:
Install OpenBao from the official repository Replace vault commands with bao in your scripts and configurations Test existing setups thoroughly, especially in non-critical environments first Update documentation and train your team on the new tool Market Trends: The Shift Between Open-Source and Proprietary Models The emergence of tools like OpenTofu and OpenBao reflects a broader trend in the software industry, where companies are navigating between open-source and proprietary models.
Companies Moving to Business Editions
Several companies have shifted from fully open-source models to more restrictive licenses or business editions:
Redis: Redis Labs changed the license for some modules to the Redis Source Available License (RSAL) to prevent cloud providers from offering Redis as a service without contributing back to the community. While the core Redis software remains open source, the business edition includes advanced features and commercial support.
CockroachDB: Cockroach Labs offers both an open-source version and an enterprise edition of CockroachDB. The enterprise edition includes additional features such as advanced security, support, and management tools, catering to large-scale deployments.
Elastic: Elastic’s decision to move Elasticsearch from the Apache 2.0 license to the Elastic License sparked a significant response from the community. While Elastic continues to develop its commercial offerings, OpenSearch has emerged as a community-driven alternative to Elasticsearch.
Note: Elastic recently claimed that Elasticsearch is "open source again," but it’s not reverting to the original Apache2 license. Instead, they’re adding the AGPL license, which requires sharing code changes but still combines it with proprietary licenses. This means Elasticsearch is trying to appear more open-source while keeping some control over how the software is used and modified.
Conclusion
As organizations consider migrating from proprietary tools to open-source alternatives like OpenTofu and OpenBao, they must weigh the benefits of open-source development against the potential challenges. Open-source tools offer greater flexibility, transparency, and community-driven improvements, but migrating requires careful planning and adaptation.
The broader trend of shifting between open-source and proprietary models highlights the dynamic nature of the software industry. Companies are increasingly looking for ways to protect their innovations while also engaging with the open-source community. This evolving landscape underscores the importance of staying informed about licensing changes, feature sets, and community support to make well-informed decisions about technology adoption.
By understanding these trends and carefully planning migrations, organizations can leverage the benefits of open-source tools while maintaining operational efficiency and security.