Skip to content

Commit

Permalink
fix(gcp): make sure default project is active (#6113)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergio Garcia <hello@mistercloudsec.com>
  • Loading branch information
prowler-bot and MrCloudSec authored Dec 10, 2024
1 parent 159aa8b commit a6b4c27
Show file tree
Hide file tree
Showing 2 changed files with 282 additions and 147 deletions.
6 changes: 4 additions & 2 deletions prowler/providers/gcp/gcp_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ def __init__(
message="No Project IDs can be accessed via Google Credentials.",
)
if project_ids:
if self._default_project_id not in project_ids:
self._default_project_id = project_ids[0]
for input_project in project_ids:
for (
accessible_project_id,
Expand All @@ -203,6 +201,10 @@ def __init__(
self._projects[project_id] = project
self._project_ids.append(project_id)

# Change default project if not in active projects
if self._project_ids and self._default_project_id not in self._project_ids:
self._default_project_id = self._project_ids[0]

# Remove excluded projects if any input
if excluded_project_ids:
for excluded_project in excluded_project_ids:
Expand Down
Loading

0 comments on commit a6b4c27

Please sign in to comment.