Closed adamf83 closed 10 months ago
I've seen this same issue, and what I've found is there are errors because terraspace tries to run the terraform command instead of opentofu:
sh: 1: terraform: not found Error running: cd /home/ubuntu/infra/.terraspace-cache/us-east-1/dev/stacks/network && terraform state pull > /tmp/terraspace/remote_state/stacks/network/state.json Please fix the error before continuing
a temporary workaround of symlinking terraform to opentofu resolves these issues for me
@earlrob Thanks. That's useful.
terrraform should look up the tofu binary and use that automatically. https://github.com/boltops-tools/terraspace/blob/20f733b26f08f6dd959ece62765e1d864cea51c2/lib/terraspace/check.rb#L82
It sounds like a bug. Maybe missed a spot π€ Will take a look when got time. Will also consider PRs. Thanks!
Checklist
My Environment
Expected Behaviour
When switching between Terraform and OpenTOFU on a stack that I'd already worked on and made changes, I expected to be able to switch without issue.
Current Behavior
When running terraspace up stack I am getting the following error:
Error: Inconsistent dependency lock file β β The following dependency selections recorded in the lock file are β inconsistent with the current configuration: β - provider registry.opentofu.org/hashicorp/aws: required by this configuration but no version is selected β β To update the locked dependency selections to match a changed β configuration, run: β tofu init -upgrade
Step-by-step reproduction instructions
1: Using Terraform with Terraspace, run: terraspace plan stack 2: Using Terraform with Terraspace, run: terraspace up stack 3: Switch to using OpenTOFU 4: Using OpenTOFU with Terraspace, make some changes and run terraspace up stack as per step 2
This is where the error occurs.
I've tried running terraspace init stack which appears to complete successfully but it doesn't change the behaviour if I re-run terraspace up stack
There does appear to be an open issue on the OpenTOFU github issue tracker (https://github.com/opentofu/opentofu/issues/716) and the suggestion on the error message is to run tofu init -upgrade but how (and where) you run that when using terraspace I'm not sure.
This may well be an issue with OpenTOFU but some guidance on how to fix it when using terraspace would be helpful.
Code Sample
Solution Suggestion