Skip to content

Commit

Permalink
feat: check for opentofu during import
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollorion committed Jun 6, 2024
1 parent c4a3eaa commit 98f4a28
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion spacemk/commands/import_state_files_to_spacelift.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,20 @@ def _create_context(spacelift: Spacelift, space_id: str, token: str):
--show-error \
--silent \
"${STATE_DOWNLOAD_URL}"
terraform state push -force state.tfstate
set +e
binary="terraform"
if ! command $binary; then
echo "Terraform is not installed"
binary="tofu"
if ! command $binary; then
echo "OpenTofu is not installed"
exit 1
fi
fi
set -euo pipefail
$binary state push -force state.tfstate
"""

variables = {
Expand Down

0 comments on commit 98f4a28

Please sign in to comment.