Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: better way to version check #82

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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