def check_project_exist()

in solutions_builder/copier_extensions/sb_helpers.py [0:0]


def check_project_exist(project_id):
  """
    Check if a GCP project exists.
    """
  print_indent(f"(Retrieving project info for {project_id}...)")
  command = f"gcloud projects describe {project_id} --format='value(projectId)'"
  try:
    project_id = exec_gcloud_output(command).strip()
    if not project_id:
      return False
    return True

  except subprocess.CalledProcessError:
    print_indent(
      f"Unable to retrieve '{project_id}'. GCP project may not exist yet.\n")
    return False