@webiny/pulumi-aws 5.34.6-beta.0 → 5.34.6-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/api/createApiPulumiApp.d.ts +5 -0
- package/apps/api/createApiPulumiApp.js +10 -2
- package/apps/api/createApiPulumiApp.js.map +1 -1
- package/apps/react/createReactPulumiApp.js +10 -4
- package/apps/react/createReactPulumiApp.js.map +1 -1
- package/apps/website/createWebsitePulumiApp.d.ts +5 -1
- package/apps/website/createWebsitePulumiApp.js +21 -5
- package/apps/website/createWebsitePulumiApp.js.map +1 -1
- package/enterprise/createApiPulumiApp.d.ts +2 -1
- package/enterprise/createApiPulumiApp.js +19 -9
- package/enterprise/createApiPulumiApp.js.map +1 -1
- package/enterprise/createCorePulumiApp.d.ts +2 -1
- package/enterprise/createCorePulumiApp.js +23 -12
- package/enterprise/createCorePulumiApp.js.map +1 -1
- package/enterprise/createWebsitePulumiApp.d.ts +2 -1
- package/enterprise/createWebsitePulumiApp.js +20 -10
- package/enterprise/createWebsitePulumiApp.js.map +1 -1
- package/package.json +9 -9
- package/utils/addDomainsUrlsOutputs.d.ts +18 -0
- package/utils/addDomainsUrlsOutputs.js +50 -0
- package/utils/addDomainsUrlsOutputs.js.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +14 -0
- package/utils/index.js.map +1 -1
- package/apps/core/CoreOpenSearch.d.ts +0 -20
- package/apps/core/CoreOpenSearch.js +0 -262
- package/apps/core/CoreOpenSearch.js.map +0 -1
|
@@ -52,6 +52,11 @@ export declare const createApiPulumiApp: (projectAppParams?: CreateApiPulumiAppP
|
|
|
52
52
|
apiGateway: {
|
|
53
53
|
api: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/api").Api>;
|
|
54
54
|
stage: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/stage").Stage>;
|
|
55
|
+
/**
|
|
56
|
+
* Treats provided environments as production environments, which
|
|
57
|
+
* are deployed in production deployment mode.
|
|
58
|
+
* https://www.webiny.com/docs/architecture/deployment-modes/production
|
|
59
|
+
*/
|
|
55
60
|
routes: Record<string, {
|
|
56
61
|
integration: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/integration").Integration>;
|
|
57
62
|
route: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/route").Route>;
|
|
@@ -157,8 +157,6 @@ const createApiPulumiApp = (projectAppParams = {}) => {
|
|
|
157
157
|
|
|
158
158
|
app.addOutputs({
|
|
159
159
|
region: process.env.AWS_REGION,
|
|
160
|
-
apiUrl: cloudfront.output.domainName.apply(value => `https://${value}`),
|
|
161
|
-
apiDomain: cloudfront.output.domainName,
|
|
162
160
|
cognitoUserPoolId: core.cognitoUserPoolId,
|
|
163
161
|
cognitoAppClientId: core.cognitoAppClientId,
|
|
164
162
|
cognitoUserPoolPasswordPolicy: core.cognitoUserPoolPasswordPolicy,
|
|
@@ -169,6 +167,16 @@ const createApiPulumiApp = (projectAppParams = {}) => {
|
|
|
169
167
|
dynamoDbTable: core.primaryDynamodbTableName,
|
|
170
168
|
dynamoDbElasticsearchTable: core.elasticsearchDynamodbTableName
|
|
171
169
|
});
|
|
170
|
+
(0, _utils.addDomainsUrlsOutputs)({
|
|
171
|
+
app,
|
|
172
|
+
cloudfrontDistribution: cloudfront,
|
|
173
|
+
map: {
|
|
174
|
+
distributionDomain: "cloudfrontApiDomain",
|
|
175
|
+
distributionUrl: "cloudfrontApiUrl",
|
|
176
|
+
usedDomain: "apiDomain",
|
|
177
|
+
usedUrl: "apiUrl"
|
|
178
|
+
}
|
|
179
|
+
});
|
|
172
180
|
(0, _utils.tagResources)({
|
|
173
181
|
WbyProjectName: String(process.env["WEBINY_PROJECT_NAME"]),
|
|
174
182
|
WbyEnvironment: String(process.env["WEBINY_ENV"])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createApiPulumiApp","projectAppParams","app","createPulumiApp","name","path","config","program","pulumiResourceNamePrefix","getParam","onResource","resource","startsWith","pulumi","addHandler","productionEnvironments","params","create","isProduction","includes","run","env","WEBINY_LOGS_FORWARD_URL","String","process","core","addModule","CoreOutput","vpcEnabled","vpc","VpcConfig","enabled","pageBuilder","ApiPageBuilder","COGNITO_REGION","AWS_REGION","COGNITO_USER_POOL_ID","cognitoUserPoolId","DB_TABLE","primaryDynamodbTableName","DB_TABLE_ELASTICSEARCH","elasticsearchDynamodbTableName","ELASTIC_SEARCH_ENDPOINT","elasticsearchDomainEndpoint","ELASTIC_SEARCH_INDEX_PREFIX","S3_BUCKET","fileManagerBucketId","fileManager","ApiFileManager","apwScheduler","ApiApwScheduler","primaryDynamodbTableArn","headlessCms","ApiHeadlessCMS","OKTA_ISSUER","APW_SCHEDULER_SCHEDULE_ACTION_HANDLER","scheduleAction","lambda","output","arn","graphql","ApiGraphql","EVENT_BUS","eventBusArn","IMPORT_CREATE_HANDLER","import","functions","EXPORT_PROCESS_HANDLER","export","apwSchedulerEventRule","eventRule","apwSchedulerEventTarget","eventTarget","apiGateway","ApiGateway","method","function","download","cloudfront","ApiCloudfront","domains","applyCustomDomain","addOutputs","region","apiUrl","domainName","apply","value","apiDomain","cognitoAppClientId","cognitoUserPoolPasswordPolicy","apwSchedulerScheduleAction","apwSchedulerExecuteAction","executeAction","apwSchedulerEventTargetId","targetId","dynamoDbTable","dynamoDbElasticsearchTable","tagResources","WbyProjectName","WbyEnvironment","withCommonLambdaEnvVariables"],"sources":["createApiPulumiApp.ts"],"sourcesContent":["import { createPulumiApp, PulumiAppParam, PulumiAppParamCallback } from \"@webiny/pulumi\";\nimport {\n ApiGateway,\n ApiApwScheduler,\n ApiCloudfront,\n ApiFileManager,\n ApiGraphql,\n ApiHeadlessCMS,\n ApiPageBuilder,\n CoreOutput,\n VpcConfig\n} from \"~/apps\";\nimport { applyCustomDomain, CustomDomainParams } from \"../customDomain\";\nimport { tagResources } from \"~/utils\";\nimport { withCommonLambdaEnvVariables } from \"~/utils\";\n\nexport type ApiPulumiApp = ReturnType<typeof createApiPulumiApp>;\n\nexport interface CreateApiPulumiAppParams {\n /**\n * Enables or disables VPC for the API.\n * For VPC to work you also have to enable it in the Core application.\n */\n vpc?: PulumiAppParam<boolean>;\n\n /** Custom domain configuration */\n domains?: PulumiAppParamCallback<CustomDomainParams>;\n\n /**\n * Provides a way to adjust existing Pulumi code (cloud infrastructure resources)\n * or add additional ones into the mix.\n */\n pulumi?: (app: ApiPulumiApp) => void | Promise<void>;\n\n /**\n * Prefixes names of all Pulumi cloud infrastructure resource with given prefix.\n */\n pulumiResourceNamePrefix?: PulumiAppParam<string>;\n\n /**\n * Treats provided environments as production environments, which\n * are deployed in production deployment mode.\n * https://www.webiny.com/docs/architecture/deployment-modes/production\n */\n productionEnvironments?: PulumiAppParam<string[]>;\n}\n\nexport const createApiPulumiApp = (projectAppParams: CreateApiPulumiAppParams = {}) => {\n const app = createPulumiApp({\n name: \"api\",\n path: \"apps/api\",\n config: projectAppParams,\n program: async app => {\n const pulumiResourceNamePrefix = app.getParam(\n projectAppParams.pulumiResourceNamePrefix\n );\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied too late.\n if (projectAppParams.pulumi) {\n app.addHandler(() => {\n return projectAppParams.pulumi!(app as ApiPulumiApp);\n });\n }\n\n const productionEnvironments = app.params.create.productionEnvironments || [\"prod\"];\n const isProduction = productionEnvironments.includes(app.params.run.env);\n\n // Enables logs forwarding.\n // https://www.webiny.com/docs/how-to-guides/use-watch-command#enabling-logs-forwarding\n const WEBINY_LOGS_FORWARD_URL = String(process.env.WEBINY_LOGS_FORWARD_URL);\n\n // Register core output as a module available to all the other modules\n const core = app.addModule(CoreOutput);\n\n // Register VPC config module to be available to other modules.\n const vpcEnabled = app.getParam(projectAppParams?.vpc) ?? isProduction;\n app.addModule(VpcConfig, { enabled: vpcEnabled });\n\n const pageBuilder = app.addModule(ApiPageBuilder, {\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_ELASTICSEARCH: core.elasticsearchDynamodbTableName,\n ELASTIC_SEARCH_ENDPOINT: core.elasticsearchDomainEndpoint,\n\n // Not required. Useful for testing purposes / ephemeral environments.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n ELASTIC_SEARCH_INDEX_PREFIX: process.env.ELASTIC_SEARCH_INDEX_PREFIX,\n\n S3_BUCKET: core.fileManagerBucketId,\n WEBINY_LOGS_FORWARD_URL\n }\n });\n\n const fileManager = app.addModule(ApiFileManager);\n\n const apwScheduler = app.addModule(ApiApwScheduler, {\n primaryDynamodbTableArn: core.primaryDynamodbTableArn,\n\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n S3_BUCKET: core.fileManagerBucketId,\n WEBINY_LOGS_FORWARD_URL\n }\n });\n\n const headlessCms = app.addModule(ApiHeadlessCMS, {\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_ELASTICSEARCH: core.elasticsearchDynamodbTableName,\n ELASTIC_SEARCH_ENDPOINT: core.elasticsearchDomainEndpoint,\n\n // Not required. Useful for testing purposes / ephemeral environments.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n ELASTIC_SEARCH_INDEX_PREFIX: process.env.ELASTIC_SEARCH_INDEX_PREFIX,\n\n S3_BUCKET: core.fileManagerBucketId,\n // TODO: move to okta plugin\n OKTA_ISSUER: process.env[\"OKTA_ISSUER\"],\n WEBINY_LOGS_FORWARD_URL,\n /**\n * APW\n */\n APW_SCHEDULER_SCHEDULE_ACTION_HANDLER:\n apwScheduler.scheduleAction.lambda.output.arn\n }\n });\n\n const graphql = app.addModule(ApiGraphql, {\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_ELASTICSEARCH: core.elasticsearchDynamodbTableName,\n ELASTIC_SEARCH_ENDPOINT: core.elasticsearchDomainEndpoint,\n\n // Not required. Useful for testing purposes / ephemeral environments.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n ELASTIC_SEARCH_INDEX_PREFIX: process.env.ELASTIC_SEARCH_INDEX_PREFIX,\n\n S3_BUCKET: core.fileManagerBucketId,\n EVENT_BUS: core.eventBusArn,\n IMPORT_CREATE_HANDLER: pageBuilder.import.functions.create.output.arn,\n EXPORT_PROCESS_HANDLER: pageBuilder.export.functions.process.output.arn,\n // TODO: move to okta plugin\n OKTA_ISSUER: process.env[\"OKTA_ISSUER\"],\n WEBINY_LOGS_FORWARD_URL,\n /**\n * APW\n */\n APW_SCHEDULER_SCHEDULE_ACTION_HANDLER:\n apwScheduler.scheduleAction.lambda.output.arn\n },\n apwSchedulerEventRule: apwScheduler.eventRule.output,\n apwSchedulerEventTarget: apwScheduler.eventTarget.output\n });\n\n const apiGateway = app.addModule(ApiGateway, {\n \"graphql-post\": {\n path: \"/graphql\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"graphql-options\": {\n path: \"/graphql\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-any\": {\n path: \"/files/{path}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"cms-post\": {\n path: \"/cms/{key+}\",\n method: \"POST\",\n function: headlessCms.functions.graphql.output.arn\n },\n \"cms-options\": {\n path: \"/cms/{key+}\",\n method: \"OPTIONS\",\n function: headlessCms.functions.graphql.output.arn\n }\n });\n\n const cloudfront = app.addModule(ApiCloudfront);\n\n const domains = app.getParam(projectAppParams.domains);\n if (domains) {\n applyCustomDomain(cloudfront, domains);\n }\n\n app.addOutputs({\n region: process.env.AWS_REGION,\n apiUrl: cloudfront.output.domainName.apply(value => `https://${value}`),\n apiDomain: cloudfront.output.domainName,\n cognitoUserPoolId: core.cognitoUserPoolId,\n cognitoAppClientId: core.cognitoAppClientId,\n cognitoUserPoolPasswordPolicy: core.cognitoUserPoolPasswordPolicy,\n apwSchedulerScheduleAction: apwScheduler.scheduleAction.lambda.output.arn,\n apwSchedulerExecuteAction: apwScheduler.executeAction.lambda.output.arn,\n apwSchedulerEventRule: apwScheduler.eventRule.output.name,\n apwSchedulerEventTargetId: apwScheduler.eventTarget.output.targetId,\n dynamoDbTable: core.primaryDynamodbTableName,\n dynamoDbElasticsearchTable: core.elasticsearchDynamodbTableName\n });\n\n tagResources({\n WbyProjectName: String(process.env[\"WEBINY_PROJECT_NAME\"]),\n WbyEnvironment: String(process.env[\"WEBINY_ENV\"])\n });\n\n return {\n fileManager,\n graphql,\n headlessCms,\n apiGateway,\n cloudfront,\n apwScheduler\n };\n }\n });\n\n return withCommonLambdaEnvVariables(app);\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAWA;;AACA;;AAkCO,MAAMA,kBAAkB,GAAG,CAACC,gBAA0C,GAAG,EAA9C,KAAqD;EACnF,MAAMC,GAAG,GAAG,IAAAC,uBAAA,EAAgB;IACxBC,IAAI,EAAE,KADkB;IAExBC,IAAI,EAAE,UAFkB;IAGxBC,MAAM,EAAEL,gBAHgB;IAIxBM,OAAO,EAAE,MAAML,GAAN,IAAa;MAClB,MAAMM,wBAAwB,GAAGN,GAAG,CAACO,QAAJ,CAC7BR,gBAAgB,CAACO,wBADY,CAAjC;;MAGA,IAAIA,wBAAJ,EAA8B;QAC1BN,GAAG,CAACQ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AK,WAAUA,KAAM,EAA7D,CAFG;QAGXC,SAAS,EAAEV,UAAU,CAACpB,MAAX,CAAkB2B,UAHlB;QAIXhD,iBAAiB,EAAEZ,IAAI,CAACY,iBAJb;QAKXoD,kBAAkB,EAAEhE,IAAI,CAACgE,kBALd;QAMXC,6BAA6B,EAAEjE,IAAI,CAACiE,6BANzB;QAOXC,0BAA0B,EAAE1C,YAAY,CAACO,cAAb,CAA4BC,MAA5B,CAAmCC,MAAnC,CAA0CC,GAP3D;QAQXiC,yBAAyB,EAAE3C,YAAY,CAAC4C,aAAb,CAA2BpC,MAA3B,CAAkCC,MAAlC,CAAyCC,GARzD;QASXU,qBAAqB,EAAEpB,YAAY,CAACqB,SAAb,CAAuBZ,MAAvB,CAA8BtD,IAT1C;QAUX0F,yBAAyB,EAAE7C,YAAY,CAACuB,WAAb,CAAyBd,MAAzB,CAAgCqC,QAVhD;QAWXC,aAAa,EAAEvE,IAAI,CAACc,wBAXT;QAYX0D,0BAA0B,EAAExE,IAAI,CAACgB;MAZtB,CAAf;MAeA,IAAAyD,mBAAA,EAAa;QACTC,cAAc,EAAE5E,MAAM,CAACC,OAAO,CAACH,GAAR,CAAY,qBAAZ,CAAD,CADb;QAET+E,cAAc,EAAE7E,MAAM,CAACC,OAAO,CAACH,GAAR,CAAY,YAAZ,CAAD;MAFb,CAAb;MAKA,OAAO;QACH0B,WADG;QAEHa,OAFG;QAGHR,WAHG;QAIHqB,UAJG;QAKHK,UALG;QAMH7B;MANG,CAAP;IAQH;EAzLuB,CAAhB,CAAZ;EA4LA,OAAO,IAAAoD,mCAAA,EAA6BnG,GAA7B,CAAP;AACH,CA9LM"}
|
|
1
|
+
{"version":3,"names":["createApiPulumiApp","projectAppParams","app","createPulumiApp","name","path","config","program","pulumiResourceNamePrefix","getParam","onResource","resource","startsWith","pulumi","addHandler","productionEnvironments","params","create","isProduction","includes","run","env","WEBINY_LOGS_FORWARD_URL","String","process","core","addModule","CoreOutput","vpcEnabled","vpc","VpcConfig","enabled","pageBuilder","ApiPageBuilder","COGNITO_REGION","AWS_REGION","COGNITO_USER_POOL_ID","cognitoUserPoolId","DB_TABLE","primaryDynamodbTableName","DB_TABLE_ELASTICSEARCH","elasticsearchDynamodbTableName","ELASTIC_SEARCH_ENDPOINT","elasticsearchDomainEndpoint","ELASTIC_SEARCH_INDEX_PREFIX","S3_BUCKET","fileManagerBucketId","fileManager","ApiFileManager","apwScheduler","ApiApwScheduler","primaryDynamodbTableArn","headlessCms","ApiHeadlessCMS","OKTA_ISSUER","APW_SCHEDULER_SCHEDULE_ACTION_HANDLER","scheduleAction","lambda","output","arn","graphql","ApiGraphql","EVENT_BUS","eventBusArn","IMPORT_CREATE_HANDLER","import","functions","EXPORT_PROCESS_HANDLER","export","apwSchedulerEventRule","eventRule","apwSchedulerEventTarget","eventTarget","apiGateway","ApiGateway","method","function","download","cloudfront","ApiCloudfront","domains","applyCustomDomain","addOutputs","region","cognitoAppClientId","cognitoUserPoolPasswordPolicy","apwSchedulerScheduleAction","apwSchedulerExecuteAction","executeAction","apwSchedulerEventTargetId","targetId","dynamoDbTable","dynamoDbElasticsearchTable","addDomainsUrlsOutputs","cloudfrontDistribution","map","distributionDomain","distributionUrl","usedDomain","usedUrl","tagResources","WbyProjectName","WbyEnvironment","withCommonLambdaEnvVariables"],"sources":["createApiPulumiApp.ts"],"sourcesContent":["import { createPulumiApp, PulumiAppParam, PulumiAppParamCallback } from \"@webiny/pulumi\";\nimport {\n ApiGateway,\n ApiApwScheduler,\n ApiCloudfront,\n ApiFileManager,\n ApiGraphql,\n ApiHeadlessCMS,\n ApiPageBuilder,\n CoreOutput,\n VpcConfig\n} from \"~/apps\";\nimport { applyCustomDomain, CustomDomainParams } from \"../customDomain\";\nimport { tagResources, withCommonLambdaEnvVariables, addDomainsUrlsOutputs } from \"~/utils\";\n\nexport type ApiPulumiApp = ReturnType<typeof createApiPulumiApp>;\n\nexport interface CreateApiPulumiAppParams {\n /**\n * Enables or disables VPC for the API.\n * For VPC to work you also have to enable it in the Core application.\n */\n vpc?: PulumiAppParam<boolean>;\n\n /** Custom domain configuration */\n domains?: PulumiAppParamCallback<CustomDomainParams>;\n\n /**\n * Provides a way to adjust existing Pulumi code (cloud infrastructure resources)\n * or add additional ones into the mix.\n */\n pulumi?: (app: ApiPulumiApp) => void | Promise<void>;\n\n /**\n * Prefixes names of all Pulumi cloud infrastructure resource with given prefix.\n */\n pulumiResourceNamePrefix?: PulumiAppParam<string>;\n\n /**\n * Treats provided environments as production environments, which\n * are deployed in production deployment mode.\n * https://www.webiny.com/docs/architecture/deployment-modes/production\n */\n productionEnvironments?: PulumiAppParam<string[]>;\n}\n\nexport const createApiPulumiApp = (projectAppParams: CreateApiPulumiAppParams = {}) => {\n const app = createPulumiApp({\n name: \"api\",\n path: \"apps/api\",\n config: projectAppParams,\n program: async app => {\n const pulumiResourceNamePrefix = app.getParam(\n projectAppParams.pulumiResourceNamePrefix\n );\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied too late.\n if (projectAppParams.pulumi) {\n app.addHandler(() => {\n return projectAppParams.pulumi!(app as ApiPulumiApp);\n });\n }\n\n const productionEnvironments = app.params.create.productionEnvironments || [\"prod\"];\n const isProduction = productionEnvironments.includes(app.params.run.env);\n\n // Enables logs forwarding.\n // https://www.webiny.com/docs/how-to-guides/use-watch-command#enabling-logs-forwarding\n const WEBINY_LOGS_FORWARD_URL = String(process.env.WEBINY_LOGS_FORWARD_URL);\n\n // Register core output as a module available to all the other modules\n const core = app.addModule(CoreOutput);\n\n // Register VPC config module to be available to other modules.\n const vpcEnabled = app.getParam(projectAppParams?.vpc) ?? isProduction;\n app.addModule(VpcConfig, { enabled: vpcEnabled });\n\n const pageBuilder = app.addModule(ApiPageBuilder, {\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_ELASTICSEARCH: core.elasticsearchDynamodbTableName,\n ELASTIC_SEARCH_ENDPOINT: core.elasticsearchDomainEndpoint,\n\n // Not required. Useful for testing purposes / ephemeral environments.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n ELASTIC_SEARCH_INDEX_PREFIX: process.env.ELASTIC_SEARCH_INDEX_PREFIX,\n\n S3_BUCKET: core.fileManagerBucketId,\n WEBINY_LOGS_FORWARD_URL\n }\n });\n\n const fileManager = app.addModule(ApiFileManager);\n\n const apwScheduler = app.addModule(ApiApwScheduler, {\n primaryDynamodbTableArn: core.primaryDynamodbTableArn,\n\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n S3_BUCKET: core.fileManagerBucketId,\n WEBINY_LOGS_FORWARD_URL\n }\n });\n\n const headlessCms = app.addModule(ApiHeadlessCMS, {\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_ELASTICSEARCH: core.elasticsearchDynamodbTableName,\n ELASTIC_SEARCH_ENDPOINT: core.elasticsearchDomainEndpoint,\n\n // Not required. Useful for testing purposes / ephemeral environments.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n ELASTIC_SEARCH_INDEX_PREFIX: process.env.ELASTIC_SEARCH_INDEX_PREFIX,\n\n S3_BUCKET: core.fileManagerBucketId,\n // TODO: move to okta plugin\n OKTA_ISSUER: process.env[\"OKTA_ISSUER\"],\n WEBINY_LOGS_FORWARD_URL,\n /**\n * APW\n */\n APW_SCHEDULER_SCHEDULE_ACTION_HANDLER:\n apwScheduler.scheduleAction.lambda.output.arn\n }\n });\n\n const graphql = app.addModule(ApiGraphql, {\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_ELASTICSEARCH: core.elasticsearchDynamodbTableName,\n ELASTIC_SEARCH_ENDPOINT: core.elasticsearchDomainEndpoint,\n\n // Not required. Useful for testing purposes / ephemeral environments.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n ELASTIC_SEARCH_INDEX_PREFIX: process.env.ELASTIC_SEARCH_INDEX_PREFIX,\n\n S3_BUCKET: core.fileManagerBucketId,\n EVENT_BUS: core.eventBusArn,\n IMPORT_CREATE_HANDLER: pageBuilder.import.functions.create.output.arn,\n EXPORT_PROCESS_HANDLER: pageBuilder.export.functions.process.output.arn,\n // TODO: move to okta plugin\n OKTA_ISSUER: process.env[\"OKTA_ISSUER\"],\n WEBINY_LOGS_FORWARD_URL,\n /**\n * APW\n */\n APW_SCHEDULER_SCHEDULE_ACTION_HANDLER:\n apwScheduler.scheduleAction.lambda.output.arn\n },\n apwSchedulerEventRule: apwScheduler.eventRule.output,\n apwSchedulerEventTarget: apwScheduler.eventTarget.output\n });\n\n const apiGateway = app.addModule(ApiGateway, {\n \"graphql-post\": {\n path: \"/graphql\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"graphql-options\": {\n path: \"/graphql\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-any\": {\n path: \"/files/{path}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"cms-post\": {\n path: \"/cms/{key+}\",\n method: \"POST\",\n function: headlessCms.functions.graphql.output.arn\n },\n \"cms-options\": {\n path: \"/cms/{key+}\",\n method: \"OPTIONS\",\n function: headlessCms.functions.graphql.output.arn\n }\n });\n\n const cloudfront = app.addModule(ApiCloudfront);\n\n const domains = app.getParam(projectAppParams.domains);\n if (domains) {\n applyCustomDomain(cloudfront, domains);\n }\n\n app.addOutputs({\n region: process.env.AWS_REGION,\n cognitoUserPoolId: core.cognitoUserPoolId,\n cognitoAppClientId: core.cognitoAppClientId,\n cognitoUserPoolPasswordPolicy: core.cognitoUserPoolPasswordPolicy,\n apwSchedulerScheduleAction: apwScheduler.scheduleAction.lambda.output.arn,\n apwSchedulerExecuteAction: apwScheduler.executeAction.lambda.output.arn,\n apwSchedulerEventRule: apwScheduler.eventRule.output.name,\n apwSchedulerEventTargetId: apwScheduler.eventTarget.output.targetId,\n dynamoDbTable: core.primaryDynamodbTableName,\n dynamoDbElasticsearchTable: core.elasticsearchDynamodbTableName\n });\n\n addDomainsUrlsOutputs({\n app,\n cloudfrontDistribution: cloudfront,\n map: {\n distributionDomain: \"cloudfrontApiDomain\",\n distributionUrl: \"cloudfrontApiUrl\",\n usedDomain: \"apiDomain\",\n usedUrl: \"apiUrl\"\n }\n });\n\n tagResources({\n WbyProjectName: String(process.env[\"WEBINY_PROJECT_NAME\"]),\n WbyEnvironment: String(process.env[\"WEBINY_ENV\"])\n });\n\n return {\n fileManager,\n graphql,\n headlessCms,\n apiGateway,\n cloudfront,\n apwScheduler\n };\n }\n });\n\n return withCommonLambdaEnvVariables(app);\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAWA;;AACA;;AAiCO,MAAMA,kBAAkB,GAAG,CAACC,gBAA0C,GAAG,EAA9C,KAAqD;EACnF,MAAMC,GAAG,GAAG,IAAAC,uBAAA,EAAgB;IACxBC,IAAI,EAAE,KADkB;IAExBC,IAAI,EAAE,UAFkB;IAGxBC,MAAM,EAAEL,gBAHgB;IAIxBM,OAAO,EAAE,MAAML,GAAN,IAAa;MAClB,MAAMM,wBAAwB,GAAGN,GAAG,CAACO,QAAJ,CAC7BR,gBAAgB,CAACO,wBADY,CAAjC;;MAGA,IAAIA,wBAAJ,EAA8B;QAC1BN,GAAG,CAACQ,UAAJ,CAAeC,QAAQ,IAAI;UACvB,IAAI,CAAC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;QAKXC,0BAA0B,EAAErC,YAAY,CAACO,cAAb,CAA4BC,MAA5B,CAAmCC,MAAnC,CAA0CC,GAL3D;QAMX4B,yBAAyB,EAAEtC,YAAY,CAACuC,aAAb,CAA2B/B,MAA3B,CAAkCC,MAAlC,CAAyCC,GANzD;QAOXU,qBAAqB,EAAEpB,YAAY,CAACqB,SAAb,CAAuBZ,MAAvB,CAA8BtD,IAP1C;QAQXqF,yBAAyB,EAAExC,YAAY,CAACuB,WAAb,CAAyBd,MAAzB,CAAgCgC,QARhD;QASXC,aAAa,EAAElE,IAAI,CAACc,wBATT;QAUXqD,0BAA0B,EAAEnE,IAAI,CAACgB;MAVtB,CAAf;MAaA,IAAAoD,4BAAA,EAAsB;QAClB3F,GADkB;QAElB4F,sBAAsB,EAAEhB,UAFN;QAGlBiB,GAAG,EAAE;UACDC,kBAAkB,EAAE,qBADnB;UAEDC,eAAe,EAAE,kBAFhB;UAGDC,UAAU,EAAE,WAHX;UAIDC,OAAO,EAAE;QAJR;MAHa,CAAtB;MAWA,IAAAC,mBAAA,EAAa;QACTC,cAAc,EAAE9E,MAAM,CAACC,OAAO,CAACH,GAAR,CAAY,qBAAZ,CAAD,CADb;QAETiF,cAAc,EAAE/E,MAAM,CAACC,OAAO,CAACH,GAAR,CAAY,YAAZ,CAAD;MAFb,CAAb;MAKA,OAAO;QACH0B,WADG;QAEHa,OAFG;QAGHR,WAHG;QAIHqB,UAJG;QAKHK,UALG;QAMH7B;MANG,CAAP;IAQH;EAlMuB,CAAhB,CAAZ;EAqMA,OAAO,IAAAsD,mCAAA,EAA6BrG,GAA7B,CAAP;AACH,CAvMM"}
|
|
@@ -101,10 +101,16 @@ const createReactPulumiApp = projectAppParams => {
|
|
|
101
101
|
(0, _customDomain.applyCustomDomain)(cloudfront, domains);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
app.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
app.addOutput("appStorage", bucket.bucket.output.id);
|
|
105
|
+
(0, _utils.addDomainsUrlsOutputs)({
|
|
106
|
+
app,
|
|
107
|
+
cloudfrontDistribution: cloudfront,
|
|
108
|
+
map: {
|
|
109
|
+
distributionDomain: "cloudfrontAppDomain",
|
|
110
|
+
distributionUrl: "cloudfrontAppUrl",
|
|
111
|
+
usedDomain: "appDomain",
|
|
112
|
+
usedUrl: "appUrl"
|
|
113
|
+
}
|
|
108
114
|
});
|
|
109
115
|
(0, _utils.tagResources)({
|
|
110
116
|
WbyAppName: name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createReactPulumiApp","projectAppParams","createPulumiApp","name","path","folder","config","program","app","pulumiResourceNamePrefix","getParam","onResource","resource","startsWith","core","addModule","CoreOutput","pulumi","addHandler","bucket","createPrivateAppBucket","cloudfront","addResource","aws","Distribution","enabled","waitForDeployment","origins","origin","defaultRootObject","defaultCacheBehavior","compress","targetOriginId","originId","viewerProtocolPolicy","allowedMethods","cachedMethods","forwardedValues","cookies","forward","queryString","minTtl","defaultTtl","maxTtl","priceClass","customErrorResponses","errorCode","responseCode","responsePagePath","restrictions","geoRestriction","restrictionType","viewerCertificate","cloudfrontDefaultCertificate","domains","applyCustomDomain","addOutputs","appStorage","output","id","appDomain","domainName","appUrl","apply","value","tagResources","WbyAppName","WbyProjectName","String","process","env","WbyEnvironment","dynamodb","TableItem","tableName","primaryDynamodbTableName","hashKey","primaryDynamodbTableHashKey","rangeKey","primaryDynamodbTableRangeKey","key","item","interpolate","params","run","variant"],"sources":["createReactPulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\n\nimport { createPulumiApp, PulumiAppParam, PulumiAppParamCallback } from \"@webiny/pulumi\";\nimport { tagResources } from \"~/utils\";\nimport { createPrivateAppBucket } from \"../createAppBucket\";\nimport { applyCustomDomain, CustomDomainParams } from \"../customDomain\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { CoreOutput } from \"../common/CoreOutput\";\n\nexport type ReactPulumiApp = ReturnType<typeof createReactPulumiApp>;\n\nexport interface CreateReactPulumiAppParams {\n /**\n * A name of the app, e.g., \"user-area\"\n */\n name: string;\n\n /**\n * A folder where the app is located, e.g., \"apps/user-area\"\n */\n folder: string;\n\n /** Custom domain configuration */\n domains?: PulumiAppParamCallback<CustomDomainParams>;\n\n /**\n * Provides a way to adjust existing Pulumi code (cloud infrastructure resources)\n * or add additional ones into the mix.\n */\n pulumi?: (app: ReactPulumiApp) => void | Promise<void>;\n\n /**\n * Prefixes names of all Pulumi cloud infrastructure resource with given prefix.\n */\n pulumiResourceNamePrefix?: PulumiAppParam<string>;\n\n /**\n * Treats provided environments as production environments, which\n * are deployed in production deployment mode.\n * https://www.webiny.com/docs/architecture/deployment-modes/production\n */\n productionEnvironments?: PulumiAppParam<string[]>;\n}\n\nexport const createReactPulumiApp = (projectAppParams: CreateReactPulumiAppParams) => {\n return createPulumiApp({\n name: projectAppParams.name,\n path: projectAppParams.folder,\n config: projectAppParams,\n program: async app => {\n const pulumiResourceNamePrefix = app.getParam(\n projectAppParams.pulumiResourceNamePrefix\n );\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n const { name } = projectAppParams;\n\n // Register core output as a module available for all other modules\n const core = app.addModule(CoreOutput);\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n if (projectAppParams.pulumi) {\n app.addHandler(() => {\n return projectAppParams.pulumi!(app as ReactPulumiApp);\n });\n }\n\n const bucket = createPrivateAppBucket(app, `${name}-app`);\n\n const cloudfront = app.addResource(aws.cloudfront.Distribution, {\n name: `${name}-app-cdn`,\n config: {\n enabled: true,\n waitForDeployment: false,\n origins: [bucket.origin],\n defaultRootObject: \"index.html\",\n defaultCacheBehavior: {\n compress: true,\n targetOriginId: bucket.origin.originId,\n viewerProtocolPolicy: \"redirect-to-https\",\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: { forward: \"none\" },\n queryString: false\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 600,\n maxTtl: 600\n },\n priceClass: \"PriceClass_100\",\n customErrorResponses: [\n { errorCode: 404, responseCode: 404, responsePagePath: \"/index.html\" }\n ],\n restrictions: {\n geoRestriction: {\n restrictionType: \"none\"\n }\n },\n viewerCertificate: {\n cloudfrontDefaultCertificate: true\n }\n }\n });\n\n const domains = app.getParam(projectAppParams.domains);\n if (domains) {\n applyCustomDomain(cloudfront, domains);\n }\n\n app.addOutputs({\n appStorage: bucket.bucket.output.id,\n appDomain: cloudfront.output.domainName,\n appUrl: cloudfront.output.domainName.apply(value => `https://${value}`)\n });\n\n tagResources({\n WbyAppName: name,\n WbyProjectName: String(process.env[\"WEBINY_PROJECT_NAME\"]),\n WbyEnvironment: String(process.env[\"WEBINY_ENV\"])\n });\n\n /**\n * We need to store the appUrl to the admin settings item in the dynamodb\n */\n app.addResource(aws.dynamodb.TableItem, {\n name: \"adminSettings\",\n config: {\n tableName: core.primaryDynamodbTableName,\n hashKey: core.primaryDynamodbTableHashKey,\n rangeKey: pulumi\n .output(core.primaryDynamodbTableRangeKey)\n .apply(key => key || \"SK\"),\n item: pulumi.interpolate`{\n \"PK\": {\"S\": \"ADMIN#SETTINGS\"},\n \"SK\": {\"S\": \"${app.params.run.variant || \"default\"}\"},\n \"data\": {\n \"M\": {\n \"appUrl\": {\n \"S\": \"${cloudfront.output.domainName.apply(\n value => `https://${value}`\n )}\"\n }\n }\n }\n }`\n }\n });\n\n return {\n ...bucket,\n cloudfront\n };\n }\n });\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAqCO,MAAMA,oBAAoB,GAAIC,gBAAD,IAAkD;EAClF,OAAO,IAAAC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Ac,EAAEC,MAAM,CAACC,OAAO,CAACC,GAAR,CAAY,qBAAZ,CAAD,CAFb;QAGTC,cAAc,EAAEH,MAAM,CAACC,OAAO,CAACC,GAAR,CAAY,YAAZ,CAAD;MAHb,CAAb;MAMA;AACZ;AACA;;MACY9D,GAAG,CAACc,WAAJ,CAAgBC,GAAG,CAACiD,QAAJ,CAAaC,SAA7B,EAAwC;QACpCtE,IAAI,EAAE,eAD8B;QAEpCG,MAAM,EAAE;UACJoE,SAAS,EAAE5D,IAAI,CAAC6D,wBADZ;UAEJC,OAAO,EAAE9D,IAAI,CAAC+D,2BAFV;UAGJC,QAAQ,EAAE7D,MAAM,CACXyC,MADK,CACE5C,IAAI,CAACiE,4BADP,EAELhB,KAFK,CAECiB,GAAG,IAAIA,GAAG,IAAI,IAFf,CAHN;UAMJC,IAAI,EAAEhE,MAAM,CAACiE,WAAY;AAC7C;AACA,yCAAyC1E,GAAG,CAAC2E,MAAJ,CAAWC,GAAX,CAAeC,OAAf,IAA0B,SAAU;AAC7E;AACA;AACA;AACA,wCAAwChE,UAAU,CAACqC,MAAX,CAAkBG,UAAlB,CAA6BE,KAA7B,CACJC,KAAK,IAAK,WAAUA,KAAM,EADtB,CAEN;AAClC;AACA;AACA;AACA;QAlBwB;MAF4B,CAAxC;MAwBA,mEACO7C,MADP;QAEIE;MAFJ;IAIH;EApHkB,CAAhB,CAAP;AAsHH,CAvHM"}
|
|
1
|
+
{"version":3,"names":["createReactPulumiApp","projectAppParams","createPulumiApp","name","path","folder","config","program","app","pulumiResourceNamePrefix","getParam","onResource","resource","startsWith","core","addModule","CoreOutput","pulumi","addHandler","bucket","createPrivateAppBucket","cloudfront","addResource","aws","Distribution","enabled","waitForDeployment","origins","origin","defaultRootObject","defaultCacheBehavior","compress","targetOriginId","originId","viewerProtocolPolicy","allowedMethods","cachedMethods","forwardedValues","cookies","forward","queryString","minTtl","defaultTtl","maxTtl","priceClass","customErrorResponses","errorCode","responseCode","responsePagePath","restrictions","geoRestriction","restrictionType","viewerCertificate","cloudfrontDefaultCertificate","domains","applyCustomDomain","addOutput","output","id","addDomainsUrlsOutputs","cloudfrontDistribution","map","distributionDomain","distributionUrl","usedDomain","usedUrl","tagResources","WbyAppName","WbyProjectName","String","process","env","WbyEnvironment","dynamodb","TableItem","tableName","primaryDynamodbTableName","hashKey","primaryDynamodbTableHashKey","rangeKey","primaryDynamodbTableRangeKey","apply","key","item","interpolate","params","run","variant","domainName","value"],"sources":["createReactPulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\n\nimport { createPulumiApp, PulumiAppParam, PulumiAppParamCallback } from \"@webiny/pulumi\";\nimport { addDomainsUrlsOutputs, tagResources } from \"~/utils\";\nimport { createPrivateAppBucket } from \"../createAppBucket\";\nimport { applyCustomDomain, CustomDomainParams } from \"../customDomain\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { CoreOutput } from \"../common/CoreOutput\";\n\nexport type ReactPulumiApp = ReturnType<typeof createReactPulumiApp>;\n\nexport interface CreateReactPulumiAppParams {\n /**\n * A name of the app, e.g., \"user-area\"\n */\n name: string;\n\n /**\n * A folder where the app is located, e.g., \"apps/user-area\"\n */\n folder: string;\n\n /** Custom domain configuration */\n domains?: PulumiAppParamCallback<CustomDomainParams>;\n\n /**\n * Provides a way to adjust existing Pulumi code (cloud infrastructure resources)\n * or add additional ones into the mix.\n */\n pulumi?: (app: ReactPulumiApp) => void | Promise<void>;\n\n /**\n * Prefixes names of all Pulumi cloud infrastructure resource with given prefix.\n */\n pulumiResourceNamePrefix?: PulumiAppParam<string>;\n\n /**\n * Treats provided environments as production environments, which\n * are deployed in production deployment mode.\n * https://www.webiny.com/docs/architecture/deployment-modes/production\n */\n productionEnvironments?: PulumiAppParam<string[]>;\n}\n\nexport const createReactPulumiApp = (projectAppParams: CreateReactPulumiAppParams) => {\n return createPulumiApp({\n name: projectAppParams.name,\n path: projectAppParams.folder,\n config: projectAppParams,\n program: async app => {\n const pulumiResourceNamePrefix = app.getParam(\n projectAppParams.pulumiResourceNamePrefix\n );\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n const { name } = projectAppParams;\n\n // Register core output as a module available for all other modules\n const core = app.addModule(CoreOutput);\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n if (projectAppParams.pulumi) {\n app.addHandler(() => {\n return projectAppParams.pulumi!(app as ReactPulumiApp);\n });\n }\n\n const bucket = createPrivateAppBucket(app, `${name}-app`);\n\n const cloudfront = app.addResource(aws.cloudfront.Distribution, {\n name: `${name}-app-cdn`,\n config: {\n enabled: true,\n waitForDeployment: false,\n origins: [bucket.origin],\n defaultRootObject: \"index.html\",\n defaultCacheBehavior: {\n compress: true,\n targetOriginId: bucket.origin.originId,\n viewerProtocolPolicy: \"redirect-to-https\",\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: { forward: \"none\" },\n queryString: false\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 600,\n maxTtl: 600\n },\n priceClass: \"PriceClass_100\",\n customErrorResponses: [\n { errorCode: 404, responseCode: 404, responsePagePath: \"/index.html\" }\n ],\n restrictions: {\n geoRestriction: {\n restrictionType: \"none\"\n }\n },\n viewerCertificate: {\n cloudfrontDefaultCertificate: true\n }\n }\n });\n\n const domains = app.getParam(projectAppParams.domains);\n if (domains) {\n applyCustomDomain(cloudfront, domains);\n }\n\n app.addOutput(\"appStorage\", bucket.bucket.output.id);\n\n addDomainsUrlsOutputs({\n app,\n cloudfrontDistribution: cloudfront,\n map: {\n distributionDomain: \"cloudfrontAppDomain\",\n distributionUrl: \"cloudfrontAppUrl\",\n usedDomain: \"appDomain\",\n usedUrl: \"appUrl\"\n }\n });\n\n tagResources({\n WbyAppName: name,\n WbyProjectName: String(process.env[\"WEBINY_PROJECT_NAME\"]),\n WbyEnvironment: String(process.env[\"WEBINY_ENV\"])\n });\n\n /**\n * We need to store the appUrl to the admin settings item in the dynamodb\n */\n app.addResource(aws.dynamodb.TableItem, {\n name: \"adminSettings\",\n config: {\n tableName: core.primaryDynamodbTableName,\n hashKey: core.primaryDynamodbTableHashKey,\n rangeKey: pulumi\n .output(core.primaryDynamodbTableRangeKey)\n .apply(key => key || \"SK\"),\n item: pulumi.interpolate`{\n \"PK\": {\"S\": \"ADMIN#SETTINGS\"},\n \"SK\": {\"S\": \"${app.params.run.variant || \"default\"}\"},\n \"data\": {\n \"M\": {\n \"appUrl\": {\n \"S\": \"${cloudfront.output.domainName.apply(\n value => `https://${value}`\n )}\"\n }\n }\n }\n }`\n }\n });\n\n return {\n ...bucket,\n cloudfront\n };\n }\n });\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAqCO,MAAMA,oBAAoB,GAAIC,gBAAD,IAAkD;EAClF,OAAO,IAAAC,uBAAA,EAAgB;IACnBC,IAAI,EAAEF,gBAAgB,CAACE,IADJ;IAEnBC,IAAI,EAAEH,gBAAgB,CAACI,MAFJ;IAGnBC,MAAM,EAAEL,gBAHW;IAInBM,OAAO,EAAE,MAAMC,GAAN,IAAa;MAClB,MAAMC,wBAAwB,GAAGD,GAAG,CAACE,QAAJ,CAC7BT,gBAAgB,CAACQ,wBADY,CAAjC;;MAGA,IAAIA,wBAAJ,EAA8B;QAC1BD,GAAG,CAACG,UAAJ,CAAeC,QAAQ,IAAI;UACvB,IAAI,CAACA,QAAQ,CAACT,IAAT,CAAcU,UAAd,CAAyBJ,wBAAzB,CAAL,EAAyD;YACrDG,QAAQ,CAACT,IAAT,GAAiB,GAAEM,wBAAyB,GAAEG,QAAQ,CAACT,IAAK,EAA5D;UACH;QACJ,CAJD;MAKH;;MAED,MAAM;QAAEA;M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AI,EAAElE,MAAM,CAACmE,WAAY;AAC7C;AACA,yCAAyC5E,GAAG,CAAC6E,MAAJ,CAAWC,GAAX,CAAeC,OAAf,IAA0B,SAAU;AAC7E;AACA;AACA;AACA,wCAAwClE,UAAU,CAACoC,MAAX,CAAkB+B,UAAlB,CAA6BP,KAA7B,CACJQ,KAAK,IAAK,WAAUA,KAAM,EADtB,CAEN;AAClC;AACA;AACA;AACA;QAlBwB;MAF4B,CAAxC;MAwBA,mEACOtE,MADP;QAEIE;MAFJ;IAIH;EA3HkB,CAAhB,CAAP;AA6HH,CA9HM"}
|
|
@@ -59,7 +59,11 @@ export declare const createWebsitePulumiApp: (projectAppParams?: CreateWebsitePu
|
|
|
59
59
|
};
|
|
60
60
|
settings: {
|
|
61
61
|
tableItem: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/dynamodb/tableItem").TableItem>;
|
|
62
|
-
};
|
|
62
|
+
}; /**
|
|
63
|
+
* Treats provided environments as production environments, which
|
|
64
|
+
* are deployed in production deployment mode.
|
|
65
|
+
* https://www.webiny.com/docs/architecture/deployment-modes/production
|
|
66
|
+
*/
|
|
63
67
|
};
|
|
64
68
|
app: {
|
|
65
69
|
cloudfront: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/distribution").Distribution>;
|
|
@@ -216,15 +216,31 @@ const createWebsitePulumiApp = (projectAppParams = {}) => {
|
|
|
216
216
|
// The files that are generated in that process are stored in the `deliveryStorage` S3 bucket further below.
|
|
217
217
|
appId: appCloudfront.output.id,
|
|
218
218
|
appStorage: appBucket.bucket.output.id,
|
|
219
|
-
appUrl: appCloudfront.output.domainName.apply(value => `https://${value}`),
|
|
220
|
-
appDomain: appCloudfront.output.domainName,
|
|
221
219
|
// These are the Cloudfront and S3 bucket that will deliver static pages to the actual website visitors.
|
|
222
220
|
// The static HTML snapshots delivered from them still rely on the app's S3 bucket
|
|
223
221
|
// defined above, for serving static assets (JS, CSS, images).
|
|
224
222
|
deliveryId: deliveryCloudfront.output.id,
|
|
225
|
-
deliveryStorage: deliveryBucket.bucket.output.id
|
|
226
|
-
|
|
227
|
-
|
|
223
|
+
deliveryStorage: deliveryBucket.bucket.output.id
|
|
224
|
+
});
|
|
225
|
+
(0, _utils.addDomainsUrlsOutputs)({
|
|
226
|
+
app,
|
|
227
|
+
cloudfrontDistribution: appCloudfront,
|
|
228
|
+
map: {
|
|
229
|
+
distributionDomain: "cloudfrontAppDomain",
|
|
230
|
+
distributionUrl: "cloudfrontAppUrl",
|
|
231
|
+
usedDomain: "appDomain",
|
|
232
|
+
usedUrl: "appUrl"
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
(0, _utils.addDomainsUrlsOutputs)({
|
|
236
|
+
app,
|
|
237
|
+
cloudfrontDistribution: deliveryCloudfront,
|
|
238
|
+
map: {
|
|
239
|
+
distributionDomain: "cloudfrontDeliveryDomain",
|
|
240
|
+
distributionUrl: "cloudfrontDeliveryUrl",
|
|
241
|
+
usedDomain: "deliveryDomain",
|
|
242
|
+
usedUrl: "deliveryUrl"
|
|
243
|
+
}
|
|
228
244
|
});
|
|
229
245
|
(0, _utils.tagResources)({
|
|
230
246
|
WbyProjectName: String(process.env["WEBINY_PROJECT_NAME"]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createWebsitePulumiApp","projectAppParams","app","createPulumiApp","name","path","config","program","pulumiResourceNamePrefix","getParam","onResource","resource","startsWith","pulumi","addHandler","productionEnvironments","params","create","isProduction","includes","run","env","core","addModule","CoreOutput","vpcEnabled","vpc","VpcConfig","enabled","appBucket","createPrivateAppBucket","appCloudfront","addResource","aws","cloudfront","Distribution","waitForDeployment","origins","origin","defaultRootObject","defaultCacheBehavior","compress","targetOriginId","originId","viewerProtocolPolicy","allowedMethods","cachedMethods","forwardedValues","cookies","forward","queryString","minTtl","defaultTtl","maxTtl","priceClass","customErrorResponses","errorCode","responseCode","responsePagePath","restrictions","geoRestriction","restrictionType","viewerCertificate","cloudfrontDefaultCertificate","deliveryBucket","viewerRequest","Function","runtime","publish","code","fs","readFileSync","__dirname","deliveryCloudfront","originRequestPolicyId","functionAssociations","functionArn","output","arn","eventType","orderedCacheBehaviors","headers","pathPattern","prerendering","createPrerenderingService","dbTableName","primaryDynamodbTableName","dbTableHashKey","primaryDynamodbTableHashKey","dbTableRangeKey","primaryDynamodbTableRangeKey","appUrl","interpolate","domainName","deliveryUrl","bucket","cloudfrontId","id","domains","applyCustomDomain","previewDomains","process","WCP_PROJECT_ENVIRONMENT","WEBINY_MULTI_TENANCY","applyTenantRouter","addOutputs","appId","appStorage","apply","value","appDomain","deliveryId","deliveryStorage","deliveryDomain","tagResources","WbyProjectName","String","WbyEnvironment","delivery","withCommonLambdaEnvVariables"],"sources":["createWebsitePulumiApp.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport fs from \"fs\";\nimport { createPulumiApp, PulumiAppParamCallback, PulumiAppParam } from \"@webiny/pulumi\";\nimport { createPrivateAppBucket } from \"../createAppBucket\";\nimport { applyCustomDomain, CustomDomainParams } from \"../customDomain\";\nimport { createPrerenderingService } from \"./WebsitePrerendering\";\nimport { CoreOutput, VpcConfig } from \"~/apps\";\nimport { tagResources, withCommonLambdaEnvVariables } from \"~/utils\";\nimport { applyTenantRouter } from \"~/apps/tenantRouter\";\n\nexport type WebsitePulumiApp = ReturnType<typeof createWebsitePulumiApp>;\n\nexport interface CreateWebsitePulumiAppParams {\n /**\n * Custom domain(s) configuration.\n */\n domains?: PulumiAppParamCallback<CustomDomainParams>;\n\n /**\n * Custom preview domain(s) configuration.\n */\n previewDomains?: PulumiAppParamCallback<CustomDomainParams>;\n\n /**\n * Enables or disables VPC for the API.\n * For VPC to work you also have to enable it in the `core` application.\n */\n vpc?: PulumiAppParam<boolean | undefined>;\n\n /**\n * Provides a way to adjust existing Pulumi code (cloud infrastructure resources)\n * or add additional ones into the mix.\n */\n pulumi?: (app: WebsitePulumiApp) => void | Promise<void>;\n\n /**\n * Prefixes names of all Pulumi cloud infrastructure resource with given prefix.\n */\n pulumiResourceNamePrefix?: PulumiAppParam<string>;\n\n /**\n * Treats provided environments as production environments, which\n * are deployed in production deployment mode.\n * https://www.webiny.com/docs/architecture/deployment-modes/production\n */\n productionEnvironments?: PulumiAppParam<string[]>;\n}\n\nexport const createWebsitePulumiApp = (projectAppParams: CreateWebsitePulumiAppParams = {}) => {\n const app = createPulumiApp({\n name: \"website\",\n path: \"apps/website\",\n config: projectAppParams,\n program: async app => {\n const pulumiResourceNamePrefix = app.getParam(\n projectAppParams.pulumiResourceNamePrefix\n );\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n if (projectAppParams.pulumi) {\n app.addHandler(() => {\n return projectAppParams.pulumi!(app as WebsitePulumiApp);\n });\n }\n\n const productionEnvironments = app.params.create.productionEnvironments || [\"prod\"];\n const isProduction = productionEnvironments.includes(app.params.run.env);\n\n // Register core output as a module available for all other modules\n const core = app.addModule(CoreOutput);\n\n // Register VPC config module to be available to other modules.\n const vpcEnabled = app.getParam(projectAppParams?.vpc) ?? isProduction;\n app.addModule(VpcConfig, { enabled: vpcEnabled });\n\n const appBucket = createPrivateAppBucket(app, \"app\");\n\n const appCloudfront = app.addResource(aws.cloudfront.Distribution, {\n name: \"app\",\n config: {\n enabled: true,\n waitForDeployment: true,\n origins: [appBucket.origin],\n defaultRootObject: \"index.html\",\n defaultCacheBehavior: {\n compress: true,\n targetOriginId: appBucket.origin.originId,\n viewerProtocolPolicy: \"redirect-to-https\",\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: { forward: \"none\" },\n queryString: false\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 0,\n maxTtl: 0\n },\n priceClass: \"PriceClass_100\",\n customErrorResponses: [\n { errorCode: 404, responseCode: 404, responsePagePath: \"/index.html\" }\n ],\n restrictions: {\n geoRestriction: {\n restrictionType: \"none\"\n }\n },\n viewerCertificate: {\n cloudfrontDefaultCertificate: true\n }\n }\n });\n\n const deliveryBucket = createPrivateAppBucket(app, \"delivery\");\n\n /**\n * We need to have a Cloudfront Function to perform a simple request rewrite, so the request always includes\n * an \"/index.html\". This is necessary because our buckets are not \"website\" buckets, and we need to\n * have an exact object key when requesting page paths.\n */\n const viewerRequest = app.addResource(aws.cloudfront.Function, {\n name: \"cfViewerRequest\",\n config: {\n runtime: \"cloudfront-js-1.0\",\n publish: true,\n code: fs.readFileSync(__dirname + `/deliveryViewerRequest.js`, \"utf8\")\n }\n });\n\n const deliveryCloudfront = app.addResource(aws.cloudfront.Distribution, {\n name: \"delivery\",\n config: {\n enabled: true,\n waitForDeployment: true,\n origins: [deliveryBucket.origin, appBucket.origin],\n defaultRootObject: \"index.html\",\n defaultCacheBehavior: {\n compress: true,\n targetOriginId: deliveryBucket.origin.originId,\n viewerProtocolPolicy: \"redirect-to-https\",\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n originRequestPolicyId: \"\",\n forwardedValues: {\n cookies: { forward: \"none\" },\n queryString: true\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 30,\n maxTtl: 30,\n functionAssociations: [\n { functionArn: viewerRequest.output.arn, eventType: \"viewer-request\" }\n ]\n },\n orderedCacheBehaviors: [\n {\n compress: true,\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: {\n forward: \"none\"\n },\n headers: [],\n queryString: false\n },\n pathPattern: \"/static/*\",\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: appBucket.origin.originId,\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 2592000, // 30 days\n maxTtl: 2592000\n }\n ],\n customErrorResponses: [\n {\n errorCode: 404,\n responseCode: 404,\n responsePagePath: \"/_NOT_FOUND_PAGE_/index.html\"\n }\n ],\n priceClass: \"PriceClass_100\",\n restrictions: {\n geoRestriction: {\n restrictionType: \"none\"\n }\n },\n viewerCertificate: {\n cloudfrontDefaultCertificate: true\n }\n }\n });\n\n const prerendering = createPrerenderingService(app, {\n dbTableName: core.primaryDynamodbTableName,\n dbTableHashKey: core.primaryDynamodbTableHashKey,\n dbTableRangeKey: core.primaryDynamodbTableRangeKey,\n appUrl: pulumi.interpolate`https://${appCloudfront.output.domainName}`,\n deliveryUrl: pulumi.interpolate`https://${deliveryCloudfront.output.domainName}`,\n bucket: deliveryBucket.bucket.output.bucket,\n cloudfrontId: deliveryCloudfront.output.id\n });\n\n const domains = app.getParam(projectAppParams.domains);\n if (domains) {\n applyCustomDomain(deliveryCloudfront, domains);\n }\n\n const previewDomains = app.getParam(projectAppParams.previewDomains);\n if (previewDomains) {\n applyCustomDomain(appCloudfront, previewDomains);\n }\n\n if (\n process.env.WCP_PROJECT_ENVIRONMENT ||\n process.env.WEBINY_MULTI_TENANCY === \"true\"\n ) {\n applyTenantRouter(app, deliveryCloudfront);\n }\n\n app.addOutputs({\n // Cloudfront and S3 bucket used to host the single-page application (SPA). The URL of the distribution is mainly\n // utilized by the Page Builder app's prerendering engine. Using this URL, it accesses the SPA and creates HTML snapshots.\n // The files that are generated in that process are stored in the `deliveryStorage` S3 bucket further below.\n appId: appCloudfront.output.id,\n appStorage: appBucket.bucket.output.id,\n appUrl: appCloudfront.output.domainName.apply(value => `https://${value}`),\n appDomain: appCloudfront.output.domainName,\n // These are the Cloudfront and S3 bucket that will deliver static pages to the actual website visitors.\n // The static HTML snapshots delivered from them still rely on the app's S3 bucket\n // defined above, for serving static assets (JS, CSS, images).\n deliveryId: deliveryCloudfront.output.id,\n deliveryStorage: deliveryBucket.bucket.output.id,\n deliveryDomain: deliveryCloudfront.output.domainName,\n deliveryUrl: deliveryCloudfront.output.domainName.apply(value => `https://${value}`)\n });\n\n tagResources({\n WbyProjectName: String(process.env[\"WEBINY_PROJECT_NAME\"]),\n WbyEnvironment: String(process.env[\"WEBINY_ENV\"])\n });\n\n return {\n prerendering,\n app: {\n ...appBucket,\n cloudfront: appCloudfront\n },\n delivery: {\n ...deliveryBucket,\n cloudfront: deliveryCloudfront\n }\n };\n }\n });\n\n return withCommonLambdaEnvVariables(app);\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAwCO,MAAMA,sBAAsB,GAAG,CAACC,gBAA8C,GAAG,EAAlD,KAAyD;EAC3F,MAAMC,GAAG,GAAG,IAAAC,wBAAA,EAAgB;IACxBC,IAAI,EAAE,SADkB;IAExBC,IAAI,EAAE,cAFkB;IAGxBC,MAAM,EAAEL,gBAHgB;IAIxBM,OAAO,EAAE,MAAML,GAAN,IAAa;MAClB,MAAMM,wBAAwB,GAAGN,GAAG,CAACO,QAAJ,CAC7BR,gBAAgB,CAACO,wBADY,CAAjC;;MAGA,IAAIA,wBAAJ,EAA8B;QAC1BN,GAAG,CAACQ,UAAJ,CAAeC,QAAQ,IAAI;UACvB,IAAI,CAACA,QAAQ,CAACP,IAAT,CAAcQ,UAAd,CAAyBJ,wBAAzB,CAAL,EAAyD;YACrDG,QAAQ,CAACP,IAAT,GAAiB,GAAEI,wBAAyB,GAAEG,QAAQ,CAACP,IAAK,EAA5D;UACH;QACJ,CAJD;MAKH,CAViB,CAYlB;MACA;;;MACA,IAAIH,gBAAgB,CAACY,MAArB,EAA6B;QACzBX,GAAG,CAACY,UAAJ,CAAe,MAAM;UACjB,OAAOb,gBAAgB,CAACY,MAAjB,CAAyBX,GAAzB,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QACAC,KAAK,EAAE3E,aAAa,CAAC8C,MAAd,CAAqBoB,EAJjB;QAKXU,UAAU,EAAE9E,SAAS,CAACkE,MAAV,CAAiBlB,MAAjB,CAAwBoB,EALzB;QAMXN,MAAM,EAAE5D,aAAa,CAAC8C,MAAd,CAAqBgB,UAArB,CAAgCe,KAAhC,CAAsCC,KAAK,IAAK,WAAUA,KAAM,EAAhE,CANG;QAOXC,SAAS,EAAE/E,aAAa,CAAC8C,MAAd,CAAqBgB,UAPrB;QAQX;QACA;QACA;QACAkB,UAAU,EAAEtC,kBAAkB,CAACI,MAAnB,CAA0BoB,EAX3B;QAYXe,eAAe,EAAEhD,cAAc,CAAC+B,MAAf,CAAsBlB,MAAtB,CAA6BoB,EAZnC;QAaXgB,cAAc,EAAExC,kBAAkB,CAACI,MAAnB,CAA0BgB,UAb/B;QAcXC,WAAW,EAAErB,kBAAkB,CAACI,MAAnB,CAA0BgB,UAA1B,CAAqCe,KAArC,CAA2CC,KAAK,IAAK,WAAUA,KAAM,EAArE;MAdF,CAAf;MAiBA,IAAAK,mBAAA,EAAa;QACTC,cAAc,EAAEC,MAAM,CAACf,OAAO,CAAChF,GAAR,CAAY,qBAAZ,CAAD,CADb;QAETgG,cAAc,EAAED,MAAM,CAACf,OAAO,CAAChF,GAAR,CAAY,YAAZ,CAAD;MAFb,CAAb;MAKA,OAAO;QACH8D,YADG;QAEHjF,GAAG,8DACI2B,SADJ;UAECK,UAAU,EAAEH;QAFb,EAFA;QAMHuF,QAAQ,8DACDtD,cADC;UAEJ9B,UAAU,EAAEuC;QAFR;MANL,CAAP;IAWH;EAvNuB,CAAhB,CAAZ;EA0NA,OAAO,IAAA8C,mCAAA,EAA6BrH,GAA7B,CAAP;AACH,CA5NM"}
|
|
1
|
+
{"version":3,"names":["createWebsitePulumiApp","projectAppParams","app","createPulumiApp","name","path","config","program","pulumiResourceNamePrefix","getParam","onResource","resource","startsWith","pulumi","addHandler","productionEnvironments","params","create","isProduction","includes","run","env","core","addModule","CoreOutput","vpcEnabled","vpc","VpcConfig","enabled","appBucket","createPrivateAppBucket","appCloudfront","addResource","aws","cloudfront","Distribution","waitForDeployment","origins","origin","defaultRootObject","defaultCacheBehavior","compress","targetOriginId","originId","viewerProtocolPolicy","allowedMethods","cachedMethods","forwardedValues","cookies","forward","queryString","minTtl","defaultTtl","maxTtl","priceClass","customErrorResponses","errorCode","responseCode","responsePagePath","restrictions","geoRestriction","restrictionType","viewerCertificate","cloudfrontDefaultCertificate","deliveryBucket","viewerRequest","Function","runtime","publish","code","fs","readFileSync","__dirname","deliveryCloudfront","originRequestPolicyId","functionAssociations","functionArn","output","arn","eventType","orderedCacheBehaviors","headers","pathPattern","prerendering","createPrerenderingService","dbTableName","primaryDynamodbTableName","dbTableHashKey","primaryDynamodbTableHashKey","dbTableRangeKey","primaryDynamodbTableRangeKey","appUrl","interpolate","domainName","deliveryUrl","bucket","cloudfrontId","id","domains","applyCustomDomain","previewDomains","process","WCP_PROJECT_ENVIRONMENT","WEBINY_MULTI_TENANCY","applyTenantRouter","addOutputs","appId","appStorage","deliveryId","deliveryStorage","addDomainsUrlsOutputs","cloudfrontDistribution","map","distributionDomain","distributionUrl","usedDomain","usedUrl","tagResources","WbyProjectName","String","WbyEnvironment","delivery","withCommonLambdaEnvVariables"],"sources":["createWebsitePulumiApp.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport fs from \"fs\";\nimport { createPulumiApp, PulumiAppParamCallback, PulumiAppParam } from \"@webiny/pulumi\";\nimport { createPrivateAppBucket } from \"../createAppBucket\";\nimport { applyCustomDomain, CustomDomainParams } from \"../customDomain\";\nimport { createPrerenderingService } from \"./WebsitePrerendering\";\nimport { CoreOutput, VpcConfig } from \"~/apps\";\nimport { addDomainsUrlsOutputs, tagResources, withCommonLambdaEnvVariables } from \"~/utils\";\nimport { applyTenantRouter } from \"~/apps/tenantRouter\";\n\nexport type WebsitePulumiApp = ReturnType<typeof createWebsitePulumiApp>;\n\nexport interface CreateWebsitePulumiAppParams {\n /**\n * Custom domain(s) configuration.\n */\n domains?: PulumiAppParamCallback<CustomDomainParams>;\n\n /**\n * Custom preview domain(s) configuration.\n */\n previewDomains?: PulumiAppParamCallback<CustomDomainParams>;\n\n /**\n * Enables or disables VPC for the API.\n * For VPC to work you also have to enable it in the `core` application.\n */\n vpc?: PulumiAppParam<boolean | undefined>;\n\n /**\n * Provides a way to adjust existing Pulumi code (cloud infrastructure resources)\n * or add additional ones into the mix.\n */\n pulumi?: (app: WebsitePulumiApp) => void | Promise<void>;\n\n /**\n * Prefixes names of all Pulumi cloud infrastructure resource with given prefix.\n */\n pulumiResourceNamePrefix?: PulumiAppParam<string>;\n\n /**\n * Treats provided environments as production environments, which\n * are deployed in production deployment mode.\n * https://www.webiny.com/docs/architecture/deployment-modes/production\n */\n productionEnvironments?: PulumiAppParam<string[]>;\n}\n\nexport const createWebsitePulumiApp = (projectAppParams: CreateWebsitePulumiAppParams = {}) => {\n const app = createPulumiApp({\n name: \"website\",\n path: \"apps/website\",\n config: projectAppParams,\n program: async app => {\n const pulumiResourceNamePrefix = app.getParam(\n projectAppParams.pulumiResourceNamePrefix\n );\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n if (projectAppParams.pulumi) {\n app.addHandler(() => {\n return projectAppParams.pulumi!(app as WebsitePulumiApp);\n });\n }\n\n const productionEnvironments = app.params.create.productionEnvironments || [\"prod\"];\n const isProduction = productionEnvironments.includes(app.params.run.env);\n\n // Register core output as a module available for all other modules\n const core = app.addModule(CoreOutput);\n\n // Register VPC config module to be available to other modules.\n const vpcEnabled = app.getParam(projectAppParams?.vpc) ?? isProduction;\n app.addModule(VpcConfig, { enabled: vpcEnabled });\n\n const appBucket = createPrivateAppBucket(app, \"app\");\n\n const appCloudfront = app.addResource(aws.cloudfront.Distribution, {\n name: \"app\",\n config: {\n enabled: true,\n waitForDeployment: true,\n origins: [appBucket.origin],\n defaultRootObject: \"index.html\",\n defaultCacheBehavior: {\n compress: true,\n targetOriginId: appBucket.origin.originId,\n viewerProtocolPolicy: \"redirect-to-https\",\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: { forward: \"none\" },\n queryString: false\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 0,\n maxTtl: 0\n },\n priceClass: \"PriceClass_100\",\n customErrorResponses: [\n { errorCode: 404, responseCode: 404, responsePagePath: \"/index.html\" }\n ],\n restrictions: {\n geoRestriction: {\n restrictionType: \"none\"\n }\n },\n viewerCertificate: {\n cloudfrontDefaultCertificate: true\n }\n }\n });\n\n const deliveryBucket = createPrivateAppBucket(app, \"delivery\");\n\n /**\n * We need to have a Cloudfront Function to perform a simple request rewrite, so the request always includes\n * an \"/index.html\". This is necessary because our buckets are not \"website\" buckets, and we need to\n * have an exact object key when requesting page paths.\n */\n const viewerRequest = app.addResource(aws.cloudfront.Function, {\n name: \"cfViewerRequest\",\n config: {\n runtime: \"cloudfront-js-1.0\",\n publish: true,\n code: fs.readFileSync(__dirname + `/deliveryViewerRequest.js`, \"utf8\")\n }\n });\n\n const deliveryCloudfront = app.addResource(aws.cloudfront.Distribution, {\n name: \"delivery\",\n config: {\n enabled: true,\n waitForDeployment: true,\n origins: [deliveryBucket.origin, appBucket.origin],\n defaultRootObject: \"index.html\",\n defaultCacheBehavior: {\n compress: true,\n targetOriginId: deliveryBucket.origin.originId,\n viewerProtocolPolicy: \"redirect-to-https\",\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n originRequestPolicyId: \"\",\n forwardedValues: {\n cookies: { forward: \"none\" },\n queryString: true\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 30,\n maxTtl: 30,\n functionAssociations: [\n { functionArn: viewerRequest.output.arn, eventType: \"viewer-request\" }\n ]\n },\n orderedCacheBehaviors: [\n {\n compress: true,\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: {\n forward: \"none\"\n },\n headers: [],\n queryString: false\n },\n pathPattern: \"/static/*\",\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: appBucket.origin.originId,\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 2592000, // 30 days\n maxTtl: 2592000\n }\n ],\n customErrorResponses: [\n {\n errorCode: 404,\n responseCode: 404,\n responsePagePath: \"/_NOT_FOUND_PAGE_/index.html\"\n }\n ],\n priceClass: \"PriceClass_100\",\n restrictions: {\n geoRestriction: {\n restrictionType: \"none\"\n }\n },\n viewerCertificate: {\n cloudfrontDefaultCertificate: true\n }\n }\n });\n\n const prerendering = createPrerenderingService(app, {\n dbTableName: core.primaryDynamodbTableName,\n dbTableHashKey: core.primaryDynamodbTableHashKey,\n dbTableRangeKey: core.primaryDynamodbTableRangeKey,\n appUrl: pulumi.interpolate`https://${appCloudfront.output.domainName}`,\n deliveryUrl: pulumi.interpolate`https://${deliveryCloudfront.output.domainName}`,\n bucket: deliveryBucket.bucket.output.bucket,\n cloudfrontId: deliveryCloudfront.output.id\n });\n\n const domains = app.getParam(projectAppParams.domains);\n if (domains) {\n applyCustomDomain(deliveryCloudfront, domains);\n }\n\n const previewDomains = app.getParam(projectAppParams.previewDomains);\n if (previewDomains) {\n applyCustomDomain(appCloudfront, previewDomains);\n }\n\n if (\n process.env.WCP_PROJECT_ENVIRONMENT ||\n process.env.WEBINY_MULTI_TENANCY === \"true\"\n ) {\n applyTenantRouter(app, deliveryCloudfront);\n }\n\n app.addOutputs({\n // Cloudfront and S3 bucket used to host the single-page application (SPA). The URL of the distribution is mainly\n // utilized by the Page Builder app's prerendering engine. Using this URL, it accesses the SPA and creates HTML snapshots.\n // The files that are generated in that process are stored in the `deliveryStorage` S3 bucket further below.\n appId: appCloudfront.output.id,\n appStorage: appBucket.bucket.output.id,\n\n // These are the Cloudfront and S3 bucket that will deliver static pages to the actual website visitors.\n // The static HTML snapshots delivered from them still rely on the app's S3 bucket\n // defined above, for serving static assets (JS, CSS, images).\n deliveryId: deliveryCloudfront.output.id,\n deliveryStorage: deliveryBucket.bucket.output.id\n });\n\n addDomainsUrlsOutputs({\n app,\n cloudfrontDistribution: appCloudfront,\n map: {\n distributionDomain: \"cloudfrontAppDomain\",\n distributionUrl: \"cloudfrontAppUrl\",\n usedDomain: \"appDomain\",\n usedUrl: \"appUrl\"\n }\n });\n\n addDomainsUrlsOutputs({\n app,\n cloudfrontDistribution: deliveryCloudfront,\n map: {\n distributionDomain: \"cloudfrontDeliveryDomain\",\n distributionUrl: \"cloudfrontDeliveryUrl\",\n usedDomain: \"deliveryDomain\",\n usedUrl: \"deliveryUrl\"\n }\n });\n\n tagResources({\n WbyProjectName: String(process.env[\"WEBINY_PROJECT_NAME\"]),\n WbyEnvironment: String(process.env[\"WEBINY_ENV\"])\n });\n\n return {\n prerendering,\n app: {\n ...appBucket,\n cloudfront: appCloudfront\n },\n delivery: {\n ...deliveryBucket,\n cloudfront: deliveryCloudfront\n }\n };\n }\n });\n\n return withCommonLambdaEnvVariables(app);\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAwCO,MAAMA,sBAAsB,GAAG,CAACC,gBAA8C,GAAG,EAAlD,KAAyD;EAC3F,MAAMC,GAAG,GAAG,IAAAC,wBAAA,EAAgB;IACxBC,IAAI,EAAE,SADkB;IAExBC,IAAI,EAAE,cAFkB;IAGxBC,MAAM,EAAEL,gBA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OAAO,EAAE;QAJR;MAHa,CAAtB;MAWA,IAAAC,mBAAA,EAAa;QACTC,cAAc,EAAEC,MAAM,CAAClB,OAAO,CAAChF,GAAR,CAAY,qBAAZ,CAAD,CADb;QAETmG,cAAc,EAAED,MAAM,CAAClB,OAAO,CAAChF,GAAR,CAAY,YAAZ,CAAD;MAFb,CAAb;MAKA,OAAO;QACH8D,YADG;QAEHjF,GAAG,8DACI2B,SADJ;UAECK,UAAU,EAAEH;QAFb,EAFA;QAMH0F,QAAQ,8DACDzD,cADC;UAEJ9B,UAAU,EAAEuC;QAFR;MANL,CAAP;IAWH;EA1OuB,CAAhB,CAAZ;EA6OA,OAAO,IAAAiD,mCAAA,EAA6BxH,GAA7B,CAAP;AACH,CA/OM"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as aws from "@pulumi/aws";
|
|
2
2
|
import { CreateApiPulumiAppParams as BaseCreateApiPulumiAppParams } from "../apps/api/createApiPulumiApp";
|
|
3
|
+
import { PulumiAppParam } from "@webiny/pulumi";
|
|
3
4
|
export declare type ApiPulumiApp = ReturnType<typeof createApiPulumiApp>;
|
|
4
5
|
export declare type ApiPulumiAppAdvancedVpcParams = Partial<{
|
|
5
6
|
useExistingVpc: {
|
|
@@ -7,7 +8,7 @@ export declare type ApiPulumiAppAdvancedVpcParams = Partial<{
|
|
|
7
8
|
};
|
|
8
9
|
}>;
|
|
9
10
|
export interface CreateApiPulumiAppParams extends Omit<BaseCreateApiPulumiAppParams, "vpc"> {
|
|
10
|
-
vpc?: boolean | ApiPulumiAppAdvancedVpcParams
|
|
11
|
+
vpc?: PulumiAppParam<boolean | ApiPulumiAppAdvancedVpcParams>;
|
|
11
12
|
}
|
|
12
13
|
export declare function createApiPulumiApp(projectAppParams?: CreateApiPulumiAppParams): import("@webiny/pulumi").PulumiApp<{
|
|
13
14
|
fileManager: {
|
|
@@ -18,19 +18,29 @@ var _createApiPulumiApp = require("../apps/api/createApiPulumiApp");
|
|
|
18
18
|
var _pulumi = require("@webiny/pulumi");
|
|
19
19
|
|
|
20
20
|
function createApiPulumiApp(projectAppParams = {}) {
|
|
21
|
-
const {
|
|
22
|
-
vpc,
|
|
23
|
-
pulumi
|
|
24
|
-
} = projectAppParams;
|
|
25
|
-
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
|
|
26
21
|
return (0, _createApiPulumiApp.createApiPulumiApp)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, projectAppParams), {}, {
|
|
27
22
|
// If using existing VPC, we ensure `vpc` param is set to `false`.
|
|
28
|
-
vpc:
|
|
23
|
+
vpc: ({
|
|
24
|
+
getParam
|
|
25
|
+
}) => {
|
|
26
|
+
const vpc = getParam(projectAppParams.vpc);
|
|
27
|
+
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
|
|
28
|
+
return usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc);
|
|
29
|
+
},
|
|
29
30
|
|
|
30
31
|
pulumi(...args) {
|
|
31
|
-
|
|
32
|
+
var _projectAppParams$pul2;
|
|
33
|
+
|
|
34
|
+
const [{
|
|
35
|
+
getParam
|
|
36
|
+
}] = args;
|
|
37
|
+
const vpc = getParam(projectAppParams.vpc);
|
|
38
|
+
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean"; // Not using advanced VPC params? Then immediately exit.
|
|
39
|
+
|
|
32
40
|
if (!usingAdvancedVpcParams) {
|
|
33
|
-
|
|
41
|
+
var _projectAppParams$pul;
|
|
42
|
+
|
|
43
|
+
return (_projectAppParams$pul = projectAppParams.pulumi) === null || _projectAppParams$pul === void 0 ? void 0 : _projectAppParams$pul.call(projectAppParams, ...args);
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
const [{
|
|
@@ -65,7 +75,7 @@ function createApiPulumiApp(projectAppParams = {}) {
|
|
|
65
75
|
});
|
|
66
76
|
}
|
|
67
77
|
|
|
68
|
-
return pulumi === null ||
|
|
78
|
+
return (_projectAppParams$pul2 = projectAppParams.pulumi) === null || _projectAppParams$pul2 === void 0 ? void 0 : _projectAppParams$pul2.call(projectAppParams, ...args);
|
|
69
79
|
}
|
|
70
80
|
|
|
71
81
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createApiPulumiApp","projectAppParams","
|
|
1
|
+
{"version":3,"names":["createApiPulumiApp","projectAppParams","baseCreateApiPulumiApp","vpc","getParam","usingAdvancedVpcParams","useExistingVpc","Boolean","pulumi","args","onResource","addResource","lambdaFunctionsVpcConfig","Error","resource","isResourceOfType","aws","lambda","Function","config","vpcConfig","iam","Role","meta","isLambdaFunctionRole","RolePolicyAttachment","name","role","output","policyArn","ManagedPolicy","AWSLambdaVPCAccessExecutionRole"],"sources":["createApiPulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport {\n createApiPulumiApp as baseCreateApiPulumiApp,\n CreateApiPulumiAppParams as BaseCreateApiPulumiAppParams\n} from \"~/apps/api/createApiPulumiApp\";\nimport { isResourceOfType, PulumiAppParam } from \"@webiny/pulumi\";\n\nexport type ApiPulumiApp = ReturnType<typeof createApiPulumiApp>;\n\nexport type ApiPulumiAppAdvancedVpcParams = Partial<{\n useExistingVpc: {\n lambdaFunctionsVpcConfig: aws.types.input.lambda.FunctionVpcConfig;\n };\n}>;\n\nexport interface CreateApiPulumiAppParams extends Omit<BaseCreateApiPulumiAppParams, \"vpc\"> {\n vpc?: PulumiAppParam<boolean | ApiPulumiAppAdvancedVpcParams>;\n}\n\nexport function createApiPulumiApp(projectAppParams: CreateApiPulumiAppParams = {}) {\n return baseCreateApiPulumiApp({\n ...projectAppParams,\n // If using existing VPC, we ensure `vpc` param is set to `false`.\n vpc: ({ getParam }) => {\n const vpc = getParam(projectAppParams.vpc);\n const usingAdvancedVpcParams = vpc && typeof vpc !== \"boolean\";\n return usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc);\n },\n pulumi(...args) {\n const [{ getParam }] = args;\n const vpc = getParam(projectAppParams.vpc);\n const usingAdvancedVpcParams = vpc && typeof vpc !== \"boolean\";\n\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return projectAppParams.pulumi?.(...args);\n }\n\n const [{ onResource, addResource }] = args;\n const { useExistingVpc } = vpc;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (!useExistingVpc.lambdaFunctionsVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `lambdaFunctionsVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.lambda.Function)) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n addResource(aws.iam.RolePolicyAttachment, {\n name: `${resource.name}-vpc-access-execution-role`,\n config: {\n role: resource.output.name,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n }\n\n return projectAppParams.pulumi?.(...args);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAIA;;AAcO,SAASA,kBAAT,CAA4BC,gBAA0C,GAAG,EAAzE,EAA6E;EAChF,OAAO,IAAAC,sCAAA,8DACAD,gBADA;IAEH;IACAE,GAAG,EAAE,CAAC;MAAEC;IAAF,CAAD,KAAkB;MACnB,MAAMD,GAAG,GAAGC,QAAQ,CAACH,gBAAgB,CAACE,GAAlB,CAApB;MACA,MAAME,sBAAsB,GAAGF,GAAG,IAAI,OAAOA,GAAP,KAAe,SAArD;MACA,OAAOE,sBAAsB,IAAIF,GAAG,CAACG,cAA9B,GAA+C,KAA/C,GAAuDC,OAAO,CAACJ,GAAD,CAArE;IACH,CAPE;;IAQHK,MAAM,CAAC,GAAGC,IAAJ,EAAU;MAAA;;MACZ,MAAM,CAAC;QAAEL;MAAF,CAAD,IAAiBK,IAAvB;MACA,MAAMN,GAAG,GAAGC,Q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,gBAAgB,EAAU,GAAGQ,IAAb,CAAvB;IACH;;EAjDE,GAAP;AAmDH"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as aws from "@pulumi/aws";
|
|
2
2
|
import { CreateCorePulumiAppParams as BaseCreateCorePulumiAppParams } from "../apps/core/createCorePulumiApp";
|
|
3
|
+
import { PulumiAppParam } from "@webiny/pulumi";
|
|
3
4
|
export declare type CorePulumiApp = ReturnType<typeof createCorePulumiApp>;
|
|
4
5
|
export declare type CorePulumiAppAdvancedVpcParams = Partial<{
|
|
5
6
|
useVpcEndpoints: boolean;
|
|
@@ -9,7 +10,7 @@ export declare type CorePulumiAppAdvancedVpcParams = Partial<{
|
|
|
9
10
|
};
|
|
10
11
|
}>;
|
|
11
12
|
export interface CreateCorePulumiAppParams extends Omit<BaseCreateCorePulumiAppParams, "vpc"> {
|
|
12
|
-
vpc?: boolean | CorePulumiAppAdvancedVpcParams
|
|
13
|
+
vpc?: PulumiAppParam<boolean | CorePulumiAppAdvancedVpcParams>;
|
|
13
14
|
}
|
|
14
15
|
export declare function createCorePulumiApp(projectAppParams?: CreateCorePulumiAppParams): import("@webiny/pulumi").PulumiApp<{
|
|
15
16
|
fileManagerBucket: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucket").Bucket>;
|
|
@@ -18,20 +18,29 @@ var _createCorePulumiApp = require("../apps/core/createCorePulumiApp");
|
|
|
18
18
|
var _pulumi = require("@webiny/pulumi");
|
|
19
19
|
|
|
20
20
|
function createCorePulumiApp(projectAppParams = {}) {
|
|
21
|
-
const {
|
|
22
|
-
vpc,
|
|
23
|
-
elasticSearch,
|
|
24
|
-
pulumi
|
|
25
|
-
} = projectAppParams;
|
|
26
|
-
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
|
|
27
21
|
return (0, _createCorePulumiApp.createCorePulumiApp)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, projectAppParams), {}, {
|
|
28
22
|
// If using existing VPC, we ensure `vpc` param is set to `false`.
|
|
29
|
-
vpc:
|
|
23
|
+
vpc: ({
|
|
24
|
+
getParam
|
|
25
|
+
}) => {
|
|
26
|
+
const vpc = getParam(projectAppParams.vpc);
|
|
27
|
+
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
|
|
28
|
+
return usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc);
|
|
29
|
+
},
|
|
30
30
|
|
|
31
31
|
pulumi(...args) {
|
|
32
|
-
|
|
32
|
+
var _projectAppParams$pul3;
|
|
33
|
+
|
|
34
|
+
const [{
|
|
35
|
+
getParam
|
|
36
|
+
}] = args;
|
|
37
|
+
const vpc = getParam(projectAppParams.vpc);
|
|
38
|
+
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean"; // Not using advanced VPC params? Then immediately exit.
|
|
39
|
+
|
|
33
40
|
if (!usingAdvancedVpcParams) {
|
|
34
|
-
|
|
41
|
+
var _projectAppParams$pul;
|
|
42
|
+
|
|
43
|
+
return (_projectAppParams$pul = projectAppParams.pulumi) === null || _projectAppParams$pul === void 0 ? void 0 : _projectAppParams$pul.call(projectAppParams, ...args);
|
|
35
44
|
}
|
|
36
45
|
|
|
37
46
|
const [{
|
|
@@ -45,11 +54,13 @@ function createCorePulumiApp(projectAppParams = {}) {
|
|
|
45
54
|
} = vpc; // 1. We first deal with "existing VPC" setup.
|
|
46
55
|
|
|
47
56
|
if (useExistingVpc) {
|
|
57
|
+
var _projectAppParams$pul2;
|
|
58
|
+
|
|
48
59
|
if ("useVpcEndpoints" in vpc) {
|
|
49
60
|
throw new Error("Cannot specify `useVpcEndpoints` parameter when using an existing VPC. The VPC endpoints configurations should be already defined within the existing VPC.");
|
|
50
61
|
}
|
|
51
62
|
|
|
52
|
-
if (elasticSearch) {
|
|
63
|
+
if (projectAppParams.elasticSearch) {
|
|
53
64
|
if (!useExistingVpc.elasticSearchDomainVpcConfig) {
|
|
54
65
|
throw new Error("Cannot specify `useExistingVpc` parameter because the `elasticSearchDomainVpcConfig` parameter wasn't provided.");
|
|
55
66
|
}
|
|
@@ -82,7 +93,7 @@ function createCorePulumiApp(projectAppParams = {}) {
|
|
|
82
93
|
}
|
|
83
94
|
}
|
|
84
95
|
});
|
|
85
|
-
return pulumi === null ||
|
|
96
|
+
return (_projectAppParams$pul2 = projectAppParams.pulumi) === null || _projectAppParams$pul2 === void 0 ? void 0 : _projectAppParams$pul2.call(projectAppParams, ...args);
|
|
86
97
|
} // 2. Now we deal with "non-existing VPC" setup.
|
|
87
98
|
|
|
88
99
|
|
|
@@ -138,7 +149,7 @@ function createCorePulumiApp(projectAppParams = {}) {
|
|
|
138
149
|
});
|
|
139
150
|
}
|
|
140
151
|
|
|
141
|
-
return pulumi === null ||
|
|
152
|
+
return (_projectAppParams$pul3 = projectAppParams.pulumi) === null || _projectAppParams$pul3 === void 0 ? void 0 : _projectAppParams$pul3.call(projectAppParams, ...args);
|
|
142
153
|
}
|
|
143
154
|
|
|
144
155
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createCorePulumiApp","projectAppParams","vpc","elasticSearch","pulumi","usingAdvancedVpcParams","baseCreateCorePulumiApp","useExistingVpc","Boolean","args","resources","addResource","onResource","useVpcEndpoints","Error","elasticSearchDomainVpcConfig","resource","isResourceOfType","aws","elasticsearch","Domain","config","vpcOptions","lambdaFunctionsVpcConfig","lambda","Function","vpcConfig","iam","Role","meta","isLambdaFunctionRole","RolePolicyAttachment","name","role","output","policyArn","ManagedPolicy","AWSLambdaVPCAccessExecutionRole","ec2","Vpc","enableDnsSupport","enableDnsHostnames","subnets","routeTables","VpcEndpoint","vpcId","id","serviceName","routeTableIds","privateSubnets","vpcEndpointType","privateDnsEnabled","securityGroupIds","defaultSecurityGroupId","subnetIds","private","map","subNet"],"sources":["createCorePulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport {\n createCorePulumiApp as baseCreateCorePulumiApp,\n CreateCorePulumiAppParams as BaseCreateCorePulumiAppParams\n} from \"~/apps/core/createCorePulumiApp\";\nimport { isResourceOfType } from \"@webiny/pulumi\";\n\nexport type CorePulumiApp = ReturnType<typeof createCorePulumiApp>;\n\nexport type CorePulumiAppAdvancedVpcParams = Partial<{\n useVpcEndpoints: boolean;\n useExistingVpc: {\n elasticSearchDomainVpcConfig?: aws.types.input.elasticsearch.DomainVpcOptions;\n lambdaFunctionsVpcConfig: aws.types.input.lambda.FunctionVpcConfig;\n };\n}>;\n\nexport interface CreateCorePulumiAppParams extends Omit<BaseCreateCorePulumiAppParams, \"vpc\"> {\n vpc?: boolean | CorePulumiAppAdvancedVpcParams;\n}\n\nexport function createCorePulumiApp(projectAppParams: CreateCorePulumiAppParams = {}) {\n const { vpc, elasticSearch, pulumi } = projectAppParams;\n const usingAdvancedVpcParams = vpc && typeof vpc !== \"boolean\";\n\n return baseCreateCorePulumiApp({\n ...projectAppParams,\n // If using existing VPC, we ensure `vpc` param is set to `false`.\n vpc: usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc),\n pulumi(...args) {\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return pulumi?.(...args);\n }\n\n const [{ resources, addResource, onResource }] = args;\n const { useExistingVpc, useVpcEndpoints } = vpc;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (\"useVpcEndpoints\" in vpc) {\n throw new Error(\n \"Cannot specify `useVpcEndpoints` parameter when using an existing VPC. The VPC endpoints configurations should be already defined within the existing VPC.\"\n );\n }\n\n if (elasticSearch) {\n if (!useExistingVpc.elasticSearchDomainVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `elasticSearchDomainVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.elasticsearch.Domain)) {\n resource.config.vpcOptions(\n useExistingVpc!.elasticSearchDomainVpcConfig\n );\n }\n });\n }\n\n if (!useExistingVpc.lambdaFunctionsVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `lambdaFunctionsVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.lambda.Function)) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n addResource(aws.iam.RolePolicyAttachment, {\n name: `${resource.name}-vpc-access-execution-role`,\n config: {\n role: resource.output.name,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n\n return pulumi?.(...args);\n }\n\n // 2. Now we deal with \"non-existing VPC\" setup.\n if (useVpcEndpoints) {\n onResource(resource => {\n if (isResourceOfType(resource, aws.ec2.Vpc)) {\n resource.config.enableDnsSupport(true);\n resource.config.enableDnsHostnames(true);\n }\n });\n\n const { vpc, subnets, routeTables } = resources.vpc!;\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-s3-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.s3\",\n routeTableIds: [routeTables.privateSubnets.output.id]\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-dynamodb-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.dynamodb\",\n routeTableIds: [routeTables.privateSubnets.output.id]\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-sqs-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.sqs\",\n vpcEndpointType: \"Interface\",\n privateDnsEnabled: true,\n securityGroupIds: [vpc.output.defaultSecurityGroupId],\n subnetIds: subnets.private.map(subNet => subNet.output.id)\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-events-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.events\",\n vpcEndpointType: \"Interface\",\n privateDnsEnabled: true,\n securityGroupIds: [vpc.output.defaultSecurityGroupId],\n subnetIds: subnets.private.map(subNet => subNet.output.id)\n }\n });\n }\n\n return pulumi?.(...args);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAIA;;AAgBO,SAASA,mBAAT,CAA6BC,gBAA2C,GAAG,EAA3E,EAA+E;EAClF,MAAM;IAAEC,GAAF;IAAOC,aAAP;IAAsBC;EAAtB,IAAiCH,gBAAvC;EACA,MAAMI,sBAAsB,GAAGH,GAAG,IAAI,OAAOA,GAAP,KAAe,SAArD;EAEA,OAAO,IAAAI,wCAAA,8DACAL,gBADA;IAEH;IACAC,GAAG,EAAEG,sBAAsB,IAAIH,GAAG,CAACK,cAA9B,GAA+C,KAA/C,GAAuDC,OAAO,CAACN,GAAD,CAHhE;;IAIHE,MAAM,CAAC,GAAGK,IAAJ,EAAU;MACZ;MACA,IAAI,CAACJ,sBAAL,EAA6B;QACzB,OAAOD,MAAP,aAAOA,MAAP,uBAAOA,MAAM,CAAG,GAAGK,IAAN,CAAb;MACH;;MAED,MAAM,CAAC;QAAEC,SAAF;QAAaC,WAAb;QAA0BC;MAA1B,CAAD,IAA2CH,IAAjD;MACA,MAAM;QAAEF,cAAF;QAAkBM;MAAlB,IAAsCX,GAA5C,CAPY,CASZ;;MACA,IAAIK,cAAJ,EAAoB;QAChB,IAAI,qBAAqBL,GAAzB,EAA8B;UAC1B,MAAM,IAAIY,KAAJ,CACF,4JADE,CAAN;QAGH;;QAED,IAAIX,aAAJ,EAAmB;UACf,IAAI,CAACI,cAAc,CAACQ,4BAApB,EAAkD;YAC9C,MAAM,IAAID,KAAJ,CACF,iHADE,CAAN;UAGH;;UAEDF,UAAU,CAACI,QAAQ,IAAI;YACnB,IAAI,IAAAC,wBAAA,EAAiBD,QAAjB,EAA2BE,GAAG,CAACC,aAAJ,CAAkBC,MAA7C,CAAJ,EAA0D;cACtDJ,Q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AI,EAAE,yBADuB;UAE7BX,MAAM,EAAE;YACJwB,KAAK,EAAE3C,GAAG,CAACgC,MAAJ,CAAWY,EADd;YAEJC,WAAW,EAAE,mCAFT;YAGJG,eAAe,EAAE,WAHb;YAIJC,iBAAiB,EAAE,IAJf;YAKJC,gBAAgB,EAAE,CAAClD,GAAG,CAACgC,MAAJ,CAAWmB,sBAAZ,CALd;YAMJC,SAAS,EAAEZ,OAAO,CAACa,OAAR,CAAgBC,GAAhB,CAAoBC,MAAM,IAAIA,MAAM,CAACvB,MAAP,CAAcY,EAA5C;UANP;QAFqB,CAAtB,CAAX;MAWH;;MAED,OAAO1C,MAAP,aAAOA,MAAP,uBAAOA,MAAM,CAAG,GAAGK,IAAN,CAAb;IACH;;EAtHE,GAAP;AAwHH"}
|
|
1
|
+
{"version":3,"names":["createCorePulumiApp","projectAppParams","baseCreateCorePulumiApp","vpc","getParam","usingAdvancedVpcParams","useExistingVpc","Boolean","pulumi","args","resources","addResource","onResource","useVpcEndpoints","Error","elasticSearch","elasticSearchDomainVpcConfig","resource","isResourceOfType","aws","elasticsearch","Domain","config","vpcOptions","lambdaFunctionsVpcConfig","lambda","Function","vpcConfig","iam","Role","meta","isLambdaFunctionRole","RolePolicyAttachment","name","role","output","policyArn","ManagedPolicy","AWSLambdaVPCAccessExecutionRole","ec2","Vpc","enableDnsSupport","enableDnsHostnames","subnets","routeTables","VpcEndpoint","vpcId","id","serviceName","routeTableIds","privateSubnets","vpcEndpointType","privateDnsEnabled","securityGroupIds","defaultSecurityGroupId","subnetIds","private","map","subNet"],"sources":["createCorePulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport {\n createCorePulumiApp as baseCreateCorePulumiApp,\n CreateCorePulumiAppParams as BaseCreateCorePulumiAppParams\n} from \"~/apps/core/createCorePulumiApp\";\nimport { isResourceOfType, PulumiAppParam } from \"@webiny/pulumi\";\n\nexport type CorePulumiApp = ReturnType<typeof createCorePulumiApp>;\n\nexport type CorePulumiAppAdvancedVpcParams = Partial<{\n useVpcEndpoints: boolean;\n useExistingVpc: {\n elasticSearchDomainVpcConfig?: aws.types.input.elasticsearch.DomainVpcOptions;\n lambdaFunctionsVpcConfig: aws.types.input.lambda.FunctionVpcConfig;\n };\n}>;\n\nexport interface CreateCorePulumiAppParams extends Omit<BaseCreateCorePulumiAppParams, \"vpc\"> {\n vpc?: PulumiAppParam<boolean | CorePulumiAppAdvancedVpcParams>;\n}\n\nexport function createCorePulumiApp(projectAppParams: CreateCorePulumiAppParams = {}) {\n return baseCreateCorePulumiApp({\n ...projectAppParams,\n // If using existing VPC, we ensure `vpc` param is set to `false`.\n vpc: ({ getParam }) => {\n const vpc = getParam(projectAppParams.vpc);\n const usingAdvancedVpcParams = vpc && typeof vpc !== \"boolean\";\n return usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc);\n },\n pulumi(...args) {\n const [{ getParam }] = args;\n const vpc = getParam(projectAppParams.vpc);\n const usingAdvancedVpcParams = vpc && typeof vpc !== \"boolean\";\n\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return projectAppParams.pulumi?.(...args);\n }\n\n const [{ resources, addResource, onResource }] = args;\n const { useExistingVpc, useVpcEndpoints } = vpc;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (\"useVpcEndpoints\" in vpc) {\n throw new Error(\n \"Cannot specify `useVpcEndpoints` parameter when using an existing VPC. The VPC endpoints configurations should be already defined within the existing VPC.\"\n );\n }\n\n if (projectAppParams.elasticSearch) {\n if (!useExistingVpc.elasticSearchDomainVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `elasticSearchDomainVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.elasticsearch.Domain)) {\n resource.config.vpcOptions(\n useExistingVpc!.elasticSearchDomainVpcConfig\n );\n }\n });\n }\n\n if (!useExistingVpc.lambdaFunctionsVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `lambdaFunctionsVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.lambda.Function)) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n addResource(aws.iam.RolePolicyAttachment, {\n name: `${resource.name}-vpc-access-execution-role`,\n config: {\n role: resource.output.name,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n\n return projectAppParams.pulumi?.(...args);\n }\n\n // 2. Now we deal with \"non-existing VPC\" setup.\n if (useVpcEndpoints) {\n onResource(resource => {\n if (isResourceOfType(resource, aws.ec2.Vpc)) {\n resource.config.enableDnsSupport(true);\n resource.config.enableDnsHostnames(true);\n }\n });\n\n const { vpc, subnets, routeTables } = resources.vpc!;\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-s3-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.s3\",\n routeTableIds: [routeTables.privateSubnets.output.id]\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-dynamodb-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.dynamodb\",\n routeTableIds: [routeTables.privateSubnets.output.id]\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-sqs-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.sqs\",\n vpcEndpointType: \"Interface\",\n privateDnsEnabled: true,\n securityGroupIds: [vpc.output.defaultSecurityGroupId],\n subnetIds: subnets.private.map(subNet => subNet.output.id)\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-events-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.events\",\n vpcEndpointType: \"Interface\",\n privateDnsEnabled: true,\n securityGroupIds: [vpc.output.defaultSecurityGroupId],\n subnetIds: subnets.private.map(subNet => subNet.output.id)\n }\n });\n }\n\n return projectAppParams.pulumi?.(...args);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAIA;;AAgBO,SAASA,mBAAT,CAA6BC,gBAA2C,GAAG,EAA3E,EAA+E;EAClF,OAAO,IAAAC,wCAAA,8DACAD,gBADA;IAEH;IACAE,GAAG,EAAE,CAAC;MAAEC;IAAF,CAAD,KAAkB;MACnB,MAAMD,GAAG,GAAGC,QAAQ,CAACH,gBAAgB,CAACE,GAAlB,CAApB;MACA,MAAME,sBAAsB,GAAGF,GAAG,IAAI,OAAOA,GAAP,KAAe,SAArD;MACA,OAAOE,sBAAsB,IAAIF,GAAG,CAACG,cAA9B,GAA+C,KAA/C,GAAuDC,OAAO,CAACJ,GAAD,CAArE;IACH,CAPE;;IAQHK,MAAM,CAAC,GAAGC,IAAJ,EAAU;MAAA;;MACZ,MAAM,CAAC;QAAEL;MAAF,CAAD,IAAiBK,IAAvB;MACA,MAAMN,GAAG,GAAGC,QAAQ,CAACH,gBAAgB,CAACE,GAAlB,CAApB;MACA,MAAME,sBAAsB,GAAGF,GAAG,IAAI,OAAOA,GAAP,KAAe,SAArD,CAHY,CAKZ;;MACA,IAAI,CAACE,sBAAL,EAA6B;QAAA;;QACzB,gCAAOJ,gBAAgB,CAACO,MAAxB,0DAAO,2BAAAP,gBAAgB,EAAU,GAAGQ,IAAb,CAAvB;MACH;;MAED,MAAM,CAAC;QAAEC,SAAF;QAAaC,WAAb;QAA0BC;MAA1B,CAAD,IAA2CH,IAAjD;MACA,MAAM;QAAEH,cAAF;QAAkBO;MAAlB,IAAsCV,GAA5C,CAXY,CAaZ;;MACA,IAAIG,cAAJ,EAAoB;QAAA;;QAChB,IAAI,qBAAqBH,GAAzB,EAA8B;UAC1B,MAAM,IAAI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JG,eAAe,EAAE,WAHb;YAIJC,iBAAiB,EAAE,IAJf;YAKJC,gBAAgB,EAAE,CAAClD,GAAG,CAACgC,MAAJ,CAAWmB,sBAAZ,CALd;YAMJC,SAAS,EAAEZ,OAAO,CAACa,OAAR,CAAgBC,GAAhB,CAAoBC,MAAM,IAAIA,MAAM,CAACvB,MAAP,CAAcY,EAA5C;UANP;QAFqB,CAAtB,CAAX;QAYApC,WAAW,CAACQ,GAAG,CAACoB,GAAJ,CAAQM,WAAT,EAAsB;UAC7BZ,IAAI,EAAE,yBADuB;UAE7BX,MAAM,EAAE;YACJwB,KAAK,EAAE3C,GAAG,CAACgC,MAAJ,CAAWY,EADd;YAEJC,WAAW,EAAE,mCAFT;YAGJG,eAAe,EAAE,WAHb;YAIJC,iBAAiB,EAAE,IAJf;YAKJC,gBAAgB,EAAE,CAAClD,GAAG,CAACgC,MAAJ,CAAWmB,sBAAZ,CALd;YAMJC,SAAS,EAAEZ,OAAO,CAACa,OAAR,CAAgBC,GAAhB,CAAoBC,MAAM,IAAIA,MAAM,CAACvB,MAAP,CAAcY,EAA5C;UANP;QAFqB,CAAtB,CAAX;MAWH;;MAED,iCAAO9C,gBAAgB,CAACO,MAAxB,2DAAO,4BAAAP,gBAAgB,EAAU,GAAGQ,IAAb,CAAvB;IACH;;EA9HE,GAAP;AAgIH"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as aws from "@pulumi/aws";
|
|
2
2
|
import { CreateWebsitePulumiAppParams as BaseCreateWebsitePulumiAppParams } from "../apps/website/createWebsitePulumiApp";
|
|
3
|
+
import { PulumiAppParam } from "@webiny/pulumi";
|
|
3
4
|
export declare type WebsitePulumiApp = ReturnType<typeof createWebsitePulumiApp>;
|
|
4
5
|
export declare type WebsitePulumiAppAdvancedVpcParams = Partial<{
|
|
5
6
|
useExistingVpc: {
|
|
@@ -7,7 +8,7 @@ export declare type WebsitePulumiAppAdvancedVpcParams = Partial<{
|
|
|
7
8
|
};
|
|
8
9
|
}>;
|
|
9
10
|
export interface CreateWebsitePulumiAppParams extends Omit<BaseCreateWebsitePulumiAppParams, "vpc"> {
|
|
10
|
-
vpc?: boolean | WebsitePulumiAppAdvancedVpcParams
|
|
11
|
+
vpc?: PulumiAppParam<boolean | WebsitePulumiAppAdvancedVpcParams>;
|
|
11
12
|
}
|
|
12
13
|
export declare function createWebsitePulumiApp(projectAppParams?: CreateWebsitePulumiAppParams): import("@webiny/pulumi").PulumiApp<{
|
|
13
14
|
prerendering: {
|
|
@@ -18,19 +18,29 @@ var _createWebsitePulumiApp = require("../apps/website/createWebsitePulumiApp");
|
|
|
18
18
|
var _pulumi = require("@webiny/pulumi");
|
|
19
19
|
|
|
20
20
|
function createWebsitePulumiApp(projectAppParams = {}) {
|
|
21
|
-
const {
|
|
22
|
-
vpc,
|
|
23
|
-
pulumi
|
|
24
|
-
} = projectAppParams;
|
|
25
|
-
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
|
|
26
21
|
return (0, _createWebsitePulumiApp.createWebsitePulumiApp)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, projectAppParams), {}, {
|
|
27
22
|
// If using existing VPC, we ensure `vpc` param is set to `false`.
|
|
28
|
-
vpc:
|
|
23
|
+
vpc: ({
|
|
24
|
+
getParam
|
|
25
|
+
}) => {
|
|
26
|
+
const vpc = getParam(projectAppParams.vpc);
|
|
27
|
+
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
|
|
28
|
+
return usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc);
|
|
29
|
+
},
|
|
29
30
|
|
|
30
31
|
pulumi(...args) {
|
|
31
|
-
|
|
32
|
+
var _projectAppParams$pul2;
|
|
33
|
+
|
|
34
|
+
const [{
|
|
35
|
+
getParam
|
|
36
|
+
}] = args;
|
|
37
|
+
const vpc = getParam(projectAppParams.vpc);
|
|
38
|
+
const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean"; // Not using advanced VPC params? Then immediately exit.
|
|
39
|
+
|
|
32
40
|
if (!usingAdvancedVpcParams) {
|
|
33
|
-
|
|
41
|
+
var _projectAppParams$pul;
|
|
42
|
+
|
|
43
|
+
return (_projectAppParams$pul = projectAppParams.pulumi) === null || _projectAppParams$pul === void 0 ? void 0 : _projectAppParams$pul.call(projectAppParams, ...args);
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
const [{
|
|
@@ -39,7 +49,7 @@ function createWebsitePulumiApp(projectAppParams = {}) {
|
|
|
39
49
|
}] = args;
|
|
40
50
|
const {
|
|
41
51
|
useExistingVpc
|
|
42
|
-
} = vpc;
|
|
52
|
+
} = vpc;
|
|
43
53
|
|
|
44
54
|
if (useExistingVpc) {
|
|
45
55
|
if (!useExistingVpc.lambdaFunctionsVpcConfig) {
|
|
@@ -65,7 +75,7 @@ function createWebsitePulumiApp(projectAppParams = {}) {
|
|
|
65
75
|
});
|
|
66
76
|
}
|
|
67
77
|
|
|
68
|
-
return pulumi === null ||
|
|
78
|
+
return (_projectAppParams$pul2 = projectAppParams.pulumi) === null || _projectAppParams$pul2 === void 0 ? void 0 : _projectAppParams$pul2.call(projectAppParams, ...args);
|
|
69
79
|
}
|
|
70
80
|
|
|
71
81
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createWebsitePulumiApp","projectAppParams","
|
|
1
|
+
{"version":3,"names":["createWebsitePulumiApp","projectAppParams","baseCreateWebsitePulumiApp","vpc","getParam","usingAdvancedVpcParams","useExistingVpc","Boolean","pulumi","args","onResource","addResource","lambdaFunctionsVpcConfig","Error","resource","isResourceOfType","aws","lambda","Function","config","vpcConfig","iam","Role","meta","isLambdaFunctionRole","RolePolicyAttachment","name","role","output","policyArn","ManagedPolicy","AWSLambdaVPCAccessExecutionRole"],"sources":["createWebsitePulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport {\n createWebsitePulumiApp as baseCreateWebsitePulumiApp,\n CreateWebsitePulumiAppParams as BaseCreateWebsitePulumiAppParams\n} from \"~/apps/website/createWebsitePulumiApp\";\nimport { isResourceOfType, PulumiAppParam } from \"@webiny/pulumi\";\n\nexport type WebsitePulumiApp = ReturnType<typeof createWebsitePulumiApp>;\n\nexport type WebsitePulumiAppAdvancedVpcParams = Partial<{\n useExistingVpc: {\n lambdaFunctionsVpcConfig: aws.types.input.lambda.FunctionVpcConfig;\n };\n}>;\n\nexport interface CreateWebsitePulumiAppParams\n extends Omit<BaseCreateWebsitePulumiAppParams, \"vpc\"> {\n vpc?: PulumiAppParam<boolean | WebsitePulumiAppAdvancedVpcParams>;\n}\n\nexport function createWebsitePulumiApp(projectAppParams: CreateWebsitePulumiAppParams = {}) {\n return baseCreateWebsitePulumiApp({\n ...projectAppParams,\n // If using existing VPC, we ensure `vpc` param is set to `false`.\n vpc: ({ getParam }) => {\n const vpc = getParam(projectAppParams.vpc);\n const usingAdvancedVpcParams = vpc && typeof vpc !== \"boolean\";\n return usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc);\n },\n pulumi(...args) {\n const [{ getParam }] = args;\n const vpc = getParam(projectAppParams.vpc);\n const usingAdvancedVpcParams = vpc && typeof vpc !== \"boolean\";\n\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return projectAppParams.pulumi?.(...args);\n }\n\n const [{ onResource, addResource }] = args;\n const { useExistingVpc } = vpc;\n\n if (useExistingVpc) {\n if (!useExistingVpc.lambdaFunctionsVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `lambdaFunctionsVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.lambda.Function)) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n addResource(aws.iam.RolePolicyAttachment, {\n name: `${resource.name}-vpc-access-execution-role`,\n config: {\n role: resource.output.name,\n policyArn: aws.iam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C,MAAJ,CAAWC,QAAtC,CAAJ,EAAqD;YACjDJ,QAAQ,CAACK,MAAT,CAAgBC,SAAhB,CAA0Bd,cAAc,CAAEM,wBAA1C;UACH;;UAED,IAAI,IAAAG,wBAAA,EAAiBD,QAAjB,EAA2BE,GAAG,CAACK,GAAJ,CAAQC,IAAnC,CAAJ,EAA8C;YAC1C,IAAIR,QAAQ,CAACS,IAAT,CAAcC,oBAAlB,EAAwC;cACpCb,WAAW,CAACK,GAAG,CAACK,GAAJ,CAAQI,oBAAT,EAA+B;gBACtCC,IAAI,EAAG,GAAEZ,QAAQ,CAACY,IAAK,4BADe;gBAEtCP,MAAM,EAAE;kBACJQ,IAAI,EAAEb,QAAQ,CAACc,MAAT,CAAgBF,IADlB;kBAEJG,SAAS,EAAEb,GAAG,CAACK,GAAJ,CAAQS,aAAR,CAAsBC;gBAF7B;cAF8B,CAA/B,CAAX;YAOH;UACJ;QACJ,CAhBS,CAAV;MAiBH;;MAED,iCAAO9B,gBAAgB,CAACO,MAAxB,2DAAO,4BAAAP,gBAAgB,EAAU,GAAGQ,IAAb,CAAvB;IACH;;EAhDE,GAAP;AAkDH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/pulumi-aws",
|
|
3
|
-
"version": "5.34.6-beta.
|
|
3
|
+
"version": "5.34.6-beta.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/webiny/webiny-js.git"
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@pulumi/aws": "^5.8.0",
|
|
17
17
|
"@pulumi/pulumi": "^3.34.0",
|
|
18
|
-
"@webiny/cli-plugin-deploy-pulumi": "5.34.6-beta.
|
|
19
|
-
"@webiny/pulumi": "5.34.6-beta.
|
|
18
|
+
"@webiny/cli-plugin-deploy-pulumi": "5.34.6-beta.2",
|
|
19
|
+
"@webiny/pulumi": "5.34.6-beta.2",
|
|
20
20
|
"form-data": "4.0.0",
|
|
21
21
|
"node-fetch": "2.6.7"
|
|
22
22
|
},
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"@babel/preset-env": "^7.19.4",
|
|
27
27
|
"@babel/preset-typescript": "^7.18.6",
|
|
28
28
|
"@babel/runtime": "^7.19.0",
|
|
29
|
-
"@webiny/api-page-builder": "^5.34.6-beta.
|
|
30
|
-
"@webiny/aws-layers": "^5.34.6-beta.
|
|
31
|
-
"@webiny/cli": "^5.34.6-beta.
|
|
32
|
-
"@webiny/project-utils": "^5.34.6-beta.
|
|
29
|
+
"@webiny/api-page-builder": "^5.34.6-beta.2",
|
|
30
|
+
"@webiny/aws-layers": "^5.34.6-beta.2",
|
|
31
|
+
"@webiny/cli": "^5.34.6-beta.2",
|
|
32
|
+
"@webiny/project-utils": "^5.34.6-beta.2",
|
|
33
33
|
"chalk": "^4.1.0",
|
|
34
34
|
"lodash": "^4.5.0",
|
|
35
|
-
"mime": "2.5.2",
|
|
35
|
+
"mime": "^2.5.2",
|
|
36
36
|
"rimraf": "^3.0.2",
|
|
37
37
|
"ttypescript": "^1.5.12",
|
|
38
38
|
"typescript": "4.7.4"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
]
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "2f641f0c7fab7327932311b3052f9b4d341154eb"
|
|
53
53
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import { PulumiApp, PulumiAppResource } from "@webiny/pulumi";
|
|
3
|
+
interface AddDomainsUrlsOutputsParams {
|
|
4
|
+
cloudfrontDistribution: PulumiAppResource<typeof aws.cloudfront.Distribution>;
|
|
5
|
+
app: PulumiApp;
|
|
6
|
+
map: {
|
|
7
|
+
distributionDomain: string;
|
|
8
|
+
distributionUrl: string;
|
|
9
|
+
usedDomain: string;
|
|
10
|
+
usedUrl: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Based on the provided Cloudfront distribution and map,
|
|
15
|
+
* adds domain and URL-related values to final stack output.
|
|
16
|
+
*/
|
|
17
|
+
export declare const addDomainsUrlsOutputs: (params: AddDomainsUrlsOutputsParams) => void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.addDomainsUrlsOutputs = void 0;
|
|
9
|
+
|
|
10
|
+
var pulumi = _interopRequireWildcard(require("@pulumi/pulumi"));
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Based on the provided Cloudfront distribution and map,
|
|
14
|
+
* adds domain and URL-related values to final stack output.
|
|
15
|
+
*/
|
|
16
|
+
const addDomainsUrlsOutputs = params => {
|
|
17
|
+
const {
|
|
18
|
+
cloudfrontDistribution,
|
|
19
|
+
app,
|
|
20
|
+
map
|
|
21
|
+
} = params; // These will always contain the default Cloudfront domain,
|
|
22
|
+
// no matter if the user provided a custom domain or not.
|
|
23
|
+
|
|
24
|
+
const distributionDomain = cloudfrontDistribution.output.domainName;
|
|
25
|
+
const distributionUrl = distributionDomain.apply(value => `https://${value}`);
|
|
26
|
+
app.addOutputs({
|
|
27
|
+
[map.distributionDomain]: distributionDomain,
|
|
28
|
+
[map.distributionUrl]: distributionUrl,
|
|
29
|
+
// These will contain a custom domain if provided,
|
|
30
|
+
// otherwise again the default Cloudfront domain.
|
|
31
|
+
[map.usedDomain]: distributionDomain,
|
|
32
|
+
[map.usedUrl]: distributionUrl
|
|
33
|
+
}); // We're adjusting the outputs via the `config.aliases` setter.
|
|
34
|
+
// At the time of implementing this, could not find a better solution.
|
|
35
|
+
|
|
36
|
+
cloudfrontDistribution.config.aliases(aliases => {
|
|
37
|
+
const [firstAlias] = aliases || [];
|
|
38
|
+
|
|
39
|
+
if (firstAlias) {
|
|
40
|
+
app.addOutputs({
|
|
41
|
+
[map.usedDomain]: pulumi.output(firstAlias),
|
|
42
|
+
[map.usedUrl]: pulumi.output(`https://${firstAlias}`)
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return aliases;
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.addDomainsUrlsOutputs = addDomainsUrlsOutputs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["addDomainsUrlsOutputs","params","cloudfrontDistribution","app","map","distributionDomain","output","domainName","distributionUrl","apply","value","addOutputs","usedDomain","usedUrl","config","aliases","firstAlias","pulumi"],"sources":["addDomainsUrlsOutputs.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport { PulumiApp, PulumiAppResource } from \"@webiny/pulumi\";\n\ninterface AddDomainsUrlsOutputsParams {\n cloudfrontDistribution: PulumiAppResource<typeof aws.cloudfront.Distribution>;\n app: PulumiApp;\n map: {\n distributionDomain: string;\n distributionUrl: string;\n usedDomain: string;\n usedUrl: string;\n };\n}\n\n/**\n * Based on the provided Cloudfront distribution and map,\n * adds domain and URL-related values to final stack output.\n */\nexport const addDomainsUrlsOutputs = (params: AddDomainsUrlsOutputsParams) => {\n const { cloudfrontDistribution, app, map } = params;\n\n // These will always contain the default Cloudfront domain,\n // no matter if the user provided a custom domain or not.\n const distributionDomain = cloudfrontDistribution.output.domainName;\n const distributionUrl = distributionDomain.apply(value => `https://${value}`);\n\n app.addOutputs({\n [map.distributionDomain]: distributionDomain,\n [map.distributionUrl]: distributionUrl,\n\n // These will contain a custom domain if provided,\n // otherwise again the default Cloudfront domain.\n [map.usedDomain]: distributionDomain,\n [map.usedUrl]: distributionUrl\n });\n\n // We're adjusting the outputs via the `config.aliases` setter.\n // At the time of implementing this, could not find a better solution.\n cloudfrontDistribution.config.aliases(aliases => {\n const [firstAlias] = aliases || [];\n if (firstAlias) {\n app.addOutputs({\n [map.usedDomain]: pulumi.output(firstAlias),\n [map.usedUrl]: pulumi.output(`https://${firstAlias}`)\n });\n }\n\n return aliases;\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AAeA;AACA;AACA;AACA;AACO,MAAMA,qBAAqB,GAAIC,MAAD,IAAyC;EAC1E,MAAM;IAAEC,sBAAF;IAA0BC,GAA1B;IAA+BC;EAA/B,IAAuCH,MAA7C,CAD0E,CAG1E;EACA;;EACA,MAAMI,kBAAkB,GAAGH,sBAAsB,CAACI,MAAvB,CAA8BC,UAAzD;EACA,MAAMC,eAAe,GAAGH,kBAAkB,CAACI,KAAnB,CAAyBC,KAAK,IAAK,WAAUA,KAAM,EAAnD,CAAxB;EAEAP,GAAG,CAACQ,UAAJ,CAAe;IACX,CAACP,GAAG,CAACC,kBAAL,GAA0BA,kBADf;IAEX,CAACD,GAAG,CAACI,eAAL,GAAuBA,eAFZ;IAIX;IACA;IACA,CAACJ,GAAG,CAACQ,UAAL,GAAkBP,kBANP;IAOX,CAACD,GAAG,CAACS,OAAL,GAAeL;EAPJ,CAAf,EAR0E,CAkB1E;EACA;;EACAN,sBAAsB,CAACY,MAAvB,CAA8BC,OAA9B,CAAsCA,OAAO,IAAI;IAC7C,MAAM,CAACC,UAAD,IAAeD,OAAO,IAAI,EAAhC;;IACA,IAAIC,UAAJ,EAAgB;MACZb,GAAG,CAACQ,UAAJ,CAAe;QACX,CAACP,GAAG,CAACQ,UAAL,GAAkBK,MAAM,CAACX,MAAP,CAAcU,UAAd,CADP;QAEX,CAACZ,GAAG,CAACS,OAAL,GAAeI,MAAM,CAACX,MAAP,CAAe,WAAUU,UAAW,EAApC;MAFJ,CAAf;IAIH;;IAED,OAAOD,OAAP;EACH,CAVD;AAWH,CA/BM"}
|
package/utils/index.d.ts
CHANGED
package/utils/index.js
CHANGED
|
@@ -34,6 +34,20 @@ Object.keys(_tagResources).forEach(function (key) {
|
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
var _addDomainsUrlsOutputs = require("./addDomainsUrlsOutputs");
|
|
38
|
+
|
|
39
|
+
Object.keys(_addDomainsUrlsOutputs).forEach(function (key) {
|
|
40
|
+
if (key === "default" || key === "__esModule") return;
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
42
|
+
if (key in exports && exports[key] === _addDomainsUrlsOutputs[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _addDomainsUrlsOutputs[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
37
51
|
var _uploadFolderToS = require("./uploadFolderToS3");
|
|
38
52
|
|
|
39
53
|
Object.keys(_uploadFolderToS).forEach(function (key) {
|
package/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./tagResources\";\nexport * from \"./uploadFolderToS3\";\nexport { withCommonLambdaEnvVariables, getCommonLambdaEnvVariables } from \"./lambdaEnvVariables\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA"}
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./tagResources\";\nexport * from \"./addDomainsUrlsOutputs\";\nexport * from \"./uploadFolderToS3\";\nexport { withCommonLambdaEnvVariables, getCommonLambdaEnvVariables } from \"./lambdaEnvVariables\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as aws from "@pulumi/aws";
|
|
2
|
-
import { PulumiAppResource, PulumiAppResourceConstructor, PulumiAppRemoteResource } from "@webiny/pulumi";
|
|
3
|
-
export interface OpenSearchParams {
|
|
4
|
-
protect: boolean;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* THIS MODULE IS CURRENTLY NOT USED!!
|
|
8
|
-
* At the time of writing, Pulumi will NOT generate a unique suffix for the OpenSearch domain name.
|
|
9
|
-
*/
|
|
10
|
-
export declare const OpenSearch: import("@webiny/pulumi").PulumiAppModuleDefinition<{
|
|
11
|
-
domain: PulumiAppResource<PulumiAppResourceConstructor<import("@pulumi/aws/opensearch/domain").Domain, any>> | PulumiAppRemoteResource<aws.opensearch.GetDomainResult>;
|
|
12
|
-
domainPolicy: PulumiAppResource<typeof import("@pulumi/aws/opensearch/domainPolicy").DomainPolicy> | undefined;
|
|
13
|
-
table: PulumiAppResource<typeof import("@pulumi/aws/dynamodb/table").Table>;
|
|
14
|
-
dynamoToElastic: {
|
|
15
|
-
role: PulumiAppResource<typeof import("@pulumi/aws/iam/role").Role>;
|
|
16
|
-
policy: PulumiAppResource<typeof import("@pulumi/aws/iam/policy").Policy>;
|
|
17
|
-
lambda: PulumiAppResource<typeof import("@pulumi/aws/lambda/function").Function>;
|
|
18
|
-
eventSourceMapping: PulumiAppResource<typeof import("@pulumi/aws/lambda/eventSourceMapping").EventSourceMapping>;
|
|
19
|
-
};
|
|
20
|
-
}, OpenSearchParams>;
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.OpenSearch = void 0;
|
|
11
|
-
|
|
12
|
-
var _path = _interopRequireDefault(require("path"));
|
|
13
|
-
|
|
14
|
-
var pulumi = _interopRequireWildcard(require("@pulumi/pulumi"));
|
|
15
|
-
|
|
16
|
-
var aws = _interopRequireWildcard(require("@pulumi/aws"));
|
|
17
|
-
|
|
18
|
-
var _pulumi2 = require("@webiny/pulumi");
|
|
19
|
-
|
|
20
|
-
var _awsUtils = require("../awsUtils");
|
|
21
|
-
|
|
22
|
-
var _CoreVpc = require("./CoreVpc");
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* THIS MODULE IS CURRENTLY NOT USED!!
|
|
26
|
-
* At the time of writing, Pulumi will NOT generate a unique suffix for the OpenSearch domain name.
|
|
27
|
-
*/
|
|
28
|
-
const OpenSearch = (0, _pulumi2.createAppModule)({
|
|
29
|
-
name: "OpenSearch",
|
|
30
|
-
|
|
31
|
-
config(app, params) {
|
|
32
|
-
const domainName = "webiny-js";
|
|
33
|
-
const accountId = (0, _awsUtils.getAwsAccountId)(app);
|
|
34
|
-
const vpc = app.getModule(_CoreVpc.CoreVpc, {
|
|
35
|
-
optional: true
|
|
36
|
-
}); // This needs to be implemented in order to be able to use a shared OpenSearch cluster.
|
|
37
|
-
|
|
38
|
-
let domain;
|
|
39
|
-
let domainPolicy;
|
|
40
|
-
|
|
41
|
-
if (process.env.AWS_ELASTIC_SEARCH_DOMAIN_NAME) {
|
|
42
|
-
const domainName = String(process.env.AWS_ELASTIC_SEARCH_DOMAIN_NAME); // This can be useful for testing purposes in ephemeral environments. More information here:
|
|
43
|
-
// https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments
|
|
44
|
-
|
|
45
|
-
domain = app.addRemoteResource(domainName, () => {
|
|
46
|
-
return aws.opensearch.getDomain({
|
|
47
|
-
domainName
|
|
48
|
-
}, {
|
|
49
|
-
async: true
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
} else {
|
|
53
|
-
// Regular OpenSearch deployment.
|
|
54
|
-
domain = app.addResource(aws.opensearch.Domain, {
|
|
55
|
-
name: domainName,
|
|
56
|
-
config: {
|
|
57
|
-
domainName,
|
|
58
|
-
engineVersion: "OpenSearch_1.2",
|
|
59
|
-
clusterConfig: {
|
|
60
|
-
instanceType: "t3.medium.search",
|
|
61
|
-
instanceCount: 2,
|
|
62
|
-
zoneAwarenessEnabled: true,
|
|
63
|
-
zoneAwarenessConfig: {
|
|
64
|
-
availabilityZoneCount: 2
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
vpcOptions: vpc ? {
|
|
68
|
-
subnetIds: vpc.subnets.private.map(s => s.output.id),
|
|
69
|
-
securityGroupIds: [vpc.vpc.output.defaultSecurityGroupId]
|
|
70
|
-
} : undefined,
|
|
71
|
-
ebsOptions: {
|
|
72
|
-
ebsEnabled: true,
|
|
73
|
-
volumeSize: 10,
|
|
74
|
-
volumeType: "gp2"
|
|
75
|
-
},
|
|
76
|
-
advancedOptions: {
|
|
77
|
-
"rest.action.multi.allow_explicit_index": "true"
|
|
78
|
-
},
|
|
79
|
-
snapshotOptions: {
|
|
80
|
-
automatedSnapshotStartHour: 23
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
opts: {
|
|
84
|
-
protect: params.protect
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
/**
|
|
88
|
-
* Domain policy defines who can access your Elasticsearch Domain.
|
|
89
|
-
* For details on Elasticsearch security, read the official documentation:
|
|
90
|
-
* https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/security.html
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
domainPolicy = app.addResource(aws.opensearch.DomainPolicy, {
|
|
94
|
-
name: `${domainName}-policy`,
|
|
95
|
-
config: {
|
|
96
|
-
domainName: domain.output.domainName,
|
|
97
|
-
accessPolicies: pulumi.interpolate`{
|
|
98
|
-
"Version": "2012-10-17",
|
|
99
|
-
"Statement": [
|
|
100
|
-
{
|
|
101
|
-
"Effect": "Allow",
|
|
102
|
-
"Principal": {
|
|
103
|
-
"AWS": "${accountId}"
|
|
104
|
-
},
|
|
105
|
-
"Action": "es:*",
|
|
106
|
-
"Resource": "${domain.output.arn}/*"
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
}`
|
|
110
|
-
},
|
|
111
|
-
opts: {
|
|
112
|
-
protect: params.protect
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Create a table for Elasticsearch records. All ES records are stored in this table to dramatically improve
|
|
118
|
-
* performance and stability on write operations (especially massive data imports). This table also serves as a backup and
|
|
119
|
-
* a single source of truth for your Elasticsearch domain. Streaming is enabled on this table, and it will
|
|
120
|
-
* allow asynchronous synchronization of data with Elasticsearch domain.
|
|
121
|
-
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const table = app.addResource(aws.dynamodb.Table, {
|
|
125
|
-
name: "webiny-es",
|
|
126
|
-
config: {
|
|
127
|
-
attributes: [{
|
|
128
|
-
name: "PK",
|
|
129
|
-
type: "S"
|
|
130
|
-
}, {
|
|
131
|
-
name: "SK",
|
|
132
|
-
type: "S"
|
|
133
|
-
}],
|
|
134
|
-
streamEnabled: true,
|
|
135
|
-
streamViewType: "NEW_AND_OLD_IMAGES",
|
|
136
|
-
billingMode: "PAY_PER_REQUEST",
|
|
137
|
-
hashKey: "PK",
|
|
138
|
-
rangeKey: "SK"
|
|
139
|
-
},
|
|
140
|
-
opts: {
|
|
141
|
-
protect: params.protect
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
const roleName = "dynamo-to-elastic-lambda-role";
|
|
145
|
-
const role = app.addResource(aws.iam.Role, {
|
|
146
|
-
name: roleName,
|
|
147
|
-
config: {
|
|
148
|
-
assumeRolePolicy: {
|
|
149
|
-
Version: "2012-10-17",
|
|
150
|
-
Statement: [{
|
|
151
|
-
Action: "sts:AssumeRole",
|
|
152
|
-
Principal: {
|
|
153
|
-
Service: "lambda.amazonaws.com"
|
|
154
|
-
},
|
|
155
|
-
Effect: "Allow"
|
|
156
|
-
}]
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
const policy = getDynamoDbToElasticLambdaPolicy(app, domain.output);
|
|
161
|
-
app.addResource(aws.iam.RolePolicyAttachment, {
|
|
162
|
-
name: `${roleName}-DynamoDbToElasticLambdaPolicy`,
|
|
163
|
-
config: {
|
|
164
|
-
role: role.output,
|
|
165
|
-
policyArn: policy.output.arn
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
app.addResource(aws.iam.RolePolicyAttachment, {
|
|
169
|
-
name: `${roleName}-AWSLambdaVPCAccessExecutionRole`,
|
|
170
|
-
config: {
|
|
171
|
-
role: role.output,
|
|
172
|
-
policyArn: aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
app.addResource(aws.iam.RolePolicyAttachment, {
|
|
176
|
-
name: `${roleName}-AWSLambdaDynamoDBExecutionRole`,
|
|
177
|
-
config: {
|
|
178
|
-
role: role.output,
|
|
179
|
-
policyArn: aws.iam.ManagedPolicy.AWSLambdaDynamoDBExecutionRole
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
/**
|
|
183
|
-
* This Lambda will process the stream events from DynamoDB table that contains Elasticsearch items.
|
|
184
|
-
* Elasticsearch can't take large amount of individual writes in a short period of time, so this way
|
|
185
|
-
* we store data for Elasticsearch in a DynamoDB table, and asynchronously insert it into Elasticsearch
|
|
186
|
-
* using batching.
|
|
187
|
-
*/
|
|
188
|
-
|
|
189
|
-
const lambda = app.addResource(aws.lambda.Function, {
|
|
190
|
-
name: "dynamo-to-elastic",
|
|
191
|
-
config: {
|
|
192
|
-
role: role.output.arn,
|
|
193
|
-
runtime: "nodejs14.x",
|
|
194
|
-
handler: "handler.handler",
|
|
195
|
-
timeout: 600,
|
|
196
|
-
memorySize: 512,
|
|
197
|
-
environment: {
|
|
198
|
-
variables: {
|
|
199
|
-
DEBUG: String(process.env.DEBUG),
|
|
200
|
-
ELASTIC_SEARCH_ENDPOINT: domain.output.endpoint
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
description: "Process DynamoDB Stream.",
|
|
204
|
-
code: new pulumi.asset.AssetArchive({
|
|
205
|
-
".": new pulumi.asset.FileArchive(_path.default.join(app.paths.workspace, "dynamoToElastic/build"))
|
|
206
|
-
}),
|
|
207
|
-
vpcConfig: vpc ? {
|
|
208
|
-
subnetIds: vpc.subnets.private.map(s => s.output.id),
|
|
209
|
-
securityGroupIds: [vpc.vpc.output.defaultSecurityGroupId]
|
|
210
|
-
} : undefined
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
const eventSourceMapping = app.addResource(aws.lambda.EventSourceMapping, {
|
|
214
|
-
name: "dynamo-to-elastic",
|
|
215
|
-
config: {
|
|
216
|
-
eventSourceArn: table.output.streamArn,
|
|
217
|
-
functionName: lambda.output.arn,
|
|
218
|
-
startingPosition: "LATEST",
|
|
219
|
-
maximumRetryAttempts: 3,
|
|
220
|
-
batchSize: 1000,
|
|
221
|
-
maximumBatchingWindowInSeconds: 1
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
app.addOutputs({
|
|
225
|
-
elasticsearchDomainArn: domain.output.arn,
|
|
226
|
-
elasticsearchDomainEndpoint: domain.output.endpoint,
|
|
227
|
-
elasticsearchDynamodbTableArn: table.output.arn,
|
|
228
|
-
elasticsearchDynamodbTableName: table.output.name
|
|
229
|
-
});
|
|
230
|
-
return {
|
|
231
|
-
domain,
|
|
232
|
-
domainPolicy,
|
|
233
|
-
table,
|
|
234
|
-
dynamoToElastic: {
|
|
235
|
-
role,
|
|
236
|
-
policy,
|
|
237
|
-
lambda,
|
|
238
|
-
eventSourceMapping
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
});
|
|
244
|
-
exports.OpenSearch = OpenSearch;
|
|
245
|
-
|
|
246
|
-
function getDynamoDbToElasticLambdaPolicy(app, domain) {
|
|
247
|
-
return app.addResource(aws.iam.Policy, {
|
|
248
|
-
name: "DynamoDbToElasticLambdaPolicy-updated",
|
|
249
|
-
config: {
|
|
250
|
-
description: "This policy enables access to ES and Dynamodb streams",
|
|
251
|
-
policy: {
|
|
252
|
-
Version: "2012-10-17",
|
|
253
|
-
Statement: [{
|
|
254
|
-
Sid: "PermissionForES",
|
|
255
|
-
Effect: "Allow",
|
|
256
|
-
Action: ["es:ESHttpDelete", "es:ESHttpPatch", "es:ESHttpPost", "es:ESHttpPut"],
|
|
257
|
-
Resource: [pulumi.interpolate`${domain.arn}`, pulumi.interpolate`${domain.arn}/*`]
|
|
258
|
-
}]
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["OpenSearch","createAppModule","name","config","app","params","domainName","accountId","getAwsAccountId","vpc","getModule","CoreVpc","optional","domain","domainPolicy","process","env","AWS_ELASTIC_SEARCH_DOMAIN_NAME","String","addRemoteResource","aws","opensearch","getDomain","async","addResource","Domain","engineVersion","clusterConfig","instanceType","instanceCount","zoneAwarenessEnabled","zoneAwarenessConfig","availabilityZoneCount","vpcOptions","subnetIds","subnets","private","map","s","output","id","securityGroupIds","defaultSecurityGroupId","undefined","ebsOptions","ebsEnabled","volumeSize","volumeType","advancedOptions","snapshotOptions","automatedSnapshotStartHour","opts","protect","DomainPolicy","accessPolicies","pulumi","interpolate","arn","table","dynamodb","Table","attributes","type","streamEnabled","streamViewType","billingMode","hashKey","rangeKey","roleName","role","iam","Role","assumeRolePolicy","Version","Statement","Action","Principal","Service","Effect","policy","getDynamoDbToElasticLambdaPolicy","RolePolicyAttachment","policyArn","ManagedPolicy","AWSLambdaVPCAccessExecutionRole","AWSLambdaDynamoDBExecutionRole","lambda","Function","runtime","handler","timeout","memorySize","environment","variables","DEBUG","ELASTIC_SEARCH_ENDPOINT","endpoint","description","code","asset","AssetArchive","FileArchive","path","join","paths","workspace","vpcConfig","eventSourceMapping","EventSourceMapping","eventSourceArn","streamArn","functionName","startingPosition","maximumRetryAttempts","batchSize","maximumBatchingWindowInSeconds","addOutputs","elasticsearchDomainArn","elasticsearchDomainEndpoint","elasticsearchDynamodbTableArn","elasticsearchDynamodbTableName","dynamoToElastic","Policy","Sid","Resource"],"sources":["CoreOpenSearch.ts"],"sourcesContent":["import path from \"path\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport {\n createAppModule,\n PulumiApp,\n PulumiAppResource,\n PulumiAppResourceConstructor,\n PulumiAppRemoteResource\n} from \"@webiny/pulumi\";\n\nimport { getAwsAccountId } from \"../awsUtils\";\nimport { CoreVpc } from \"./CoreVpc\";\n\nexport interface OpenSearchParams {\n protect: boolean;\n}\n\n/**\n * THIS MODULE IS CURRENTLY NOT USED!!\n * At the time of writing, Pulumi will NOT generate a unique suffix for the OpenSearch domain name.\n */\n\nexport const OpenSearch = createAppModule({\n name: \"OpenSearch\",\n config(app, params: OpenSearchParams) {\n const domainName = \"webiny-js\";\n const accountId = getAwsAccountId(app);\n\n const vpc = app.getModule(CoreVpc, { optional: true });\n\n // This needs to be implemented in order to be able to use a shared OpenSearch cluster.\n let domain:\n | PulumiAppResource<PulumiAppResourceConstructor<aws.opensearch.Domain>>\n | PulumiAppRemoteResource<aws.opensearch.GetDomainResult>;\n\n let domainPolicy;\n\n if (process.env.AWS_ELASTIC_SEARCH_DOMAIN_NAME) {\n const domainName = String(process.env.AWS_ELASTIC_SEARCH_DOMAIN_NAME);\n // This can be useful for testing purposes in ephemeral environments. More information here:\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n domain = app.addRemoteResource(domainName, () => {\n return aws.opensearch.getDomain({ domainName }, { async: true });\n });\n } else {\n // Regular OpenSearch deployment.\n domain = app.addResource(aws.opensearch.Domain, {\n name: domainName,\n config: {\n domainName,\n engineVersion: \"OpenSearch_1.2\",\n clusterConfig: {\n instanceType: \"t3.medium.search\",\n instanceCount: 2,\n zoneAwarenessEnabled: true,\n zoneAwarenessConfig: {\n availabilityZoneCount: 2\n }\n },\n vpcOptions: vpc\n ? {\n subnetIds: vpc.subnets.private.map(s => s.output.id),\n securityGroupIds: [vpc.vpc.output.defaultSecurityGroupId]\n }\n : undefined,\n ebsOptions: {\n ebsEnabled: true,\n volumeSize: 10,\n volumeType: \"gp2\"\n },\n advancedOptions: {\n \"rest.action.multi.allow_explicit_index\": \"true\"\n },\n snapshotOptions: {\n automatedSnapshotStartHour: 23\n }\n },\n opts: { protect: params.protect }\n });\n\n /**\n * Domain policy defines who can access your Elasticsearch Domain.\n * For details on Elasticsearch security, read the official documentation:\n * https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/security.html\n */\n domainPolicy = app.addResource(aws.opensearch.DomainPolicy, {\n name: `${domainName}-policy`,\n config: {\n domainName: domain.output.domainName,\n accessPolicies: pulumi.interpolate`{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"${accountId}\"\n },\n \"Action\": \"es:*\",\n \"Resource\": \"${domain.output.arn}/*\"\n }\n ]\n }`\n },\n opts: { protect: params.protect }\n });\n }\n\n /**\n * Create a table for Elasticsearch records. All ES records are stored in this table to dramatically improve\n * performance and stability on write operations (especially massive data imports). This table also serves as a backup and\n * a single source of truth for your Elasticsearch domain. Streaming is enabled on this table, and it will\n * allow asynchronous synchronization of data with Elasticsearch domain.\n */\n const table = app.addResource(aws.dynamodb.Table, {\n name: \"webiny-es\",\n config: {\n attributes: [\n { name: \"PK\", type: \"S\" },\n { name: \"SK\", type: \"S\" }\n ],\n streamEnabled: true,\n streamViewType: \"NEW_AND_OLD_IMAGES\",\n billingMode: \"PAY_PER_REQUEST\",\n hashKey: \"PK\",\n rangeKey: \"SK\"\n },\n opts: { protect: params.protect }\n });\n\n const roleName = \"dynamo-to-elastic-lambda-role\";\n\n const role = app.addResource(aws.iam.Role, {\n name: roleName,\n config: {\n assumeRolePolicy: {\n Version: \"2012-10-17\",\n Statement: [\n {\n Action: \"sts:AssumeRole\",\n Principal: {\n Service: \"lambda.amazonaws.com\"\n },\n Effect: \"Allow\"\n }\n ]\n }\n }\n });\n\n const policy = getDynamoDbToElasticLambdaPolicy(app, domain.output);\n\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-DynamoDbToElasticLambdaPolicy`,\n config: {\n role: role.output,\n policyArn: policy.output.arn\n }\n });\n\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-AWSLambdaVPCAccessExecutionRole`,\n config: {\n role: role.output,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: `${roleName}-AWSLambdaDynamoDBExecutionRole`,\n config: {\n role: role.output,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaDynamoDBExecutionRole\n }\n });\n\n /**\n * This Lambda will process the stream events from DynamoDB table that contains Elasticsearch items.\n * Elasticsearch can't take large amount of individual writes in a short period of time, so this way\n * we store data for Elasticsearch in a DynamoDB table, and asynchronously insert it into Elasticsearch\n * using batching.\n */\n const lambda = app.addResource(aws.lambda.Function, {\n name: \"dynamo-to-elastic\",\n config: {\n role: role.output.arn,\n runtime: \"nodejs14.x\",\n handler: \"handler.handler\",\n timeout: 600,\n memorySize: 512,\n environment: {\n variables: {\n DEBUG: String(process.env.DEBUG),\n ELASTIC_SEARCH_ENDPOINT: domain.output.endpoint\n }\n },\n description: \"Process DynamoDB Stream.\",\n code: new pulumi.asset.AssetArchive({\n \".\": new pulumi.asset.FileArchive(\n path.join(app.paths.workspace, \"dynamoToElastic/build\")\n )\n }),\n vpcConfig: vpc\n ? {\n subnetIds: vpc.subnets.private.map(s => s.output.id),\n securityGroupIds: [vpc.vpc.output.defaultSecurityGroupId]\n }\n : undefined\n }\n });\n\n const eventSourceMapping = app.addResource(aws.lambda.EventSourceMapping, {\n name: \"dynamo-to-elastic\",\n config: {\n eventSourceArn: table.output.streamArn,\n functionName: lambda.output.arn,\n startingPosition: \"LATEST\",\n maximumRetryAttempts: 3,\n batchSize: 1000,\n maximumBatchingWindowInSeconds: 1\n }\n });\n\n app.addOutputs({\n elasticsearchDomainArn: domain.output.arn,\n elasticsearchDomainEndpoint: domain.output.endpoint,\n elasticsearchDynamodbTableArn: table.output.arn,\n elasticsearchDynamodbTableName: table.output.name\n });\n\n return {\n domain,\n domainPolicy,\n table,\n dynamoToElastic: {\n role,\n policy,\n lambda,\n eventSourceMapping\n }\n };\n }\n});\n\nfunction getDynamoDbToElasticLambdaPolicy(\n app: PulumiApp,\n domain: pulumi.Output<aws.opensearch.Domain | aws.opensearch.GetDomainResult>\n) {\n return app.addResource(aws.iam.Policy, {\n name: \"DynamoDbToElasticLambdaPolicy-updated\",\n config: {\n description: \"This policy enables access to ES and Dynamodb streams\",\n policy: {\n Version: \"2012-10-17\",\n Statement: [\n {\n Sid: \"PermissionForES\",\n Effect: \"Allow\",\n Action: [\n \"es:ESHttpDelete\",\n \"es:ESHttpPatch\",\n \"es:ESHttpPost\",\n \"es:ESHttpPut\"\n ],\n Resource: [\n pulumi.interpolate`${domain.arn}`,\n pulumi.interpolate`${domain.arn}/*`\n ]\n }\n ]\n }\n }\n });\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AAMA;AACA;AACA;AACA;AAEO,MAAMA,UAAU,GAAG,IAAAC,wBAAA,EAAgB;EACtCC,IAAI,EAAE,YADgC;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