def apply()

in solutions_builder/cli/infra.py [0:0]


def apply(stage: Annotated[Optional[str],
                           typer.Argument()] = None,
          solution_path: Optional[str] = ".",
          impersonate_email: Optional[str] = None,
          unlock: Optional[bool] = False,  # Whether to unlock existing stages.
          all_stages: Annotated[bool, typer.Option("--all")] = None,
          yes: Optional[bool] = False,
          debug: Optional[bool] = False):
  validate_solution_folder(solution_path)

  if all_stages:
    # Get all stage folders in './terraform/stages'
    terraform_stages = get_immediate_subdirectories(
        f"{solution_path}/terraform/stages")

  elif stage:
    terraform_stages = [stage.replace("terraform/stages", "")]

  else:
    print(f"Missing argument 'STAGE' or '--all'. Available stages:")
    path = solution_path + "/terraform/stages"
    print("Available terraform (infra) stages:\n")
    list_subfolders(path)
    return

  terraform_stage_str = "\n".join(
    [f"    - {stage}" for stage in terraform_stages])

  confirm(f"""