Skip to content

Commit

Permalink
Setting service account also changes build service account
Browse files Browse the repository at this point in the history
  • Loading branch information
inlined committed Dec 16, 2024
1 parent 48d818e commit 0711c65
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gcp/cloudfunctionsv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export interface BuildConfig {
source: Source;
sourceToken?: string;
environmentVariables: Record<string, string>;
serviceAccount?: string;

// Output only
build?: string;
Expand Down Expand Up @@ -499,6 +500,9 @@ export function functionFromEndpoint(endpoint: backend.Endpoint): InputCloudFunc
},
serviceConfig: {},
};
if (endpoint.serviceAccount) {
gcfFunction.buildConfig.serviceAccount = `projects/${endpoint.project}/serviceAccounts/${endpoint.serviceAccount}`;
}

proto.copyIfPresent(gcfFunction, endpoint, "labels");
proto.copyIfPresent(
Expand All @@ -515,6 +519,7 @@ export function functionFromEndpoint(endpoint: backend.Endpoint): InputCloudFunc
"serviceAccountEmail",
"serviceAccount",
);

// Memory must be set because the default value of GCF gen 2 is Megabytes and
// we use mebibytes
const mem = endpoint.availableMemoryMb || backend.DEFAULT_MEMORY;
Expand Down

0 comments on commit 0711c65

Please sign in to comment.