Hi, sorry if my problem has been answered previous...
# typescript
a
Hi, sorry if my problem has been answered previously, but I searched and couldn't find it. I apply the gcp-ts-serverless-raw sample (https://github.com/pulumi/examples/tree/master/gcp-ts-serverless-raw) in order to deploy several Cloud Functions. Everything is alright but I can't figure out how to set my function name without any random string at the end. My function part is :
Copy code
const functionhw = new gcp.cloudfunctions.Function(functionName, {
  sourceArchiveBucket: bucket.name,
  runtime: "nodejs10",
  sourceArchiveObject: bucketObjecthw.name,
  entryPoint: "helloGet",
  httpsTriggerUrl: `<https://us-central1-project-id.cloudfunctions.net/${functionName}>`,
  triggerHttp: true,
});
Even if I use really unique values (both for my project and globally), it sets this suffix
b
Pulumi does that intentionally and you usually want that suffix, as it prevents collisions between multiple instances/stacks that are running in the same environment. If you are asserting that your current environment (not stack, but project/account/etc. depending on your provider) must never have more than one instance of this resource, even if it talks to different things (i.e., you have multiple separate instances of your application in the same runtime environment, like special instances for certain customers), then what you want is OK, but given that Pulumi encourages you to operate on outputs from stacks rather than hard-coded values, it rarely should matter to you in a hands-on-keyboard way.
If you definitely want to set the name of that function, it looks like
gcp.cloudfunctions.FunctionArgs
has a
name
property that you can set. It is probably defaulting (this is what it does for AWS, so I'm guessing) to using what you have passed as the first argument as the prefix to its default value.
a
I understand your explanation, but I still need to set the trigger url the way I want to. And
httpsTriggerUrl
doesn't seem to fix it
This
FunctionArgs
class was clearly what I couldn't see. Thanks @boundless-monkey-50243!
b
That sounds like a usability bug. Maybe file an issue?
a
No, I was actually wrong concerning
httpsTriggerUrl
: it's only an output and not a value that can be set