Ensure that at least one event trigger was configured in your function
Events are things that happen within your cloud environment that you might want to take action on. These might be changes to data in a database, files added to a storage system, or a new virtual machine instance being created. Creating a response to an event is done with a trigger. A trigger is a declaration that you are interested in a certain event or set of events. Binding a function to a trigger allows you to capture and act on events.
Risk Level: Low
Cloud Entity: Google Cloud Function
CloudGuard Rule ID: D9.GCP.MON.01
Covered by Spectral: Yes
Category: Compute
GSL LOGIC
CloudFunction should have trigger.eventTrigger
REMEDIATION
Cloud Functions supports the following event-based triggers:
- Cloud Pub/Sub Triggers - https://cloud.google.com/functions/docs/calling/pubsub
- Cloud Storage Triggers - https://cloud.google.com/functions/docs/calling/storage
- Direct Triggers - https://cloud.google.com/functions/docs/running/direct
- Cloud Firestore - https://cloud.google.com/functions/docs/calling/cloud-firestore
- Analytics for Firebase - https://cloud.google.com/functions/docs/calling/google-analytics-firebase
- Firebase Realtime Database - https://cloud.google.com/functions/docs/calling/realtime-database
- Firebase Authentication - https://cloud.google.com/functions/docs/calling/firebase-auth
When you create a function you need to choose one event type.
From Portal
- Go to the Cloud Functions Overview page. https://console.cloud.google.com/functions
- Click on 'create function'
- In Trigger section, choose a trigger.
- For each trigger fill the required information.
- Click save
From TF
resource "google_cloudfunctions_function" "test" {
+ event_trigger {}
}
From Command Line
In order to directly invoke a function,run:
gcloud functions deploy FUNCTION_NAME --entry-point ENTRY_POINT --trigger-topic TOPIC_NAME FLAGS
References
- https://cloud.google.com/functions/docs/concepts/events-triggers#events
- https://cloud.google.com/functions/docs/concepts/events-triggers#triggers
- https://cloud.google.com/functions/docs/calling
Google Cloud Function
Cloud Functions is a lightweight compute solution for developers to create single-purpose, stand-alone functions that respond to Cloud events without the need to manage a server or runtime environment.
Compliance Frameworks
- CloudGuard GCP All Rules Ruleset
- GCP CloudGuard Best Practices
- GCP MITRE ATT&CK Framework v12.1
- GCP NIST 800-53 Rev 5
Updated about 1 year ago