Deploy Cloud Function 2nd gen with Audit Log trigger using Terraform
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Full terraform config to deploy an event-driven Cloud Function 2nd gen with resources
Code sample
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],[],[[["This Terraform configuration deploys an event-driven Cloud Function (2nd gen) triggered by Google Cloud Audit Logs, specifically monitoring for `storage.objects.create` events on a designated Google Cloud Storage bucket."],["The configuration utilizes a service account for both the Cloud Function and Eventarc trigger, granting it necessary roles like `run.invoker`, `eventarc.eventReceiver`, and `artifactregistry.reader`."],["A random ID is generated to create a unique prefix for the source and audit log buckets."],["The config specifies a filter for resource names using the `match-path-pattern` operator, enabling the function to be triggered only when `.txt` files are created within the specified bucket and allows path patterns."],["The Cloud Function's build configuration is specified, setting the runtime, entry point, and source code location, while also providing service configurations for instance scaling, memory, timeout, environment variables and network security."]]],[]]