Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enterprise VPC Configurations - Ensure VPC Set To True If Not Defined #4521

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/pulumi-aws/src/enterprise/createApiPulumiApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,19 @@ export function createApiPulumiApp(projectAppParams: CreateApiPulumiAppParams =
// If using existing VPC, we ensure `vpc` param is set to `false`.
vpc: ({ getParam }) => {
const vpc = getParam(projectAppParams.vpc);
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
return usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc);
if (!vpc) {
// This could be `false` or `undefined`. If `undefined`, down the line,
// this means "deploy into VPC if dealing with a production environment".
return vpc;
}

// If using an existing VPC, we ensure Webiny does not deploy its own VPC.
const usingAdvancedVpcParams = typeof vpc !== "boolean";
if (usingAdvancedVpcParams && vpc.useExistingVpc) {
return false;
}

return true;
},
pulumi(...args) {
const [{ getParam }] = args;
Expand Down
15 changes: 13 additions & 2 deletions packages/pulumi-aws/src/enterprise/createCorePulumiApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,19 @@ export function createCorePulumiApp(projectAppParams: CreateCorePulumiAppParams
// If using existing VPC, we ensure `vpc` param is set to `false`.
vpc: ({ getParam }) => {
const vpc = getParam(projectAppParams.vpc);
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
return usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc);
if (!vpc) {
// This could be `false` or `undefined`. If `undefined`, down the line,
// this means "deploy into VPC if dealing with a production environment".
return vpc;
}

// If using an existing VPC, we ensure Webiny does not deploy its own VPC.
const usingAdvancedVpcParams = typeof vpc !== "boolean";
if (usingAdvancedVpcParams && vpc.useExistingVpc) {
return false;
}

return true;
},
pulumi(...args) {
const [app] = args;
Expand Down
15 changes: 13 additions & 2 deletions packages/pulumi-aws/src/enterprise/createWebsitePulumiApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,19 @@ export function createWebsitePulumiApp(projectAppParams: CreateWebsitePulumiAppP
// If using existing VPC, we ensure `vpc` param is set to `false`.
vpc: ({ getParam }) => {
const vpc = getParam(projectAppParams.vpc);
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
return usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc);
if (!vpc) {
// This could be `false` or `undefined`. If `undefined`, down the line,
// this means "deploy into VPC if dealing with a production environment".
return vpc;
}

// If using an existing VPC, we ensure Webiny does not deploy its own VPC.
const usingAdvancedVpcParams = typeof vpc !== "boolean";
if (usingAdvancedVpcParams && vpc.useExistingVpc) {
return false;
}

return true;
},
pulumi(...args) {
const [{ getParam }] = args;
Expand Down