Skip to content

Commit

Permalink
feat: better way to version check
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollorion committed Oct 25, 2024
1 parent 6446128 commit 6e17961
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spacemk/exporters/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ def _check_workspace_variables_data(self, data: list[dict]) -> list[dict]:
def _check_workspaces_data(self, data: list[dict]) -> list[dict]:
logging.info("Start checking workspaces data")

def check_for_bsl_terraform(version):
if version == "latest" or semver.match(version, ">=1.5.7"):
return True
return False

for key, item in enumerate(data):
warnings = []

Expand All @@ -193,7 +198,7 @@ def _check_workspaces_data(self, data: list[dict]) -> list[dict]:
if item.get("attributes.vcs-repo.service-provider") is None:
warnings.append("No VCS configuration")

if semver.match(item.get("attributes.terraform-version"), ">=1.5.7"):
if check_for_bsl_terraform(item.get("attributes.terraform-version")):
warnings.append("BSL Terraform version")

data[key]["warnings"] = ", ".join(warnings)
Expand Down

0 comments on commit 6e17961

Please sign in to comment.