Skip to content

Conversation

@MohcineTor
Copy link
Collaborator

Hi,
new feat deploy web app with babylon using terraform module.

  • new macro command deploy_webapp
  • new macro command destroy_webapp

@MohcineTor MohcineTor requested a review from sellisd February 4, 2026 16:30
)


def dict_to_tfvars(payload: dict) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This function help to bridges the yaml-hcl format difference. It would be nice if the end user doesn't need to know the details of hcl or terraform as long as they know how to write or modify a yaml file this function would translate the necessary to hcl. In practice this is slightly more complicated, because this function probably works for the yaml files we have, however it is not robust or generic to convert any yaml to hcl correctly and this is not visible to the end user. So they might end up having difficult to find bugs because of an issue in the conversion.

I would suggest to break this in smaller steps. First expose the terraform to the end user to avoid hard bugs, when the codebase is more mature we can then hide it and make things modular.

tf_dir = Path(str(env.working_dir)).parent / "terraform-webapp"
tfvars_path = tf_dir / "terraform.tfvars"

if "win" in current_os:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

win could be cygwin and I don't think we want this. From the docs https://docs.python.org/3/library/sys.html#sys.platform the comparisson should probably be something like:

if current_os == 'win32':
  [...]
elif current_os == 'linux':
  [...]
else: 
  raise error

return None
project_yaml_files = ["Organization.yaml", "Solution.yaml", "Workspace.yaml", "Dataset.yaml", "Runner.yaml"]
tf_webapp_path = Path(getcwd()) / "terraform-webapp"
repo_url = "https://github.com/Cosmo-Tech/terraform-webapp.git"
Copy link
Contributor

@sellisd sellisd Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are introducing some hidden dependencies here. Now Babylon depends on terraform-webapp which depends on terraform etc and this is not visible in the Babylon metadata (in pyprojects.toml). This will make tools that automatically scan dependencies (e.g. dependency track) to have a blind spot, and also users installing Babylon will not know they need to configure this dependency.
I suggest we first decide if this is an optional or required dependency: it would be optional if we have a use case where Babylon user would not need this dependency.
Then we should update the readme.md to include this and possibly also add a check to make sure the tools are available.
Finally we would need to somehow add the external dependency in pyproject.toml. There is a pending PEP to include external dependencies, but since it has not yet been accepted we need to find a way to do it that is compatible with the build toolchain (PEP 725 & 804).

logger.error(f" [bold red]✘[/bold red] Terraform directory not found at {tf_dir}")
return
try:
process = subprocess.Popen(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not the simpler subprocess.run ? do we need an advanced behavior here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are way too many levels of if/else here, sonarqube will flag this as too complex

logger.error(f" [bold red]✘[/bold red] Terraform directory not found at {tf_dir}")
return
try:
process = subprocess.Popen(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are way too many levels of if/else here, sonarqube will flag this as too complex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants