Skip to content

Commit

Permalink
Resolve vpc value prior to checking it's value (#6332)
Browse files Browse the repository at this point in the history
* fix: resolve vpc value prior to checking it's value

closes #6327

* chore: correct endpoint resolution

* style: correct linting

* fix: do not overwrite entire object

---------

Co-authored-by: joehan <joehanley@google.com>
  • Loading branch information
steveoh and joehan authored Oct 10, 2023
1 parent b7c8383 commit b36700f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/deploy/functions/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,12 @@ export function toBackend(
nullsafeVisitor((cpu) => (cpu === "gcf_gen1" ? cpu : r.resolveInt(cpu)))
);
if (bdEndpoint.vpc) {
bdEndpoint.vpc.connector = params.resolveString(bdEndpoint.vpc.connector, paramValues);
if (bdEndpoint.vpc.connector && !bdEndpoint.vpc.connector.includes("/")) {
bdEndpoint.vpc.connector = `projects/${bdEndpoint.project}/locations/${region}/connectors/${bdEndpoint.vpc.connector}`;
}
bkEndpoint.vpc = { connector: params.resolveString(bdEndpoint.vpc.connector, paramValues) };

bkEndpoint.vpc = { connector: bdEndpoint.vpc.connector };
proto.copyIfPresent(bkEndpoint.vpc, bdEndpoint.vpc, "egressSettings");
} else if (bdEndpoint.vpc === null) {
bkEndpoint.vpc = null;
Expand Down

0 comments on commit b36700f

Please sign in to comment.