From d40e2885b84799d77e4dc01a6c021272a5b9cb00 Mon Sep 17 00:00:00 2001 From: apollorion Date: Thu, 6 Jun 2024 17:07:18 -0400 Subject: [PATCH] feat: test for opentofu --- spacemk/commands/import_state_files_to_spacelift.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 """