@webiny/project-aws 6.0.0 → 6.1.0-beta.0
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/_templates/appTemplates/api/graphql/package.json +3 -5
- package/_templates/appTemplates/api/graphql/src/index.ts +2 -0
- package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +6 -4
- package/_templates/extensions/OpenSearch/coreDdbToEsHandler/dynamoToElastic/src/index.ts +6 -7
- package/abstractions/services/ApiStackOutputService.d.ts +0 -1
- package/abstractions/services/ApiStackOutputService.js.map +1 -1
- package/admin.d.ts +4 -16
- package/api.d.ts +4 -16
- package/apps/createApiApp.d.ts +0 -3
- package/cli.d.ts +2 -6
- package/exports/{infra/index.d.ts → infra.d.ts} +1 -1
- package/exports/{infra/index.js → infra.js} +2 -2
- package/exports/{infra/index.js.map → infra.js.map} +1 -1
- package/extensions/ApiLambdaFunction.d.ts +3 -9
- package/extensions/AwsDefaultRegion.d.ts +1 -5
- package/extensions/OpenSearch.d.ts +1 -11
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +4 -0
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
- package/extensions/ProjectAws/AutoInstall.d.ts +2 -26
- package/extensions/ProjectAws/BuildAppWorkspace.js +1 -1
- package/extensions/ProjectAws/BuildAppWorkspace.js.map +1 -1
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.d.ts +10 -0
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js +40 -0
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js.map +1 -0
- package/extensions/ProjectAws.js +3 -2
- package/extensions/ProjectAws.js.map +1 -1
- package/infra.d.ts +80 -348
- package/infra.js +5 -1
- package/infra.js.map +1 -1
- package/package.json +16 -18
- package/project.d.ts +10 -116
- package/pulumi/apps/api/ApiOutput.d.ts +0 -1
- package/pulumi/apps/api/ApiOutput.js +0 -1
- package/pulumi/apps/api/ApiOutput.js.map +1 -1
- package/pulumi/apps/api/createApiPulumiApp.d.ts +0 -3
- package/pulumi/apps/api/createApiPulumiApp.js +1 -4
- package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
- package/pulumi/apps/api/index.d.ts +0 -1
- package/pulumi/apps/api/index.js +0 -1
- package/pulumi/apps/api/index.js.map +1 -1
- package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.d.ts +6 -6
- package/pulumi/extensions/AdminCustomDomains.d.ts +6 -11
- package/pulumi/extensions/AwsTags.d.ts +1 -5
- package/pulumi/extensions/AwsTags.js +1 -1
- package/pulumi/extensions/AwsTags.js.map +1 -1
- package/pulumi/extensions/BlueGreenDeployments.d.ts +17 -115
- package/pulumi/extensions/BlueGreenDeployments.js +7 -4
- package/pulumi/extensions/BlueGreenDeployments.js.map +1 -1
- package/pulumi/extensions/OpenSearch.d.ts +1 -11
- package/pulumi/extensions/Vpc.d.ts +8 -64
- package/pulumi/extensions/index.d.ts +29 -187
- package/pulumi/types.d.ts +0 -1
- package/pulumi/types.js.map +1 -1
- package/utils/getTemplatesFolderPath.js +2 -2
- package/utils/getTemplatesFolderPath.js.map +1 -1
- package/_templates/appTemplates/api/migration/src/index.ts +0 -23
- package/_templates/appTemplates/api/migration/tsconfig.json +0 -6
- package/_templates/appTemplates/api/migration/webiny.config.ts +0 -8
- package/_templates/extensions/OpenSearch/api/migration/src/index.ts +0 -33
- package/extensions/ProjectAws/ExecuteDataMigrations.d.ts +0 -16
- package/extensions/ProjectAws/ExecuteDataMigrations.js +0 -69
- package/extensions/ProjectAws/ExecuteDataMigrations.js.map +0 -1
- package/pulumi/apps/api/ApiMigration.d.ts +0 -5
- package/pulumi/apps/api/ApiMigration.js +0 -82
- package/pulumi/apps/api/ApiMigration.js.map +0 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import * as pulumi from "@pulumi/pulumi";
|
|
3
|
-
import * as aws from "@pulumi/aws";
|
|
4
|
-
import { createAppModule } from "@webiny/pulumi";
|
|
5
|
-
import { createLambdaRole, getCommonLambdaEnvVariables } from "../lambdaUtils.js";
|
|
6
|
-
import { CoreOutput, VpcConfig } from "../common/index.js";
|
|
7
|
-
import { ApiBackgroundTask, ApiGraphql } from "../index.js";
|
|
8
|
-
import { LAMBDA_RUNTIME } from "../../constants.js";
|
|
9
|
-
import { getEnvVariableAwsRegion } from "../../env/awsRegion.js";
|
|
10
|
-
export const ApiMigration = createAppModule({
|
|
11
|
-
name: "ApiMigration",
|
|
12
|
-
config(app) {
|
|
13
|
-
const core = app.getModule(CoreOutput);
|
|
14
|
-
const graphql = app.getModule(ApiGraphql);
|
|
15
|
-
const backgroundTask = app.getModule(ApiBackgroundTask);
|
|
16
|
-
const role = createLambdaRole(app, {
|
|
17
|
-
name: "migration-lambda-role",
|
|
18
|
-
policy: graphql.policy.output
|
|
19
|
-
});
|
|
20
|
-
const migration = app.addResource(aws.lambda.Function, {
|
|
21
|
-
name: "data-migration",
|
|
22
|
-
config: {
|
|
23
|
-
handler: "handler.handler",
|
|
24
|
-
timeout: 900,
|
|
25
|
-
runtime: LAMBDA_RUNTIME,
|
|
26
|
-
memorySize: 3008,
|
|
27
|
-
role: role.output.arn,
|
|
28
|
-
description: "Performs data migrations.",
|
|
29
|
-
code: new pulumi.asset.AssetArchive({
|
|
30
|
-
".": new pulumi.asset.FileArchive(path.join(app.paths.workspace, "migration/build"))
|
|
31
|
-
}),
|
|
32
|
-
environment: {
|
|
33
|
-
variables: getCommonLambdaEnvVariables().apply(value => ({
|
|
34
|
-
...value,
|
|
35
|
-
COGNITO_REGION: getEnvVariableAwsRegion(),
|
|
36
|
-
COGNITO_USER_POOL_ID: core.cognitoUserPoolId,
|
|
37
|
-
DB_TABLE: core.primaryDynamodbTableName,
|
|
38
|
-
DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName,
|
|
39
|
-
DB_TABLE_OPENSEARCH: core.opensearchDynamodbTableName,
|
|
40
|
-
OPENSEARCH_ENDPOINT: core.opensearchDomainEndpoint,
|
|
41
|
-
OPENSEARCH_INDEX_PREFIX: process.env.OPENSEARCH_INDEX_PREFIX,
|
|
42
|
-
OPENSEARCH_SHARED_INDEXES: process.env.OPENSEARCH_SHARED_INDEXES,
|
|
43
|
-
S3_BUCKET: core.fileManagerBucketId
|
|
44
|
-
}))
|
|
45
|
-
},
|
|
46
|
-
vpcConfig: app.getModule(VpcConfig).functionVpcConfig,
|
|
47
|
-
loggingConfig: {
|
|
48
|
-
logFormat: "JSON"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Add IAM policy to allow states:StartExecution for the background task Step Function
|
|
54
|
-
const stepFunctionPolicy = app.addResource(aws.iam.Policy, {
|
|
55
|
-
name: "migration-lambda-step-function-policy",
|
|
56
|
-
config: {
|
|
57
|
-
policy: {
|
|
58
|
-
Version: "2012-10-17",
|
|
59
|
-
Statement: [{
|
|
60
|
-
Effect: "Allow",
|
|
61
|
-
Action: ["states:StartExecution"],
|
|
62
|
-
Resource: [pulumi.interpolate`${backgroundTask.stepFunction.output.arn}`, pulumi.interpolate`${backgroundTask.stepFunction.output.arn}/*`]
|
|
63
|
-
}]
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// Attach policy to the Lambda role
|
|
69
|
-
app.addResource(aws.iam.RolePolicyAttachment, {
|
|
70
|
-
name: "migration-lambda-attach-step-function-policy",
|
|
71
|
-
config: {
|
|
72
|
-
role: role.output.name,
|
|
73
|
-
policyArn: stepFunctionPolicy.output.arn
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return {
|
|
77
|
-
function: migration
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
//# sourceMappingURL=ApiMigration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["path","pulumi","aws","createAppModule","createLambdaRole","getCommonLambdaEnvVariables","CoreOutput","VpcConfig","ApiBackgroundTask","ApiGraphql","LAMBDA_RUNTIME","getEnvVariableAwsRegion","ApiMigration","name","config","app","core","getModule","graphql","backgroundTask","role","policy","output","migration","addResource","lambda","Function","handler","timeout","runtime","memorySize","arn","description","code","asset","AssetArchive","FileArchive","join","paths","workspace","environment","variables","apply","value","COGNITO_REGION","COGNITO_USER_POOL_ID","cognitoUserPoolId","DB_TABLE","primaryDynamodbTableName","DB_TABLE_AUDIT_LOGS","auditLogsDynamodbTableName","DB_TABLE_OPENSEARCH","opensearchDynamodbTableName","OPENSEARCH_ENDPOINT","opensearchDomainEndpoint","OPENSEARCH_INDEX_PREFIX","process","env","OPENSEARCH_SHARED_INDEXES","S3_BUCKET","fileManagerBucketId","vpcConfig","functionVpcConfig","loggingConfig","logFormat","stepFunctionPolicy","iam","Policy","Version","Statement","Effect","Action","Resource","interpolate","stepFunction","RolePolicyAttachment","policyArn","function"],"sources":["ApiMigration.ts"],"sourcesContent":["import path from \"path\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport { createLambdaRole, getCommonLambdaEnvVariables } from \"../lambdaUtils.js\";\nimport { CoreOutput, VpcConfig } from \"../common/index.js\";\nimport { ApiBackgroundTask, ApiGraphql } from \"~/pulumi/apps/index.js\";\nimport { LAMBDA_RUNTIME } from \"~/pulumi/constants.js\";\nimport { getEnvVariableAwsRegion } from \"~/pulumi/env/awsRegion.js\";\n\nexport type ApiMigration = PulumiAppModule<typeof ApiMigration>;\n\nexport const ApiMigration = createAppModule({\n name: \"ApiMigration\",\n config(app: PulumiApp) {\n const core = app.getModule(CoreOutput);\n const graphql = app.getModule(ApiGraphql);\n const backgroundTask = app.getModule(ApiBackgroundTask);\n\n const role = createLambdaRole(app, {\n name: \"migration-lambda-role\",\n policy: graphql.policy.output\n });\n\n const migration = app.addResource(aws.lambda.Function, {\n name: \"data-migration\",\n config: {\n handler: \"handler.handler\",\n timeout: 900,\n runtime: LAMBDA_RUNTIME,\n memorySize: 3008,\n role: role.output.arn,\n description: \"Performs data migrations.\",\n code: new pulumi.asset.AssetArchive({\n \".\": new pulumi.asset.FileArchive(\n path.join(app.paths.workspace, \"migration/build\")\n )\n }),\n environment: {\n variables: getCommonLambdaEnvVariables().apply(value => ({\n ...value,\n COGNITO_REGION: getEnvVariableAwsRegion(),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName,\n DB_TABLE_OPENSEARCH: core.opensearchDynamodbTableName,\n OPENSEARCH_ENDPOINT: core.opensearchDomainEndpoint,\n OPENSEARCH_INDEX_PREFIX: process.env.OPENSEARCH_INDEX_PREFIX,\n OPENSEARCH_SHARED_INDEXES: process.env.OPENSEARCH_SHARED_INDEXES,\n S3_BUCKET: core.fileManagerBucketId\n })) as Record<string, any>\n },\n vpcConfig: app.getModule(VpcConfig).functionVpcConfig,\n loggingConfig: {\n logFormat: \"JSON\"\n }\n }\n });\n\n // Add IAM policy to allow states:StartExecution for the background task Step Function\n const stepFunctionPolicy = app.addResource(aws.iam.Policy, {\n name: \"migration-lambda-step-function-policy\",\n config: {\n policy: {\n Version: \"2012-10-17\",\n Statement: [\n {\n Effect: \"Allow\",\n Action: [\"states:StartExecution\"],\n Resource: [\n pulumi.interpolate`${backgroundTask.stepFunction.output.arn}`,\n pulumi.interpolate`${backgroundTask.stepFunction.output.arn}/*`\n ]\n }\n ]\n }\n }\n });\n\n // Attach policy to the Lambda role\n app.addResource(aws.iam.RolePolicyAttachment, {\n name: \"migration-lambda-attach-step-function-policy\",\n config: {\n role: role.output.name,\n policyArn: stepFunctionPolicy.output.arn\n }\n });\n\n return {\n function: migration\n };\n }\n});\n"],"mappings":"AAAA,OAAOA,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