ステップ 1Prerequisites and authenticationInstall Terraform, authenticate with gcloud, and set your API key.Install Terraform ≥ 1.7: brew install terraformAuthenticate: gcloud auth application-default loginCreate an Ingestion API key in Settings → API Keys.Set TF_VAR_secplatform_api_key=sp_xxxx in your environment.
ステップ 2Configure targets and deployEdit the targets map in main.tf, then apply to deploy all project+region pairs at once.Bootstrap the local source bundle first, then edit deploy/gcp-cloud-scanner/main.tf — add your project IDs and regions to locals.targets.Run: cd deploy/gcp-cloud-scanner && terraform init && terraform apply -auto-approveTerraform creates: service account, Secret Manager secret, Cloud Run Job, Cloud Scheduler, and enables required APIs.Each project+region pair is an independent deployment unit.
ステップ 3Verify and monitorTrigger a manual job execution and confirm findings arrive in the platform.Trigger manually: gcloud run jobs execute secplatform-cloud-scanner --project my-project --region us-central1Stream logs: gcloud logging read 'resource.labels.job_name=secplatform-cloud-scanner' --project my-projectConfirm findings appear in the platform with scanner=cloud.Check terraform output for all deployed job and scheduler names.
GCP cloud scanner sourceCreates the Terraform module under `deploy/gcp-cloud-scanner/` so the Cloud Run deployment commands on this page work unchanged.deploy/gcp-cloud-scanner/bashCopy codebash <(curl -fsSL https://stg-blackshield.chaplau.com/source-bundles/gcp-cloud-scanner.sh) cd deploy/gcp-cloud-scannerDownload source
Deploy to multiple GCP projects (two commands)bashCopy code# Bootstrap the local source bundle first bash <(curl -fsSL https://app.yourdomain.com/source-bundles/gcp-cloud-scanner.sh) cd deploy/gcp-cloud-scanner # Authenticate gcloud auth application-default login # Deploy all targets defined in main.tf locals.targets TF_VAR_secplatform_api_key=sp_xxxx \ terraform init && terraform apply -auto-approve # View deployed resources terraform output -json cloud_run_job_names terraform output -json scheduler_job_names
Trigger manual execution + stream logsbashCopy code# Trigger a one-off scan gcloud run jobs execute secplatform-cloud-scanner \ --project my-prod-project \ --region us-central1 # Stream execution logs gcloud logging read \ 'resource.type="cloud_run_job" AND resource.labels.job_name="secplatform-cloud-scanner"' \ --project my-prod-project \ --limit 50 \ --format "table(timestamp,textPayload)"
成功チェックterraform apply completes with no errors and outputs Cloud Run Job and Scheduler names.Manual job execution succeeds: gcloud run jobs execute secplatform-cloud-scannerCloud posture findings appear in the platform Findings view within 30 minutes.