Sander van den Oord
Sander van den Oord

Reputation: 12848

GCP 2nd generation Cloud Functions: How can I use Secrets?

How can I use a secret when creating a 2nd gen Cloud Function?

When I create a 1st generation Cloud Function, I can add secrets like so:

Cloud Function 1st gen has option adding secret

However this option is not available when creating a 2nd generation Cloud Function:

Cloud Function 2nd gen no option adding secret

Upvotes: 1

Views: 585

Answers (1)

Sander van den Oord
Sander van den Oord

Reputation: 12848

When you create a 2nd generation Cloud Function, you actually create a Cloud Run.

So after the creation of your function go to Cloud Run, find the function you created, click on Edit & Deploy new revision and then add the references to the secret you need:

Edit and Deploy Cloud Run Secrets

Upvotes: 2

Related Questions