Deploy Cloud Function 2nd gen with Audit Log trigger using Terraform
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"]],[],[[["\u003cp\u003eThis Terraform configuration deploys an event-driven Cloud Function (2nd gen) triggered by Google Cloud Audit Logs, specifically monitoring for \u003ccode\u003estorage.objects.create\u003c/code\u003e events on a designated Google Cloud Storage bucket.\u003c/p\u003e\n"],["\u003cp\u003eThe configuration utilizes a service account for both the Cloud Function and Eventarc trigger, granting it necessary roles like \u003ccode\u003erun.invoker\u003c/code\u003e, \u003ccode\u003eeventarc.eventReceiver\u003c/code\u003e, and \u003ccode\u003eartifactregistry.reader\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eA random ID is generated to create a unique prefix for the source and audit log buckets.\u003c/p\u003e\n"],["\u003cp\u003eThe config specifies a filter for resource names using the \u003ccode\u003ematch-path-pattern\u003c/code\u003e operator, enabling the function to be triggered only when \u003ccode\u003e.txt\u003c/code\u003e files are created within the specified bucket and allows path patterns.\u003c/p\u003e\n"],["\u003cp\u003eThe 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.\u003c/p\u003e\n"]]],[],null,[]]