diff --git a/spacemk/commands/import_state_files_to_spacelift.py b/spacemk/commands/import_state_files_to_spacelift.py index 0b85d40..2dc7568 100644 --- a/spacemk/commands/import_state_files_to_spacelift.py +++ b/spacemk/commands/import_state_files_to_spacelift.py @@ -45,18 +45,17 @@ def _create_context(spacelift: Spacelift, space_id: str, token: str): --silent \ "${STATE_DOWNLOAD_URL}" -set +e binary="terraform" -if ! command $binary; then - echo "Terraform is not installed" +if ! command -v $binary &> /dev/null; then + echo "Terraform not found, using OpenTofu" binary="tofu" - if ! command $binary; then - echo "OpenTofu is not installed" + if ! command -v $binary &> /dev/null; then + echo "OpenTofu not found, Failing run..." exit 1 fi fi -set -euo pipefail +echo "Using Binary: $binary" $binary state push -force state.tfstate """