diff --git a/spacemk/exporters/terraform.py b/spacemk/exporters/terraform.py index e33add1..6b380b9 100644 --- a/spacemk/exporters/terraform.py +++ b/spacemk/exporters/terraform.py @@ -1258,14 +1258,21 @@ def find_workspace_variable_with_invalid_name(data: dict, workspace_id: str, typ ) provider = workspace.get("attributes.vcs-repo.service-provider") + + supported_providers = { + "github": "github_custom", + "github_app": "github_custom", + "github_enterprise": "github_custom", + "bitbucket_server": "bitbucket_datacenter", + "gitlab_hosted": "gitlab", + } + if provider is None: organization_name = workspace.get("relationships.organization.data.id") workspace_name = workspace.get("attributes.name") logging.warning(f"Workspace '{organization_name}/{workspace_name}' has no VCS configuration") - elif provider in ["github", "github_app", "github_enterprise"]: - provider = "github_custom" - elif provider == "bitbucket_server": - provider = "bitbucket_datacenter" + elif provider in supported_providers: + provider = supported_providers[provider] else: raise ValueError(f"Unknown VCS provider name ({provider})")