-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(gcp): add script to enable APIs in GCP projects (#4117)
Co-authored-by: Pepe Fagoaga <[email protected]>
- Loading branch information
1 parent
98b7df6
commit a5378b5
Showing
27 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ cd ~ || exit | |
python3.9 -m pip install prowler-cloud | ||
prowler -v | ||
# Run Prowler | ||
prowler | ||
prowler aws |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# List of project IDs | ||
PROJECT_IDS=( | ||
"project-id-1" | ||
"project-id-2" | ||
"project-id-3" | ||
# Add more project IDs as needed | ||
) | ||
|
||
# List of Prowler APIs to enable | ||
APIS=( | ||
"apikeys.googleapis.com" | ||
"artifactregistry.googleapis.com" | ||
"bigquery.googleapis.com" | ||
"sqladmin.googleapis.com" # Cloud SQL | ||
"storage.googleapis.com" # Cloud Storage | ||
"compute.googleapis.com" | ||
"dataproc.googleapis.com" | ||
"dns.googleapis.com" | ||
"containerregistry.googleapis.com" # GCR (Google Container Registry) | ||
"container.googleapis.com" # GKE (Google Kubernetes Engine) | ||
"iam.googleapis.com" | ||
"cloudkms.googleapis.com" # KMS (Key Management Service) | ||
"logging.googleapis.com" | ||
) | ||
|
||
# Function to enable APIs for a given project | ||
enable_apis_for_project() { | ||
local PROJECT_ID=$1 | ||
|
||
echo "Enabling APIs for project: ${PROJECT_ID}" | ||
|
||
for API in "${APIS[@]}"; do | ||
echo "Enabling API: $API for project: ${PROJECT_ID}" | ||
if gcloud services enable "${API}" --project="${PROJECT_ID}"; then | ||
echo "Successfully enabled API $API for project ${PROJECT_ID}." | ||
else | ||
echo "Failed to enable API $API for project ${PROJECT_ID}." | ||
fi | ||
done | ||
} | ||
|
||
# Loop over each project and enable the APIs | ||
for PROJECT_ID in "${PROJECT_IDS[@]}"; do | ||
enable_apis_for_project "${PROJECT_ID}" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters