@webiny/pulumi-aws 5.35.2 → 5.36.0-beta.1
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 +8 -0
- package/apps/api/createApiPulumiApp.js +11 -0
- package/apps/api/createApiPulumiApp.js.map +1 -1
- package/apps/awsUtils.d.ts +1 -1
- package/apps/core/CoreFileManager.js +1 -1
- package/apps/core/CoreFileManager.js.map +1 -1
- package/apps/core/createCorePulumiApp.d.ts +4 -1
- package/apps/core/createCorePulumiApp.js +13 -1
- package/apps/core/createCorePulumiApp.js.map +1 -1
- package/package.json +8 -8
|
@@ -2,6 +2,14 @@ import { PulumiAppParam, PulumiAppParamCallback } from "@webiny/pulumi";
|
|
|
2
2
|
import { CustomDomainParams } from "../customDomain";
|
|
3
3
|
export declare type ApiPulumiApp = ReturnType<typeof createApiPulumiApp>;
|
|
4
4
|
export interface CreateApiPulumiAppParams {
|
|
5
|
+
/**
|
|
6
|
+
* Enables ElasticSearch infrastructure.
|
|
7
|
+
* Note that it requires also changes in application code.
|
|
8
|
+
*/
|
|
9
|
+
elasticSearch?: PulumiAppParam<boolean | Partial<{
|
|
10
|
+
domainName: string;
|
|
11
|
+
indexPrefix: string;
|
|
12
|
+
}>>;
|
|
5
13
|
/**
|
|
6
14
|
* Enables or disables VPC for the API.
|
|
7
15
|
* For VPC to work you also have to enable it in the Core application.
|
|
@@ -176,6 +176,17 @@ const createApiPulumiApp = (projectAppParams = {}) => {
|
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
|
+
if (projectAppParams.elasticSearch) {
|
|
180
|
+
const elasticSearch = app.getParam(projectAppParams.elasticSearch);
|
|
181
|
+
if (typeof elasticSearch === "object") {
|
|
182
|
+
if (elasticSearch.domainName) {
|
|
183
|
+
process.env.AWS_ELASTIC_SEARCH_DOMAIN_NAME = elasticSearch.domainName;
|
|
184
|
+
}
|
|
185
|
+
if (elasticSearch.indexPrefix) {
|
|
186
|
+
process.env.ELASTIC_SEARCH_INDEX_PREFIX = elasticSearch.indexPrefix;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
179
190
|
return (0, _utils.withCommonLambdaEnvVariables)(app);
|
|
180
191
|
};
|
|
181
192
|
exports.createApiPulumiApp = createApiPulumiApp;
|
|
@@ -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","graphql","ApiGraphql","EVENT_BUS","eventBusArn","IMPORT_CREATE_HANDLER","import","functions","output","arn","EXPORT_PROCESS_HANDLER","export","OKTA_ISSUER","APW_SCHEDULER_SCHEDULE_ACTION_HANDLER","scheduleAction","lambda","apwSchedulerEventRule","eventRule","apwSchedulerEventTarget","eventTarget","apiGateway","ApiGateway","method","function","download","cloudfront","ApiCloudfront","migration","ApiMigration","domains","applyCustomDomain","addOutputs","region","cognitoAppClientId","cognitoUserPoolPasswordPolicy","apwSchedulerScheduleAction","apwSchedulerExecuteAction","executeAction","apwSchedulerEventTargetId","targetId","dynamoDbTable","dynamoDbElasticsearchTable","migrationLambdaArn","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 ApiMigration,\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 env: {\n DB_TABLE: core.primaryDynamodbTableName\n }\n });\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 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: graphql.functions.graphql.output.arn\n },\n \"cms-options\": {\n path: \"/cms/{key+}\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-catch-all\": {\n path: \"/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n }\n });\n\n const cloudfront = app.addModule(ApiCloudfront);\n const migration = app.addModule(ApiMigration);\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 migrationLambdaArn: migration.function.output.arn\n });\n\n app.addHandler(() => {\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\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 apiGateway,\n cloudfront,\n apwScheduler,\n migration\n };\n }\n });\n\n return withCommonLambdaEnvVariables(app);\n};\n"],"mappings":";;;;;;AAAA;AACA;AAWA;AACA;AAiCO,MAAMA,kBAAkB,GAAG,CAACC,gBAA0C,GAAG,CAAC,CAAC,KAAK;EACnF,MAAMC,GAAG,GAAG,IAAAC,uBAAe,EAAC;IACxBC,IAAI,EAAE,KAAK;IACXC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAEL,gBAAgB;IACxBM,OAAO,EAAE,MAAML,GAAG,IAAI;MAClB,MAAMM,wBAAwB,GAAGN,GAAG,CAACO,QAAQ,CACzCR,gBAAgB,CAACO,wBAAwB,CAC5C;MACD,IAAIA,wBAAwB,EAAE;QAC1BN,GAAG,CAACQ,UAAU,CAACC,QAAQ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EF1D,GAAG,CAACY,UAAU,CAAC,MAAM;QACjB,IAAAgF,4BAAqB,EAAC;UAClB5F,GAAG;UACH6F,sBAAsB,EAAEnB,UAAU;UAClCoB,GAAG,EAAE;YACDC,kBAAkB,EAAE,qBAAqB;YACzCC,eAAe,EAAE,kBAAkB;YACnCC,UAAU,EAAE,WAAW;YACvBC,OAAO,EAAE;UACb;QACJ,CAAC,CAAC;MACN,CAAC,CAAC;MAEF,IAAAC,mBAAY,EAAC;QACTC,cAAc,EAAE/E,MAAM,CAACC,OAAO,CAACH,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAC1DkF,cAAc,EAAEhF,MAAM,CAACC,OAAO,CAACH,GAAG,CAAC,YAAY,CAAC;MACpD,CAAC,CAAC;MAEF,OAAO;QACH0B,WAAW;QACXK,OAAO;QACPmB,UAAU;QACVK,UAAU;QACV3B,YAAY;QACZ6B;MACJ,CAAC;IACL;EACJ,CAAC,CAAC;EAEF,OAAO,IAAA0B,mCAA4B,EAACtG,GAAG,CAAC;AAC5C,CAAC;AAAC"}
|
|
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","graphql","ApiGraphql","EVENT_BUS","eventBusArn","IMPORT_CREATE_HANDLER","import","functions","output","arn","EXPORT_PROCESS_HANDLER","export","OKTA_ISSUER","APW_SCHEDULER_SCHEDULE_ACTION_HANDLER","scheduleAction","lambda","apwSchedulerEventRule","eventRule","apwSchedulerEventTarget","eventTarget","apiGateway","ApiGateway","method","function","download","cloudfront","ApiCloudfront","migration","ApiMigration","domains","applyCustomDomain","addOutputs","region","cognitoAppClientId","cognitoUserPoolPasswordPolicy","apwSchedulerScheduleAction","apwSchedulerExecuteAction","executeAction","apwSchedulerEventTargetId","targetId","dynamoDbTable","dynamoDbElasticsearchTable","migrationLambdaArn","addDomainsUrlsOutputs","cloudfrontDistribution","map","distributionDomain","distributionUrl","usedDomain","usedUrl","tagResources","WbyProjectName","WbyEnvironment","elasticSearch","domainName","AWS_ELASTIC_SEARCH_DOMAIN_NAME","indexPrefix","withCommonLambdaEnvVariables"],"sources":["createApiPulumiApp.ts"],"sourcesContent":["import { createPulumiApp, PulumiAppParam, PulumiAppParamCallback } from \"@webiny/pulumi\";\nimport {\n ApiGateway,\n ApiApwScheduler,\n ApiCloudfront,\n ApiFileManager,\n ApiGraphql,\n ApiMigration,\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 ElasticSearch infrastructure.\n * Note that it requires also changes in application code.\n */\n elasticSearch?: PulumiAppParam<\n | boolean\n | Partial<{\n domainName: string;\n indexPrefix: string;\n }>\n >;\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>;\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 env: {\n DB_TABLE: core.primaryDynamodbTableName\n }\n });\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 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: graphql.functions.graphql.output.arn\n },\n \"cms-options\": {\n path: \"/cms/{key+}\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-catch-all\": {\n path: \"/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n }\n });\n\n const cloudfront = app.addModule(ApiCloudfront);\n const migration = app.addModule(ApiMigration);\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 migrationLambdaArn: migration.function.output.arn\n });\n\n app.addHandler(() => {\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\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 apiGateway,\n cloudfront,\n apwScheduler,\n migration\n };\n }\n });\n\n if (projectAppParams.elasticSearch) {\n const elasticSearch = app.getParam(projectAppParams.elasticSearch);\n if (typeof elasticSearch === \"object\") {\n if (elasticSearch.domainName) {\n process.env.AWS_ELASTIC_SEARCH_DOMAIN_NAME = elasticSearch.domainName;\n }\n\n if (elasticSearch.indexPrefix) {\n process.env.ELASTIC_SEARCH_INDEX_PREFIX = elasticSearch.indexPrefix;\n }\n }\n }\n\n return withCommonLambdaEnvVariables(app);\n};\n"],"mappings":";;;;;;AAAA;AACA;AAWA;AACA;AA6CO,MAAMA,kBAAkB,GAAG,CAACC,gBAA0C,GAAG,CAAC,CAAC,KAAK;EACnF,MAAMC,GAAG,GAAG,IAAAC,uBAAe,EAAC;IACxBC,IAAI,EAAE,KAAK;IACXC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAEL,gBAAgB;IACxBM,OAAO,EAAE,MAAML,GAAG,IAAI;MAClB,MAAMM,wBAAwB,GAAGN,GAAG,CAACO,QAAQ,CACzCR,gBAAgB,CAACO,wBAAwB,CAC5C;MACD,IAAIA,wBAAwB,EAAE;QAC1BN,GAAG,CAACQ,UAAU,CAACC,QAAQ,IAAI;UACvB,IAAI,CAACA,QAAQ,CAACP,IAAI,CAACQ,UAAU,CAACJ,wBAAwB,CAAC,EAAE;YACrDG,QAAQ,CAACP,IAAI,GAAI,GAAEI,wBAAyB,GAAEG,QAAQ,CAACP,IAAK,EAAC;UACjE;QACJ,CAAC,CAAC;MACN;;MAEA;MACA;MACA,IAAIH,gBAAgB,CAACY,MAAM,EAAE;QACzBX,GAAG,CAACY,UAAU,CAAC,MAAM;UACjB,OAAOb,gBAAgB,CAACY,MAAM,CAAEX,GAAG,CAAiB;QACxD,CAAC,CAAC;MACN;MAEA,MAAMa,sBAAsB,GAAGb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,EAAEhF,MAAM,CAACC,OAAO,CAACH,GAAG,CAAC,YAAY,CAAC;MACpD,CAAC,CAAC;MAEF,OAAO;QACH0B,WAAW;QACXK,OAAO;QACPmB,UAAU;QACVK,UAAU;QACV3B,YAAY;QACZ6B;MACJ,CAAC;IACL;EACJ,CAAC,CAAC;EAEF,IAAI7E,gBAAgB,CAACuG,aAAa,EAAE;IAChC,MAAMA,aAAa,GAAGtG,GAAG,CAACO,QAAQ,CAACR,gBAAgB,CAACuG,aAAa,CAAC;IAClE,IAAI,OAAOA,aAAa,KAAK,QAAQ,EAAE;MACnC,IAAIA,aAAa,CAACC,UAAU,EAAE;QAC1BjF,OAAO,CAACH,GAAG,CAACqF,8BAA8B,GAAGF,aAAa,CAACC,UAAU;MACzE;MAEA,IAAID,aAAa,CAACG,WAAW,EAAE;QAC3BnF,OAAO,CAACH,GAAG,CAACuB,2BAA2B,GAAG4D,aAAa,CAACG,WAAW;MACvE;IACJ;EACJ;EAEA,OAAO,IAAAC,mCAA4B,EAAC1G,GAAG,CAAC;AAC5C,CAAC;AAAC"}
|
package/apps/awsUtils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PulumiApp } from "@webiny/pulumi";
|
|
2
2
|
export declare function getAwsAccountId(app: PulumiApp): import("@pulumi/pulumi").Output<string>;
|
|
3
|
-
export declare function getAwsRegion(app: PulumiApp): import("@pulumi/pulumi").Output<"af-south-1" | "ap-east-1" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ap-south-1" | "ap-south-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-southeast-3" | "ca-central-1" | "cn-north-1" | "cn-northwest-1" | "eu-central-1" | "eu-central-2" | "eu-north-1" | "eu-south-1" | "eu-south-2" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "me-central-1" | "me-south-1" | "sa-east-1" | "us-gov-east-1" | "us-gov-west-1" | "us-east-
|
|
3
|
+
export declare function getAwsRegion(app: PulumiApp): import("@pulumi/pulumi").Output<"us-east-1" | "af-south-1" | "ap-east-1" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ap-south-1" | "ap-south-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-southeast-3" | "ca-central-1" | "cn-north-1" | "cn-northwest-1" | "eu-central-1" | "eu-central-2" | "eu-north-1" | "eu-south-1" | "eu-south-2" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "me-central-1" | "me-south-1" | "sa-east-1" | "us-gov-east-1" | "us-gov-west-1" | "us-east-2" | "us-west-1" | "us-west-2">;
|
|
@@ -20,7 +20,7 @@ const CoreFileManger = (0, _pulumi.createAppModule)({
|
|
|
20
20
|
// We need these rules to be able to upload to this bucket from the browser.
|
|
21
21
|
corsRules: [{
|
|
22
22
|
allowedHeaders: ["*"],
|
|
23
|
-
allowedMethods: ["POST", "GET"],
|
|
23
|
+
allowedMethods: ["POST", "GET", "PUT"],
|
|
24
24
|
allowedOrigins: ["*"],
|
|
25
25
|
maxAgeSeconds: 3000
|
|
26
26
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CoreFileManger","createAppModule","name","config","app","params","bucket","addResource","aws","s3","Bucket","acl","CannedAcl","Private","forceDestroy","protect","corsRules","allowedHeaders","allowedMethods","allowedOrigins","maxAgeSeconds","opts","blockPublicAccessBlock","BucketPublicAccessBlock","output","id","blockPublicAcls","blockPublicPolicy","ignorePublicAcls","restrictPublicBuckets"],"sources":["CoreFileManager.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createAppModule, PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\n\nexport type CoreFileManger = PulumiAppModule<typeof CoreFileManger>;\n\nexport const CoreFileManger = createAppModule({\n name: \"FileManagerBucket\",\n config(app: PulumiApp, params: { protect: boolean }) {\n const name = \"fm-bucket\";\n\n const bucket = app.addResource(aws.s3.Bucket, {\n name,\n config: {\n acl: aws.s3.CannedAcl.Private,\n // We definitely don't want to force-destroy if \"protected\" flag is true.\n forceDestroy: !params.protect,\n // We need these rules to be able to upload to this bucket from the browser.\n corsRules: [\n {\n allowedHeaders: [\"*\"],\n allowedMethods: [\"POST\", \"GET\"],\n allowedOrigins: [\"*\"],\n maxAgeSeconds: 3000\n }\n ]\n },\n opts: {\n protect: params.protect\n }\n });\n\n // Block any public access\n const blockPublicAccessBlock = app.addResource(aws.s3.BucketPublicAccessBlock, {\n name: `${name}-block-public-access`,\n config: {\n bucket: bucket.output.id,\n blockPublicAcls: true,\n blockPublicPolicy: true,\n ignorePublicAcls: true,\n restrictPublicBuckets: true\n }\n });\n\n return {\n bucket,\n blockPublicAccessBlock\n };\n }\n});\n"],"mappings":";;;;;;;AAAA;AACA;AAIO,MAAMA,cAAc,GAAG,IAAAC,uBAAe,EAAC;EAC1CC,IAAI,EAAE,mBAAmB;EACzBC,MAAM,CAACC,GAAc,EAAEC,MAA4B,EAAE;IACjD,MAAMH,IAAI,GAAG,WAAW;IAExB,MAAMI,MAAM,GAAGF,GAAG,CAACG,WAAW,CAACC,GAAG,CAACC,EAAE,CAACC,MAAM,EAAE;MAC1CR,IAAI;MACJC,MAAM,EAAE;QACJQ,GAAG,EAAEH,GAAG,CAACC,EAAE,CAACG,SAAS,CAACC,OAAO;QAC7B;QACAC,YAAY,EAAE,CAACT,MAAM,CAACU,OAAO;QAC7B;QACAC,SAAS,EAAE,CACP;UACIC,cAAc,EAAE,CAAC,GAAG,CAAC;UACrBC,cAAc,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;
|
|
1
|
+
{"version":3,"names":["CoreFileManger","createAppModule","name","config","app","params","bucket","addResource","aws","s3","Bucket","acl","CannedAcl","Private","forceDestroy","protect","corsRules","allowedHeaders","allowedMethods","allowedOrigins","maxAgeSeconds","opts","blockPublicAccessBlock","BucketPublicAccessBlock","output","id","blockPublicAcls","blockPublicPolicy","ignorePublicAcls","restrictPublicBuckets"],"sources":["CoreFileManager.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createAppModule, PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\n\nexport type CoreFileManger = PulumiAppModule<typeof CoreFileManger>;\n\nexport const CoreFileManger = createAppModule({\n name: \"FileManagerBucket\",\n config(app: PulumiApp, params: { protect: boolean }) {\n const name = \"fm-bucket\";\n\n const bucket = app.addResource(aws.s3.Bucket, {\n name,\n config: {\n acl: aws.s3.CannedAcl.Private,\n // We definitely don't want to force-destroy if \"protected\" flag is true.\n forceDestroy: !params.protect,\n // We need these rules to be able to upload to this bucket from the browser.\n corsRules: [\n {\n allowedHeaders: [\"*\"],\n allowedMethods: [\"POST\", \"GET\", \"PUT\"],\n allowedOrigins: [\"*\"],\n maxAgeSeconds: 3000\n }\n ]\n },\n opts: {\n protect: params.protect\n }\n });\n\n // Block any public access\n const blockPublicAccessBlock = app.addResource(aws.s3.BucketPublicAccessBlock, {\n name: `${name}-block-public-access`,\n config: {\n bucket: bucket.output.id,\n blockPublicAcls: true,\n blockPublicPolicy: true,\n ignorePublicAcls: true,\n restrictPublicBuckets: true\n }\n });\n\n return {\n bucket,\n blockPublicAccessBlock\n };\n }\n});\n"],"mappings":";;;;;;;AAAA;AACA;AAIO,MAAMA,cAAc,GAAG,IAAAC,uBAAe,EAAC;EAC1CC,IAAI,EAAE,mBAAmB;EACzBC,MAAM,CAACC,GAAc,EAAEC,MAA4B,EAAE;IACjD,MAAMH,IAAI,GAAG,WAAW;IAExB,MAAMI,MAAM,GAAGF,GAAG,CAACG,WAAW,CAACC,GAAG,CAACC,EAAE,CAACC,MAAM,EAAE;MAC1CR,IAAI;MACJC,MAAM,EAAE;QACJQ,GAAG,EAAEH,GAAG,CAACC,EAAE,CAACG,SAAS,CAACC,OAAO;QAC7B;QACAC,YAAY,EAAE,CAACT,MAAM,CAACU,OAAO;QAC7B;QACAC,SAAS,EAAE,CACP;UACIC,cAAc,EAAE,CAAC,GAAG,CAAC;UACrBC,cAAc,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC;UACtCC,cAAc,EAAE,CAAC,GAAG,CAAC;UACrBC,aAAa,EAAE;QACnB,CAAC;MAET,CAAC;MACDC,IAAI,EAAE;QACFN,OAAO,EAAEV,MAAM,CAACU;MACpB;IACJ,CAAC,CAAC;;IAEF;IACA,MAAMO,sBAAsB,GAAGlB,GAAG,CAACG,WAAW,CAACC,GAAG,CAACC,EAAE,CAACc,uBAAuB,EAAE;MAC3ErB,IAAI,EAAG,GAAEA,IAAK,sBAAqB;MACnCC,MAAM,EAAE;QACJG,MAAM,EAAEA,MAAM,CAACkB,MAAM,CAACC,EAAE;QACxBC,eAAe,EAAE,IAAI;QACrBC,iBAAiB,EAAE,IAAI;QACvBC,gBAAgB,EAAE,IAAI;QACtBC,qBAAqB,EAAE;MAC3B;IACJ,CAAC,CAAC;IAEF,OAAO;MACHvB,MAAM;MACNgB;IACJ,CAAC;EACL;AACJ,CAAC,CAAC;AAAC"}
|
|
@@ -10,7 +10,10 @@ export interface CreateCorePulumiAppParams {
|
|
|
10
10
|
* Enables ElasticSearch infrastructure.
|
|
11
11
|
* Note that it requires also changes in application code.
|
|
12
12
|
*/
|
|
13
|
-
elasticSearch?: PulumiAppParam<boolean
|
|
13
|
+
elasticSearch?: PulumiAppParam<boolean | Partial<{
|
|
14
|
+
domainName: string;
|
|
15
|
+
indexPrefix: string;
|
|
16
|
+
}>>;
|
|
14
17
|
/**
|
|
15
18
|
* Enables VPC for the application.
|
|
16
19
|
* By default enabled in production environments.
|
|
@@ -15,7 +15,7 @@ var _CoreFileManager = require("./CoreFileManager");
|
|
|
15
15
|
var _CoreVpc = require("./CoreVpc");
|
|
16
16
|
var _utils = require("../../utils");
|
|
17
17
|
function createCorePulumiApp(projectAppParams = {}) {
|
|
18
|
-
|
|
18
|
+
const app = (0, _pulumi.createPulumiApp)({
|
|
19
19
|
name: "core",
|
|
20
20
|
path: "apps/core",
|
|
21
21
|
config: projectAppParams,
|
|
@@ -94,4 +94,16 @@ function createCorePulumiApp(projectAppParams = {}) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
|
+
if (projectAppParams.elasticSearch) {
|
|
98
|
+
const elasticSearch = app.getParam(projectAppParams.elasticSearch);
|
|
99
|
+
if (typeof elasticSearch === "object") {
|
|
100
|
+
if (elasticSearch.domainName) {
|
|
101
|
+
process.env.AWS_ELASTIC_SEARCH_DOMAIN_NAME = elasticSearch.domainName;
|
|
102
|
+
}
|
|
103
|
+
if (elasticSearch.indexPrefix) {
|
|
104
|
+
process.env.ELASTIC_SEARCH_INDEX_PREFIX = elasticSearch.indexPrefix;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return app;
|
|
97
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createCorePulumiApp","projectAppParams","createPulumiApp","name","path","config","program","app","pulumiResourceNamePrefix","getParam","onResource","resource","startsWith","pulumi","addHandler","productionEnvironments","params","create","isProduction","includes","run","env","protect","legacyConfig","legacy","dynamoDbTable","addModule","CoreDynamo","vpcEnabled","vpc","CoreVpc","cognito","CoreCognito","useEmailAsUsername","eventBus","CoreEventBus","bucket","fileManagerBucket","CoreFileManger","elasticSearch","ElasticSearch","addOutputs","fileManagerBucketId","output","id","primaryDynamodbTableArn","arn","primaryDynamodbTableName","primaryDynamodbTableHashKey","hashKey","primaryDynamodbTableRangeKey","rangeKey","cognitoUserPoolId","userPool","cognitoUserPoolArn","cognitoUserPoolPasswordPolicy","passwordPolicy","cognitoAppClientId","userPoolClient","eventBusArn","tagResources","WbyProjectName","String","process","WbyEnvironment"],"sources":["createCorePulumiApp.ts"],"sourcesContent":["import { createPulumiApp, PulumiAppParam } from \"@webiny/pulumi\";\nimport { CoreCognito } from \"./CoreCognito\";\nimport { CoreDynamo } from \"./CoreDynamo\";\nimport { ElasticSearch } from \"./CoreElasticSearch\";\nimport { CoreEventBus } from \"./CoreEventBus\";\nimport { CoreFileManger } from \"./CoreFileManager\";\nimport { CoreVpc } from \"./CoreVpc\";\nimport { tagResources } from \"~/utils\";\n\nexport type CorePulumiApp = ReturnType<typeof createCorePulumiApp>;\n\nexport interface CreateCorePulumiAppParams {\n /**\n * Secures against deleting database by accident.\n * By default enabled in production environments.\n */\n protect?: PulumiAppParam<boolean>;\n\n /**\n * Enables ElasticSearch infrastructure.\n * Note that it requires also changes in application code.\n */\n elasticSearch?: PulumiAppParam<boolean>;\n\n /**\n * Enables VPC for the application.\n * By default enabled in production environments.\n */\n vpc?: PulumiAppParam<boolean>;\n\n /**\n * Additional settings for backwards compatibility.\n */\n legacy?: PulumiAppParam<CoreAppLegacyConfig>;\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: CorePulumiApp) => 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 interface CoreAppLegacyConfig {\n useEmailAsUsername?: boolean;\n}\n\nexport function createCorePulumiApp(projectAppParams: CreateCorePulumiAppParams = {}) {\n return createPulumiApp({\n name: \"core\",\n path: \"apps/core\",\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 CorePulumiApp);\n });\n }\n\n const productionEnvironments = app.params.create.productionEnvironments || [\"prod\"];\n const isProduction = productionEnvironments.includes(app.params.run.env);\n\n const protect = app.getParam(projectAppParams.protect) ?? isProduction;\n const legacyConfig = app.getParam(projectAppParams.legacy) || {};\n\n // Setup DynamoDB table\n const dynamoDbTable = app.addModule(CoreDynamo, { protect });\n\n // Setup VPC\n const vpcEnabled = app.getParam(projectAppParams?.vpc) ?? isProduction;\n const vpc = vpcEnabled ? app.addModule(CoreVpc) : null;\n\n // Setup Cognito\n const cognito = app.addModule(CoreCognito, {\n protect,\n useEmailAsUsername: legacyConfig.useEmailAsUsername ?? false\n });\n\n // Setup event bus\n const eventBus = app.addModule(CoreEventBus);\n\n // Setup file core bucket\n const { bucket: fileManagerBucket } = app.addModule(CoreFileManger, { protect });\n\n const elasticSearch = app.getParam(projectAppParams?.elasticSearch)\n ? app.addModule(ElasticSearch, { protect })\n : null;\n\n app.addOutputs({\n fileManagerBucketId: fileManagerBucket.output.id,\n primaryDynamodbTableArn: dynamoDbTable.output.arn,\n primaryDynamodbTableName: dynamoDbTable.output.name,\n primaryDynamodbTableHashKey: dynamoDbTable.output.hashKey,\n primaryDynamodbTableRangeKey: dynamoDbTable.output.rangeKey,\n cognitoUserPoolId: cognito.userPool.output.id,\n cognitoUserPoolArn: cognito.userPool.output.arn,\n cognitoUserPoolPasswordPolicy: cognito.userPool.output.passwordPolicy,\n cognitoAppClientId: cognito.userPoolClient.output.id,\n eventBusArn: eventBus.output.arn\n });\n\n tagResources({\n WbyProjectName: String(process.env[\"WEBINY_PROJECT_NAME\"]),\n WbyEnvironment: String(process.env[\"WEBINY_ENV\"])\n });\n\n return {\n dynamoDbTable,\n vpc,\n ...cognito,\n fileManagerBucket,\n eventBus,\n elasticSearch\n };\n }\n });\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAmDO,SAASA,mBAAmB,CAACC,gBAA2C,GAAG,CAAC,CAAC,EAAE;EAClF,OAAO,IAAAC,uBAAe,EAAC;IACnBC,IAAI,EAAE,MAAM;IACZC,IAAI,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pDe,WAAW,EAAEzB,QAAQ,CAACS,MAAM,CAACG;MACjC,CAAC,CAAC;MAEF,IAAAc,mBAAY,EAAC;QACTC,cAAc,EAAEC,MAAM,CAACC,OAAO,CAAC1C,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAC1D2C,cAAc,EAAEF,MAAM,CAACC,OAAO,CAAC1C,GAAG,CAAC,YAAY,CAAC;MACpD,CAAC,CAAC;MAEF;QACII,aAAa;QACbI;MAAG,GACAE,OAAO;QACVM,iBAAiB;QACjBH,QAAQ;QACRK;MAAa;IAErB;EACJ,CAAC,CAAC;AACN"}
|
|
1
|
+
{"version":3,"names":["createCorePulumiApp","projectAppParams","app","createPulumiApp","name","path","config","program","pulumiResourceNamePrefix","getParam","onResource","resource","startsWith","pulumi","addHandler","productionEnvironments","params","create","isProduction","includes","run","env","protect","legacyConfig","legacy","dynamoDbTable","addModule","CoreDynamo","vpcEnabled","vpc","CoreVpc","cognito","CoreCognito","useEmailAsUsername","eventBus","CoreEventBus","bucket","fileManagerBucket","CoreFileManger","elasticSearch","ElasticSearch","addOutputs","fileManagerBucketId","output","id","primaryDynamodbTableArn","arn","primaryDynamodbTableName","primaryDynamodbTableHashKey","hashKey","primaryDynamodbTableRangeKey","rangeKey","cognitoUserPoolId","userPool","cognitoUserPoolArn","cognitoUserPoolPasswordPolicy","passwordPolicy","cognitoAppClientId","userPoolClient","eventBusArn","tagResources","WbyProjectName","String","process","WbyEnvironment","domainName","AWS_ELASTIC_SEARCH_DOMAIN_NAME","indexPrefix","ELASTIC_SEARCH_INDEX_PREFIX"],"sources":["createCorePulumiApp.ts"],"sourcesContent":["import { createPulumiApp, PulumiAppParam } from \"@webiny/pulumi\";\nimport { CoreCognito } from \"./CoreCognito\";\nimport { CoreDynamo } from \"./CoreDynamo\";\nimport { ElasticSearch } from \"./CoreElasticSearch\";\nimport { CoreEventBus } from \"./CoreEventBus\";\nimport { CoreFileManger } from \"./CoreFileManager\";\nimport { CoreVpc } from \"./CoreVpc\";\nimport { tagResources } from \"~/utils\";\n\nexport type CorePulumiApp = ReturnType<typeof createCorePulumiApp>;\n\nexport interface CreateCorePulumiAppParams {\n /**\n * Secures against deleting database by accident.\n * By default enabled in production environments.\n */\n protect?: PulumiAppParam<boolean>;\n\n /**\n * Enables ElasticSearch infrastructure.\n * Note that it requires also changes in application code.\n */\n elasticSearch?: PulumiAppParam<\n | boolean\n | Partial<{\n domainName: string;\n indexPrefix: string;\n }>\n >;\n\n /**\n * Enables VPC for the application.\n * By default enabled in production environments.\n */\n vpc?: PulumiAppParam<boolean>;\n\n /**\n * Additional settings for backwards compatibility.\n */\n legacy?: PulumiAppParam<CoreAppLegacyConfig>;\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: CorePulumiApp) => 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 interface CoreAppLegacyConfig {\n useEmailAsUsername?: boolean;\n}\n\nexport function createCorePulumiApp(projectAppParams: CreateCorePulumiAppParams = {}) {\n const app = createPulumiApp({\n name: \"core\",\n path: \"apps/core\",\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 CorePulumiApp);\n });\n }\n\n const productionEnvironments = app.params.create.productionEnvironments || [\"prod\"];\n const isProduction = productionEnvironments.includes(app.params.run.env);\n\n const protect = app.getParam(projectAppParams.protect) ?? isProduction;\n const legacyConfig = app.getParam(projectAppParams.legacy) || {};\n\n // Setup DynamoDB table\n const dynamoDbTable = app.addModule(CoreDynamo, { protect });\n\n // Setup VPC\n const vpcEnabled = app.getParam(projectAppParams?.vpc) ?? isProduction;\n const vpc = vpcEnabled ? app.addModule(CoreVpc) : null;\n\n // Setup Cognito\n const cognito = app.addModule(CoreCognito, {\n protect,\n useEmailAsUsername: legacyConfig.useEmailAsUsername ?? false\n });\n\n // Setup event bus\n const eventBus = app.addModule(CoreEventBus);\n\n // Setup file core bucket\n const { bucket: fileManagerBucket } = app.addModule(CoreFileManger, { protect });\n\n const elasticSearch = app.getParam(projectAppParams?.elasticSearch)\n ? app.addModule(ElasticSearch, { protect })\n : null;\n\n app.addOutputs({\n fileManagerBucketId: fileManagerBucket.output.id,\n primaryDynamodbTableArn: dynamoDbTable.output.arn,\n primaryDynamodbTableName: dynamoDbTable.output.name,\n primaryDynamodbTableHashKey: dynamoDbTable.output.hashKey,\n primaryDynamodbTableRangeKey: dynamoDbTable.output.rangeKey,\n cognitoUserPoolId: cognito.userPool.output.id,\n cognitoUserPoolArn: cognito.userPool.output.arn,\n cognitoUserPoolPasswordPolicy: cognito.userPool.output.passwordPolicy,\n cognitoAppClientId: cognito.userPoolClient.output.id,\n eventBusArn: eventBus.output.arn\n });\n\n tagResources({\n WbyProjectName: String(process.env[\"WEBINY_PROJECT_NAME\"]),\n WbyEnvironment: String(process.env[\"WEBINY_ENV\"])\n });\n\n return {\n dynamoDbTable,\n vpc,\n ...cognito,\n fileManagerBucket,\n eventBus,\n elasticSearch\n };\n }\n });\n\n if (projectAppParams.elasticSearch) {\n const elasticSearch = app.getParam(projectAppParams.elasticSearch);\n if (typeof elasticSearch === \"object\") {\n if (elasticSearch.domainName) {\n process.env.AWS_ELASTIC_SEARCH_DOMAIN_NAME = elasticSearch.domainName;\n }\n\n if (elasticSearch.indexPrefix) {\n process.env.ELASTIC_SEARCH_INDEX_PREFIX = elasticSearch.indexPrefix;\n }\n }\n }\n\n return app;\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyDO,SAASA,mBAAmB,CAACC,gBAA2C,GAAG,CAAC,CAAC,EAAE;EAClF,MAAMC,GAAG,GAAG,IAAAC,uBAAe,EAAC;IACxBC,IAAI,EAAE,MAAM;IACZC,IAAI,EAAE,WAAW;IACjBC,MAAM,EAAEL,gBAAgB;IACxBM,OAAO,EAAE,MAAML,GAAG,IAAI;MAClB,MAAMM,wBAAwB,GAAGN,GAAG,CAACO,QAAQ,CACzCR,gBAAgB,CAACO,wBAAwB,CAC5C;MACD,IAAIA,wBAAwB,EAAE;QAC1BN,GAAG,CAACQ,UAAU,CAACC,QAAQ,IAAI;UACvB,IAAI,CAACA,QAAQ,CAACP,IAAI,CAACQ,UAAU,CAACJ,wBAAwB,CAAC,EAAE;YACrDG,QAAQ,CAACP,IAAI,GAAI,GAAEI,wBAAyB,GAAEG,QAAQ,CAACP,IAAK,EAAC;UACjE;QACJ,CAAC,CAAC;MACN;;MAEA;MACA;MACA,IAAIH,gBAAgB,CAACY,MAAM,EAAE;QACzBX,GAAG,CAACY,UAAU,CAAC,MAAM;UACjB,OAAOb,gBAAgB,CAACY,MAAM,CAAEX,GAAG,CAAkB;QACzD,CAAC,CAAC;MACN;MAEA,MAAMa,sBAAsB,GAAGb,GAAG,CAACc,MAAM,CAACC,MAAM,CAACF,sBAAsB,IAAI,CAAC,MAAM,CAAC;MACnF,MAAMG,YAAY,GAAGH,sBAAsB,CAACI,QAAQ,CAACjB,GAAG,CAACc,MAAM,CAACI,GAAG,CAACC,GAAG,CAAC;MAExE,MAAMC,OAAO,GAAGpB,GAAG,CAACO,QAAQ,CAACR,gBAAgB,CAACqB,OAAO,CAAC,IAAIJ,YAAY;MACtE,MAAMK,YAAY,GAAGrB,GAAG,CAACO,QAAQ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
|
+
"version": "5.36.0-beta.1",
|
|
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": "
|
|
19
|
-
"@webiny/pulumi": "
|
|
18
|
+
"@webiny/cli-plugin-deploy-pulumi": "5.36.0-beta.1",
|
|
19
|
+
"@webiny/pulumi": "5.36.0-beta.1",
|
|
20
20
|
"form-data": "4.0.0",
|
|
21
21
|
"node-fetch": "2.6.9"
|
|
22
22
|
},
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"@babel/preset-env": "7.20.2",
|
|
27
27
|
"@babel/preset-typescript": "7.18.6",
|
|
28
28
|
"@babel/runtime": "7.20.13",
|
|
29
|
-
"@webiny/api-page-builder": "
|
|
30
|
-
"@webiny/aws-layers": "
|
|
31
|
-
"@webiny/cli": "
|
|
32
|
-
"@webiny/project-utils": "
|
|
29
|
+
"@webiny/api-page-builder": "5.36.0-beta.1",
|
|
30
|
+
"@webiny/aws-layers": "5.36.0-beta.1",
|
|
31
|
+
"@webiny/cli": "5.36.0-beta.1",
|
|
32
|
+
"@webiny/project-utils": "5.36.0-beta.1",
|
|
33
33
|
"chalk": "4.1.2",
|
|
34
34
|
"lodash": "4.17.21",
|
|
35
35
|
"mime": "2.6.0",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
]
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "db7103cc3e74c3c71c2b88e50ef0fd19ae7c3fd2"
|
|
53
53
|
}
|