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 22f3752
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spacemk/exporters/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ 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":
return True
else:
if semver.match(version, ">=1.5.7"):
return True
return False

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

Expand All @@ -193,7 +201,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 22f3752

Please sign in to comment.