Skip to content

Commit a0c19d8

Browse files
committed
Fix bug w/ resetting vpc settings.
1 parent 538953d commit a0c19d8

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

spec/fixtures.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,5 @@ export const MINIMAL_ENDPOINT: Partial<ManifestEndpoint> = {
99
minInstances: RESET_VALUE,
1010
serviceAccountEmail: RESET_VALUE,
1111
timeoutSeconds: RESET_VALUE,
12-
vpc: {
13-
connector: RESET_VALUE,
14-
egressSettings: RESET_VALUE,
15-
},
12+
vpc: RESET_VALUE,
1613
};

src/runtime/manifest.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ export interface ManifestEndpoint {
3636
minInstances?: number | Expression<number> | ResetValue;
3737
concurrency?: number | Expression<number> | ResetValue;
3838
timeoutSeconds?: number | Expression<number> | ResetValue;
39-
vpc?: {
40-
connector: string | Expression<string> | ResetValue;
41-
egressSettings?: string | Expression<string> | ResetValue;
42-
};
39+
vpc?:
40+
| {
41+
connector: string | Expression<string>;
42+
egressSettings?: string | Expression<string> | ResetValue;
43+
}
44+
| ResetValue;
4345
serviceAccountEmail?: string | Expression<string> | ResetValue;
4446
cpu?: number | "gcf_gen1";
4547
labels?: Record<string, string>;
@@ -146,6 +148,7 @@ const RESETTABLE_OPTIONS: ResettableKeys<ManifestEndpoint> = {
146148
ingressSettings: null,
147149
concurrency: null,
148150
serviceAccountEmail: null,
151+
vpc: null,
149152
};
150153

151154
interface ManifestOptions {
@@ -161,11 +164,6 @@ function initEndpoint(
161164
for (const key of Object.keys(resetOptions)) {
162165
endpoint[key] = RESET_VALUE;
163166
}
164-
// VPC settings is not flat and handled separately.
165-
endpoint.vpc = {
166-
connector: RESET_VALUE,
167-
egressSettings: RESET_VALUE,
168-
};
169167
}
170168
return endpoint;
171169
}

src/v1/cloud-functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ export function optionsToEndpoint(options: DeploymentOptions): ManifestEndpoint
490490
);
491491
if (options?.vpcConnector !== undefined) {
492492
if (options.vpcConnector === null || options.vpcConnector instanceof ResetValue) {
493-
endpoint.vpc = { connector: RESET_VALUE, egressSettings: RESET_VALUE };
493+
endpoint.vpc = RESET_VALUE;
494494
} else {
495495
const vpc: ManifestEndpoint["vpc"] = { connector: options.vpcConnector };
496496
convertIfPresent(vpc, options, "egressSettings", "vpcConnectorEgressSettings");

src/v2/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export function optionsToEndpoint(
272272
convertIfPresent(endpoint, opts, "serviceAccountEmail", "serviceAccount");
273273
if (opts.vpcConnector !== undefined) {
274274
if (opts.vpcConnector === null || opts.vpcConnector instanceof ResetValue) {
275-
endpoint.vpc = { connector: RESET_VALUE, egressSettings: RESET_VALUE };
275+
endpoint.vpc = RESET_VALUE;
276276
} else {
277277
const vpc: ManifestEndpoint["vpc"] = { connector: opts.vpcConnector };
278278
convertIfPresent(vpc, opts, "egressSettings", "vpcConnectorEgressSettings");

0 commit comments

Comments
 (0)