Awesome TF functionality that only #OpenTofu supports: **Dynamic Backends** ⚡ With a couple of our clients, we see them utilize different backend state s3 buckets for each instance of their root modules e.g. they have a Dev, Stage, and Prod state bucket and use the `-backend-config=...` CLI arg to determine which state they're working on. This typically requires some script or wrapper for Terraform to do that type of dynamic "init with this backend bucket". But now... with OpenTofu v1.8+ and "Early Evaluation", that is a thing of the past! Check out the code in my screenshot below for what I'm referring to. With Terraform or prior to Tofu v1.8, you can't use variables in your backend config. But now that you can this means that you don't need to think about "did I init against the dev or the prod backend for this run?" -- You can instead just provide variable inputs in your tfvars files that define which backend you want to use. We got to recommend this to a new client recently and it was a BIG reduction to the overall complexity of their vanilla Tofu usage! Love to see new features from the OpenTofu team actually being used 🙌
Perhaps automating the deployment process using CI/CD would make the requirement to switch backend rather irrelevant? Just a thought...🤦♂️
Thanks. Would rather use CDKTF
This makes so much sense, and the ability to allow fine grain access to state files based on environment access is a huge win.
Exciting to see OpenTofu continuing to innovate with dynamic backends in version 1.8! I’m also looking forward to version 1.9, now in beta, which introduces for_each loops in providers—a game-changing feature that enables configurations to dynamically iterate over a set of regions. While the feature is somewhat limited in its current implementation, it’s great to see progress in this area. https://opentofu.org/blog/opentofu-1-9-0-beta1/
I’ve been wanting this feature since I started. Might have to give Open Tofu a shot!
HashiCorp is so lame it took 10+ years and outside developers to implement VARIABLES where it really counts.
Awesome stuff with the “dynamic “ backend
CEO/CTO @ Masterpoint | Get control of your Infrastructure as Code workflows
1dWant to learn more about early evaluation? Check out the "what's new" post for OpenTofu 1.8: https://opentofu.org/docs/intro/whats-new/#early-variablelocals-evaluation