bland-florist-21412
05/27/2021, 4:29 PMpulumi import
to see how to do it. I got the following:
import pulumi
import pulumi_gcp as gcp
generate_highlight = gcp.cloudfunctions.Function("generateHighlight",
available_memory_mb=4096,
entry_point="generateHighlight",
ingress_settings="ALLOW_ALL",
labels={
"deployment-tool": "console-cloud",
},
max_instances=0,
name="generateHighlight",
runtime="nodejs12",
source_archive_bucket="companion-cloud-functions-prod",
source_archive_object="generateHighlight-9465c8d",
timeout=60,
opts=pulumi.ResourceOptions(protect=True))
Note that the pubsub trigger which is set on the function is not mentioned here. But the docs says to use event_trigger
on the Function
constructor to set up the trigger. Any help would be very much appreciated.billowy-army-68599
05/27/2021, 4:58 PMbland-florist-21412
05/27/2021, 5:21 PMeventType
should be google.pubsub.topic.publish
instead of providers/cloud.pubsub/eventTypes/topic.publish
. The docs here: https://www.pulumi.com/docs/reference/pkg/gcp/cloudfunctions/function/#functioneventtrigger send you to the docs here: https://cloud.google.com/functions/docs/calling/pubsub. In those docs they show the current way, which doesn't match the Resource in Pulumi, and the legacy way which does match the Resource but uses the wrong trigger.billowy-army-68599
05/27/2021, 5:25 PMbland-florist-21412
05/31/2021, 5:52 PMdeploy.yml
file in it's directory and we auto-discover that, build the function from it, determine the trigger type from it, etc. so there's some yml parsing, if
statements, etc.trigger_args = gcp.cloudfunctions.FunctionEventTriggerArgs(
event_type='google.pubsub.topic.publish',
resource=topic.id)
function_args['event_trigger'] = trigger_args