# Buggy code
def get_zones_in_project(project_id, compute, max_results=None):
    """
    Return the zones where the Compute Engine API is enabled for the given project_id.
    See https://cloud.google.com/compute/docs/reference/rest/v1/zones and
    https://cloud.google.com/compute/docs/reference/rest/v1/zones/list.
    If the API is not enabled or if the project returns a 404-not-found, return None.
    :param project_id: The project ID number to sync.  See  the `projectId` field in
    https://cloud.google.com/resource-manager/reference/rest/v1/projects
    :param compute: The compute resource object created by googleapiclient.discovery.build()
    :param max_results: Optional cap on number of results returned by this function. Default = None, which means no cap.
    :return: List of a project's zone objects if Compute API is turned on, else None.
    """
    try:
        req = compute.zones().list(project=project_id, maxResults=max_results)
        res = req.execute()
        return res["items"]
    except HttpError as e:
        reason = _get_error_reason(e)
        if reason == "accessNotConfigured":
            logger.debug(
                (
                    "Google Compute Engine API access is not configured for project %s. "
                    "Full details: %s"
                ),
                project_id,
                e,
            )
            return None
        elif reason == "notFound":
            logger.debug(
                ("Project %s returned a 404 not found error. Full details: %s"),
                project_id,
                e,
            )
            return None
        else:
            raise


# Traceback (googleapiclient.errors.HttpError)
Traceback (most recent call last):
File "{Path}/cartography/sync.py", line 145, in run_with_config
return sync.run(neo4j_driver, config)
File "{Path}/cartography/sync.py", line 71, in run
stage_func(neo4j_session, config)
File "{Path}/cartography/util.py", line 58, in timed
result = method(*args, **kwargs)
File "{Path}/cartography/intel/gcp/__init__.py", line 218, in start_gcp_ingestion
_sync_multiple_projects(neo4j_session, resources, projects, config.update_tag, common_job_parameters)
File "{Path}/cartography/intel/gcp/__init__.py", line 177, in _sync_multiple_projects
_sync_single_project(neo4j_session, resources, project_id, gcp_update_tag, common_job_parameters)
File "{Path}/cartography/intel/gcp/__init__.py", line 151, in _sync_single_project
compute.sync(neo4j_session, resources.compute, project_id, gcp_update_tag, common_job_parameters)
File "{Path}/cartography/intel/gcp/compute.py", line 967, in sync
zones = get_zones_in_project(project_id, compute)
File "{Path}/cartography/util.py", line 58, in timed
result = method(*args, **kwargs)
File "{Path}/cartography/intel/gcp/compute.py", line 55, in get_zones_in_project
res = req.execute()
File "{Path}/googleapiclient/_helpers.py", line 134, in positional_wrapper
return wrapped(*args, **kwargs)
File "{Path}/googleapiclient/http.py", line 907, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://compute.googleapis.com/compute/v1/projects/{ProjectName}/zones?alt=json returned "Required 'compute.zones.list' permission for 'projects/{ProjectName}'">

# Fixed code
def get_zones_in_project(project_id, compute, max_results=None):
    """
    Return the zones where the Compute Engine API is enabled for the given project_id.
    See https://cloud.google.com/compute/docs/reference/rest/v1/zones and
    https://cloud.google.com/compute/docs/reference/rest/v1/zones/list.
    If the API is not enabled or if the project returns a 404-not-found, return None.
    :param project_id: The project ID number to sync.  See  the `projectId` field in
    https://cloud.google.com/resource-manager/reference/rest/v1/projects
    :param compute: The compute resource object created by googleapiclient.discovery.build()
    :param max_results: Optional cap on number of results returned by this function. Default = None, which means no cap.
    :return: List of a project's zone objects if Compute API is turned on, else None.
    """
    try:
        req = compute.zones().list(project=project_id, maxResults=max_results)
        res = req.execute()
        return res["items"]
    except HttpError as e:
        reason = _get_error_reason(e)
        if reason == "accessNotConfigured":
            logger.info(
                (
                    "Google Compute Engine API access is not configured for project %s; skipping. "
                    "Full details: %s"
                ),
                project_id,
                e,
            )
            return None
        elif reason == "notFound":
            logger.info(
                ("Project %s returned a 404 not found error. Full details: %s"),
                project_id,
                e,
            )
            return None
        elif reason == "forbidden":
            logger.info(
                (
                    "Your GCP identity does not have the compute.zones.list permission for project %s; skipping "
                    "compute sync for this project. Full details: %s"
                ),
                project_id,
                e,
            )
            return None
        else:
            raise