The collection automates the management and provisioning of infrastructure as code (IaC) using the Terraform CLI tool within Ansible playbooks and Execution Environment runtimes.
GNU General Public License v3.0
100
stars
36
forks
source link
Support falling back to `tofu` binary if `terraform` is not found but `tofu` is (And maybe allow the fallback to be an environment variable) #159
As OpenTofu and Terraform both should work for this collection, I think it would be a good idea to fall back to tofu if it is found and terraform is not
ISSUE TYPE
Feature Idea
COMPONENT NAME
The inventory provider, all modules and the lookup provider
ADDITIONAL INFORMATION
OpenTofu is getting more popular, and it's compatible with Terraform. People should be able to use OpenTofu instead of Terraform without needing to hardcode the binary path in the inventory file/tasks.
Alternatively, or both, an environment variable could be used to get the Terraform/Tofu binary path. This would not break any deployments, as the hardcoded path in the task/inventory would still take precedent.
My proposed search order is as follows:
The binary path set in the inventory file/task
An environment variable (TF_BINARY_PATH maybe? Open to suggestions)
Searching for terraform in path
Searching for tofu in path
This would not break any existing deployments, as the set variable and Terraform still take precedent over Tofu, and the environment variable wouldn't be set.
If this sounds like something that would be accepted, I can make a PR for it
SUMMARY
As OpenTofu and Terraform both should work for this collection, I think it would be a good idea to fall back to
tofu
if it is found andterraform
is notISSUE TYPE
COMPONENT NAME
The inventory provider, all modules and the lookup provider
ADDITIONAL INFORMATION
OpenTofu is getting more popular, and it's compatible with Terraform. People should be able to use OpenTofu instead of Terraform without needing to hardcode the binary path in the inventory file/tasks.
Alternatively, or both, an environment variable could be used to get the Terraform/Tofu binary path. This would not break any deployments, as the hardcoded path in the task/inventory would still take precedent.
My proposed search order is as follows:
TF_BINARY_PATH
maybe? Open to suggestions)terraform
in pathtofu
in path This would not break any existing deployments, as the set variable and Terraform still take precedent over Tofu, and the environment variable wouldn't be set.If this sounds like something that would be accepted, I can make a PR for it