You can create an Eventarc trigger that lets a supported event trigger
a Cloud Run function. You can configure a trigger when you create or
deploy a function, or for an existing function, using the Google Cloud CLI or the
Google Cloud console.

You can also trigger Cloud Run functions in response to custom events
published to an Eventarc channel.

## Create an Eventarc trigger

Create an Eventarc trigger so that your
Cloud Run function receives notifications of a specific event or set of
events. By specifying filters for the trigger, you can configure the routing of
the event, including the event type and source. For more information on how to
configure an Eventarc trigger for Cloud Run functions,
see
[Create a trigger for functions](https://docs.cloud.google.com/run/docs/triggering/trigger-with-events.md.txt#trigger-functions).

Before you create a trigger and deploy your function, make sure that you grant
the required Identity and Access Management (IAM) roles to your deployer principal,
trigger service account, and Google service agents. For more information, see
[Roles and permissions for Cloud Run functions targets](https://docs.cloud.google.com/eventarc/standard/docs/functions/roles-permissions.md.txt)
and [All roles and permissions](https://docs.cloud.google.com/eventarc/docs/all-roles-permissions.md.txt).

The following event types can trigger requests to your function:

- [An audit log is created](https://docs.cloud.google.com/eventarc/docs/reference/supported-events.md.txt#using-cloud-audit-logs) that matches the trigger's filter criteria
- [A direct event occurs](https://docs.cloud.google.com/eventarc/docs/reference/supported-events.md.txt#directly-from-a-google-cloud-source) such as an update to a Cloud Storage bucket or an update to a Firebase Remote Config template
- [A message is published to a Pub/Sub topic](https://docs.cloud.google.com/eventarc/docs/reference/supported-events.md.txt#cloud-pubsub)

## Trigger functions with custom events

You can trigger Cloud Run functions in response to custom events.
These are events produced by special or additional event providers, as opposed
to the built-in Firebase events supported by the Firebase SDK for
Cloud Run functions, and that are published to an Eventarc
channel. For more information, see
[Create and handle custom event triggers](https://firebase.google.com/docs/functions/custom-events).