@webiny/project-aws 6.4.5 → 6.6.0-alpha.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 -11
- package/_templates/appTemplates/api/graphql/src/index.ts +9 -79
- package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +10 -93
- package/_templates/extensions/OpenSearch/coreDdbToEsHandler/dynamoToElastic/src/index.ts +19 -12
- package/abstractions/ApiGqlClient.js +1 -1
- package/abstractions/ApiGqlClient.js.map +1 -1
- package/abstractions/InvokeLambdaFunction.js +1 -1
- package/abstractions/InvokeLambdaFunction.js.map +1 -1
- package/admin.d.ts +6 -0
- package/admin.js +4 -2
- package/admin.js.map +1 -1
- package/api.d.ts +4 -4
- package/apps/createAdminApp.d.ts +1 -1
- package/apps/createCoreApp.d.ts +13 -13
- package/extensions/ApiRoute.d.ts +4 -4
- package/extensions/ApiRoute.js +5 -34
- package/extensions/ApiRoute.js.map +1 -1
- package/extensions/ProjectAws/BuildAppWorkspace.d.ts +3 -2
- package/extensions/ProjectAws/BuildAppWorkspace.js +38 -11
- package/extensions/ProjectAws/BuildAppWorkspace.js.map +1 -1
- package/extensions/ProjectAws/BuildProjectWorkspace.d.ts +12 -0
- package/extensions/ProjectAws/BuildProjectWorkspace.js +30 -0
- package/extensions/ProjectAws/BuildProjectWorkspace.js.map +1 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.d.ts +11 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.js +30 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.js.map +1 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.d.ts +11 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.js +30 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.js.map +1 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.d.ts +11 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.js +30 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.js.map +1 -0
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.d.ts +11 -0
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js +31 -0
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js.map +1 -0
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.d.ts +13 -0
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.js +34 -0
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.js.map +1 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js +1 -2
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js.map +1 -1
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.d.ts +8 -0
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.js +14 -0
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.js.map +1 -0
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.d.ts +12 -0
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.js +31 -0
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.js.map +1 -0
- package/extensions/ProjectAws/ValidateProductionPulumiState.d.ts +12 -0
- package/extensions/ProjectAws/ValidateProductionPulumiState.js +33 -0
- package/extensions/ProjectAws/ValidateProductionPulumiState.js.map +1 -0
- package/extensions/ProjectAws/definitions.js +1 -3
- package/extensions/ProjectAws/definitions.js.map +1 -1
- package/extensions/ProjectAws.js +18 -4
- package/extensions/ProjectAws.js.map +1 -1
- package/extensions/definitions.js +0 -2
- package/extensions/definitions.js.map +1 -1
- package/extensions/index.d.ts +0 -1
- package/extensions/index.js +0 -1
- package/features/Watch/AwsWatch.d.ts +17 -0
- package/features/Watch/AwsWatch.js +108 -0
- package/features/Watch/AwsWatch.js.map +1 -0
- package/features/Watch/getIotEndpoint.d.ts +2 -0
- package/features/Watch/getIotEndpoint.js +18 -0
- package/features/Watch/getIotEndpoint.js.map +1 -0
- package/features/Watch/handler/handler.zip +0 -0
- package/features/Watch/replaceLambdaFunctions.d.ts +19 -0
- package/features/Watch/replaceLambdaFunctions.js +72 -0
- package/features/Watch/replaceLambdaFunctions.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/infra.d.ts +15 -0
- package/infra.js +5 -2
- package/infra.js.map +1 -1
- package/package.json +17 -14
- package/pulumi/apps/admin/createAdminPulumiApp.d.ts +1 -1
- package/pulumi/apps/admin/createAdminPulumiApp.js +2 -2
- package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
- package/pulumi/apps/api/ApiOutput.js +1 -1
- package/pulumi/apps/api/ApiOutput.js.map +1 -1
- package/pulumi/apps/api/createApiPulumiApp.js +2 -2
- package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
- package/pulumi/apps/awsUtils.d.ts +1 -1
- package/pulumi/apps/awsUtils.js +2 -2
- package/pulumi/apps/awsUtils.js.map +1 -1
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js +2 -2
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js.map +1 -1
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.js +1 -1
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.js.map +1 -1
- package/pulumi/apps/common/CoreOutput.js +2 -2
- package/pulumi/apps/common/CoreOutput.js.map +1 -1
- package/pulumi/apps/core/CoreCognito.d.ts +0 -1
- package/pulumi/apps/core/CoreCognito.js +1 -4
- package/pulumi/apps/core/CoreCognito.js.map +1 -1
- package/pulumi/apps/core/CoreOpenSearch.d.ts +1 -1
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js +1 -9
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
- package/pulumi/apps/core/createCorePulumiApp.d.ts +13 -13
- package/pulumi/apps/core/createCorePulumiApp.js +3 -19
- package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
- package/pulumi/apps/core/webinyWatchCommand/handler.d.ts +1 -1
- package/pulumi/apps/extensions/getVpcConfigFromExtension.d.ts +4 -4
- package/pulumi/apps/react/createReactPulumiApp.d.ts +1 -1
- package/pulumi/apps/react/createReactPulumiApp.js +2 -2
- package/pulumi/apps/react/createReactPulumiApp.js.map +1 -1
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js +2 -2
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js.map +1 -1
- package/pulumi/apps/syncSystem/getSyncSystemOutput.d.ts +1 -1
- package/pulumi/apps/syncSystem/getSyncSystemOutput.js +1 -1
- package/pulumi/apps/syncSystem/getSyncSystemOutput.js.map +1 -1
- package/pulumi/extensions/index.d.ts +2 -2
- package/pulumi/getAwsProjectSdk.d.ts +12 -0
- package/pulumi/getAwsProjectSdk.js +6 -0
- package/pulumi/getAwsProjectSdk.js.map +1 -0
- package/pulumi/getStackOutput.d.ts +7 -0
- package/pulumi/getStackOutput.js +8 -0
- package/pulumi/getStackOutput.js.map +1 -0
- package/pulumi/utils/lambdaEnvVariables.js +4 -16
- package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
- package/registerAwsProjectFeatures.d.ts +8 -0
- package/registerAwsProjectFeatures.js +55 -0
- package/registerAwsProjectFeatures.js.map +1 -0
- package/services/GetPulumiService/GetPulumiService.d.ts +9 -0
- package/services/GetPulumiService/GetPulumiService.js +44 -0
- package/services/GetPulumiService/GetPulumiService.js.map +1 -0
- package/utils/getPulumiBaseTemplatesFolderPath.d.ts +1 -0
- package/utils/getPulumiBaseTemplatesFolderPath.js +10 -0
- package/utils/getPulumiBaseTemplatesFolderPath.js.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/_templates/appTemplates/api/graphql/src/security.ts +0 -43
- package/extensions/Encryption.d.ts +0 -10
- package/extensions/Encryption.js +0 -36
- package/extensions/Encryption.js.map +0 -1
|
@@ -8,7 +8,7 @@ import { CoreVpc } from "./CoreVpc.js";
|
|
|
8
8
|
import { WatchCommand } from "./WatchCommand.js";
|
|
9
9
|
import { withServiceManifest } from "../../utils/withServiceManifest.js";
|
|
10
10
|
import { addServiceManifestTableItem } from "../../utils/addServiceManifestTableItem.js";
|
|
11
|
-
import {
|
|
11
|
+
import { getAwsProjectSdk } from "../../getAwsProjectSdk.js";
|
|
12
12
|
import { CorePulumi } from "../../../abstractions/features/pulumi/index.js";
|
|
13
13
|
import { corePulumi } from "../../features/CorePulumi/index.js";
|
|
14
14
|
import { getOsConfigFromExtension } from "../extensions/getOsConfigFromExtension.js";
|
|
@@ -24,7 +24,7 @@ function createCorePulumiApp() {
|
|
|
24
24
|
name: "core",
|
|
25
25
|
path: "apps/core",
|
|
26
26
|
program: async (app)=>{
|
|
27
|
-
const sdk = await
|
|
27
|
+
const sdk = await getAwsProjectSdk();
|
|
28
28
|
const projectConfig = await sdk.getProjectConfig();
|
|
29
29
|
const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();
|
|
30
30
|
const coreStackOutput = await sdk.getAppStackOutput("core");
|
|
@@ -158,24 +158,8 @@ function createCorePulumiApp() {
|
|
|
158
158
|
const vpc = vpcEnabled ? app.addModule(CoreVpc) : null;
|
|
159
159
|
const cognito = app.addModule(CoreCognito, {
|
|
160
160
|
protect,
|
|
161
|
-
useEmailAsUsername: false
|
|
162
|
-
mfa: "true" === process.env.COGNITO_MFA
|
|
161
|
+
useEmailAsUsername: false
|
|
163
162
|
});
|
|
164
|
-
const isNewDeployment = !coreStackOutput || 0 === Object.keys(coreStackOutput).length;
|
|
165
|
-
if (isNewDeployment) cognito.userPool.config.schemas((schemas)=>schemas?.map((schema)=>{
|
|
166
|
-
if ("id" === schema.name) return {
|
|
167
|
-
...schema,
|
|
168
|
-
stringAttributeConstraints: {
|
|
169
|
-
...schema.stringAttributeConstraints,
|
|
170
|
-
maxLength: "256"
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
return schema;
|
|
174
|
-
}));
|
|
175
|
-
else cognito.userPool.opts.ignoreChanges = [
|
|
176
|
-
...cognito.userPool.opts.ignoreChanges || [],
|
|
177
|
-
"schemas"
|
|
178
|
-
];
|
|
179
163
|
const eventBus = app.addModule(CoreEventBus);
|
|
180
164
|
const { bucket: fileManagerBucket } = app.addModule(CoreFileManger, {
|
|
181
165
|
protect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/core/createCorePulumiApp.js","sources":["../../../../src/pulumi/apps/core/createCorePulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createPulumiApp, isResourceOfType } from \"@webiny/pulumi\";\nimport { CoreCognito } from \"./CoreCognito.js\";\nimport { CoreDynamo } from \"./CoreDynamo.js\";\nimport { OpenSearch } from \"./CoreOpenSearch.js\";\nimport { CoreEventBus } from \"./CoreEventBus.js\";\nimport { CoreFileManger } from \"./CoreFileManager.js\";\nimport { CoreVpc } from \"./CoreVpc.js\";\nimport { WatchCommand } from \"./WatchCommand.js\";\nimport { withServiceManifest } from \"~/pulumi/utils/withServiceManifest.js\";\nimport {\n addServiceManifestTableItem,\n type TableDefinition\n} from \"~/pulumi/utils/addServiceManifestTableItem.js\";\nimport * as random from \"@pulumi/random\";\n\nimport { getProjectSdk } from \"@webiny/project\";\nimport { CorePulumi } from \"~/abstractions/features/pulumi/index.js\";\nimport { corePulumi } from \"~/pulumi/features/CorePulumi/index.js\";\nimport { getOsConfigFromExtension } from \"~/pulumi/apps/extensions/getOsConfigFromExtension.js\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { applyAwsResourceTags, getAwsRegion } from \"~/pulumi/apps/awsUtils.js\";\nimport { configureS3BucketMalwareProtection } from \"./configureS3BucketMalwareProtection.js\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { CoreAuditLogsDynamo } from \"~/pulumi/index.js\";\n\nexport type CorePulumiApp = ReturnType<typeof createCorePulumiApp>;\n\nexport function createCorePulumiApp() {\n const baseApp = createPulumiApp({\n name: \"core\",\n path: \"apps/core\",\n program: async app => {\n const sdk = await getProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n const coreStackOutput = await sdk.getAppStackOutput<{\n opensearchDomainName?: string;\n primaryDynamodbTableName?: string;\n }>(\"core\");\n const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);\n const opensearchExtensionConfig = getOsConfigFromExtension(projectConfig);\n\n const deploymentId = new random.RandomId(\"deploymentId\", { byteLength: 8 });\n\n let searchEngineType: \"opensearch\" | null = null;\n let searchEngineParams: typeof opensearchExtensionConfig | null = null;\n\n if (opensearchExtensionConfig) {\n searchEngineParams = opensearchExtensionConfig;\n searchEngineType = \"opensearch\";\n }\n\n if (searchEngineParams) {\n const params = searchEngineParams;\n if (typeof params === \"object\") {\n if (params.endpoint) {\n process.env.OPENSEARCH_ENDPOINT = params.endpoint;\n }\n\n if (params.domainName) {\n process.env.AWS_OS_DOMAIN_NAME = params.domainName;\n }\n\n if (params.indexPrefix) {\n process.env.OPENSEARCH_INDEX_PREFIX = params.indexPrefix;\n }\n\n if (params.sharedIndexes) {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n }\n\n if (params.username) {\n process.env.OPENSEARCH_USERNAME = params.username;\n }\n\n if (params.password) {\n process.env.OPENSEARCH_PASSWORD = params.password;\n }\n }\n }\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 // <-------------------- Enterprise start -------------------->\n app.addHandler(async () => {\n const usingAdvancedVpcParams =\n vpcExtensionsConfig && typeof vpcExtensionsConfig !== \"boolean\";\n\n const featureFlags = await sdk.getFeatureFlags();\n if (featureFlags.isFileManagerThreatDetectionEnabled()) {\n configureS3BucketMalwareProtection(app as CorePulumiApp);\n }\n\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return;\n }\n\n const { resources, addResource, onResource } = app as CorePulumiApp;\n const { useExistingVpc, useVpcEndpoints } = vpcExtensionsConfig;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (\"useVpcEndpoints\" in vpcExtensionsConfig) {\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 (opensearchExtensionConfig) {\n if (!useExistingVpc.openSearchDomainVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `openSearchDomainVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.opensearch.Domain)) {\n resource.config.vpcOptions(\n useExistingVpc!.openSearchDomainVpcConfig\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 const canUseVpc = resource.meta.canUseVpc !== false;\n if (canUseVpc) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\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:\n aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n\n return;\n }\n\n // 2. Now we deal with \"non-existing VPC\" setup.\n if (useVpcEndpoints) {\n const region = getAwsRegion(app);\n\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: pulumi.interpolate`com.amazonaws.${region}.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: pulumi.interpolate`com.amazonaws.${region}.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: pulumi.interpolate`com.amazonaws.${region}.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: pulumi.interpolate`com.amazonaws.${region}.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 // <-------------------- Enterprise end -------------------->\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 sdk.getContainer().registerComposite(corePulumi);\n const pulumiHandlers = sdk.getContainer().resolve(CorePulumi);\n\n app.addHandler(() => {\n return pulumiHandlers.execute(app as CorePulumiApp);\n });\n\n const isProduction = app.env.isProduction;\n const protect = isProduction;\n\n // Setup DynamoDB table\n const dynamoDbTable = app.addModule(CoreDynamo, { protect });\n const auditLogsDynamoDbTable = app.addModule(CoreAuditLogsDynamo, { protect });\n\n // Setup VPC\n const vpcEnabled =\n vpcExtensionsConfig === true ||\n typeof vpcExtensionsConfig === \"object\" ||\n isProduction;\n\n const vpc = vpcEnabled ? app.addModule(CoreVpc) : null;\n\n // Setup Cognito\n const cognito = app.addModule(CoreCognito, {\n protect,\n useEmailAsUsername: false,\n mfa: process.env.COGNITO_MFA === \"true\"\n });\n\n // Cognito custom:id was originally set to maxLength 36 (UUID). Federated OIDC\n // providers (e.g., Entra ID) can produce sub values longer than 36 chars. Since\n // Cognito doesn't allow changing custom attribute constraints after pool creation,\n // we only increase it for new deployments. Existing pools keep their original limit.\n const isNewDeployment = !coreStackOutput || Object.keys(coreStackOutput).length === 0;\n if (isNewDeployment) {\n cognito.userPool.config.schemas(schemas => {\n return schemas?.map(schema => {\n if (schema.name === \"id\") {\n return {\n ...schema,\n stringAttributeConstraints: {\n ...schema.stringAttributeConstraints,\n maxLength: \"256\"\n }\n };\n }\n return schema;\n });\n });\n } else {\n cognito.userPool.opts.ignoreChanges = [\n ...(cognito.userPool.opts.ignoreChanges || []),\n \"schemas\"\n ];\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 let opensearch;\n if (searchEngineType === \"opensearch\") {\n const prevDomainName = coreStackOutput?.opensearchDomainName;\n\n // When upgrading from old code that never stored opensearchDomainName, the old\n // code always generated domain names without any prefix (app.params.create\n // .pulumiResourceNamePrefix was never a real Pulumi param, so it returned \"\").\n // Using the SDK default \"wby-\" prefix here would generate a different name and\n // cause Pulumi to destroy and recreate the cluster.\n const isUpgradeFromOldCode =\n !!coreStackOutput?.primaryDynamodbTableName && !prevDomainName;\n const namePrefixForOs = isUpgradeFromOldCode ? \"\" : pulumiResourceNamePrefix || \"\";\n\n opensearch = app.addModule(OpenSearch, {\n protect,\n namePrefix: namePrefixForOs,\n prevDomainName\n });\n }\n\n app.addModule(WatchCommand, { deploymentId: deploymentId.hex });\n\n app.addOutputs({\n deploymentId: deploymentId.hex,\n region: aws.config.region,\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 auditLogsDynamodbTableArn: auditLogsDynamoDbTable.output.arn,\n auditLogsDynamodbTableName: auditLogsDynamoDbTable.output.name,\n auditLogsDynamodbTableHashKey: auditLogsDynamoDbTable.output.hashKey,\n auditLogsDynamodbTableRangeKey: auditLogsDynamoDbTable.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 eventBusName: eventBus.output.name,\n eventBusArn: eventBus.output.arn\n });\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"core\");\n\n return {\n dynamoDbTable,\n vpc,\n ...cognito,\n fileManagerBucket,\n eventBus,\n opensearch\n };\n }\n });\n\n const app = withServiceManifest(baseApp, manifests => {\n const dynamoTable = baseApp.resources.dynamoDbTable;\n\n const table: TableDefinition = {\n tableName: dynamoTable.output.name,\n hashKey: dynamoTable.output.hashKey,\n rangeKey: dynamoTable.output.rangeKey\n };\n\n manifests.forEach(manifest => addServiceManifestTableItem(baseApp, table, manifest));\n });\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"core\",\n manifest: {\n eventBus: {\n arn: baseApp.resources.eventBus.output.arn,\n name: baseApp.resources.eventBus.output.name\n },\n dynamodbTable: {\n arn: baseApp.resources.dynamoDbTable.output.arn,\n name: baseApp.resources.dynamoDbTable.output.name,\n hashKey: baseApp.resources.dynamoDbTable.output.hashKey,\n rangeKey: baseApp.resources.dynamoDbTable.output.rangeKey\n }\n }\n });\n });\n\n return app;\n}\n"],"names":["createCorePulumiApp","baseApp","createPulumiApp","app","sdk","getProjectSdk","projectConfig","pulumiResourceNamePrefix","coreStackOutput","vpcExtensionsConfig","getVpcConfigFromExtension","opensearchExtensionConfig","getOsConfigFromExtension","deploymentId","random","searchEngineType","searchEngineParams","params","process","resource","usingAdvancedVpcParams","featureFlags","configureS3BucketMalwareProtection","resources","addResource","onResource","useExistingVpc","useVpcEndpoints","Error","isResourceOfType","aws","canUseVpc","region","getAwsRegion","vpc","subnets","routeTables","pulumi","subNet","corePulumi","pulumiHandlers","CorePulumi","isProduction","protect","dynamoDbTable","CoreDynamo","auditLogsDynamoDbTable","CoreAuditLogsDynamo","vpcEnabled","CoreVpc","cognito","CoreCognito","isNewDeployment","Object","schemas","schema","eventBus","CoreEventBus","fileManagerBucket","CoreFileManger","opensearch","prevDomainName","isUpgradeFromOldCode","namePrefixForOs","OpenSearch","WatchCommand","applyAwsResourceTags","withServiceManifest","manifests","dynamoTable","table","manifest","addServiceManifestTableItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BO,SAASA;IACZ,MAAMC,UAAUC,gBAAgB;QAC5B,MAAM;QACN,MAAM;QACN,SAAS,OAAMC;YACX,MAAMC,MAAM,MAAMC;YAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;YAEhD,MAAMG,2BAA2B,MAAMH,IAAI,2BAA2B;YACtE,MAAMI,kBAAkB,MAAMJ,IAAI,iBAAiB,CAGhD;YACH,MAAMK,sBAAsBC,0BAA0BJ;YACtD,MAAMK,4BAA4BC,yBAAyBN;YAE3D,MAAMO,eAAe,IAAIC,0CAAAA,QAAe,CAAC,gBAAgB;gBAAE,YAAY;YAAE;YAEzE,IAAIC,mBAAwC;YAC5C,IAAIC,qBAA8D;YAElE,IAAIL,2BAA2B;gBAC3BK,qBAAqBL;gBACrBI,mBAAmB;YACvB;YAEA,IAAIC,oBAAoB;gBACpB,MAAMC,SAASD;gBACf,IAAI,AAAkB,YAAlB,OAAOC,QAAqB;oBAC5B,IAAIA,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,m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SAASA,YAAY,MAAM,CAAC,OAAO;YACnC,UAAUA,YAAY,MAAM,CAAC,QAAQ;QACzC;QAEAD,UAAU,OAAO,CAACG,CAAAA,WAAYC,4BAA4BvE,SAASqE,OAAOC;IAC9E;IAEApE,IAAI,UAAU,CAAC;QACXA,IAAI,kBAAkB,CAAC;YACnB,MAAM;YACN,UAAU;gBACN,UAAU;oBACN,KAAKF,QAAQ,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG;oBAC1C,MAAMA,QAAQ,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI;gBAChD;gBACA,eAAe;oBACX,KAAKA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG;oBAC/C,MAAMA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI;oBACjD,SAASA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO;oBACvD,UAAUA,QAAQ,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ;gBAC7D;YACJ;QACJ;IACJ;IAEA,OAAOE;AACX"}
|
|
1
|
+
{"version":3,"file":"pulumi/apps/core/createCorePulumiApp.js","sources":["../../../../src/pulumi/apps/core/createCorePulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createPulumiApp, isResourceOfType } from \"@webiny/pulumi\";\nimport { CoreCognito } from \"./CoreCognito.js\";\nimport { CoreDynamo } from \"./CoreDynamo.js\";\nimport { OpenSearch } from \"./CoreOpenSearch.js\";\nimport { CoreEventBus } from \"./CoreEventBus.js\";\nimport { CoreFileManger } from \"./CoreFileManager.js\";\nimport { CoreVpc } from \"./CoreVpc.js\";\nimport { WatchCommand } from \"./WatchCommand.js\";\nimport { withServiceManifest } from \"~/pulumi/utils/withServiceManifest.js\";\nimport {\n addServiceManifestTableItem,\n type TableDefinition\n} from \"~/pulumi/utils/addServiceManifestTableItem.js\";\nimport * as random from \"@pulumi/random\";\n\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport { CorePulumi } from \"~/abstractions/features/pulumi/index.js\";\nimport { corePulumi } from \"~/pulumi/features/CorePulumi/index.js\";\nimport { getOsConfigFromExtension } from \"~/pulumi/apps/extensions/getOsConfigFromExtension.js\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { applyAwsResourceTags, getAwsRegion } from \"~/pulumi/apps/awsUtils.js\";\nimport { configureS3BucketMalwareProtection } from \"./configureS3BucketMalwareProtection.js\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { CoreAuditLogsDynamo } from \"~/pulumi/index.js\";\n\nexport type CorePulumiApp = ReturnType<typeof createCorePulumiApp>;\n\nexport function createCorePulumiApp() {\n const baseApp = createPulumiApp({\n name: \"core\",\n path: \"apps/core\",\n program: async app => {\n const sdk = await getAwsProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n const coreStackOutput = await sdk.getAppStackOutput<{\n opensearchDomainName?: string;\n primaryDynamodbTableName?: string;\n }>(\"core\");\n const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);\n const opensearchExtensionConfig = getOsConfigFromExtension(projectConfig);\n\n const deploymentId = new random.RandomId(\"deploymentId\", { byteLength: 8 });\n\n let searchEngineType: \"opensearch\" | null = null;\n let searchEngineParams: typeof opensearchExtensionConfig | null = null;\n\n if (opensearchExtensionConfig) {\n searchEngineParams = opensearchExtensionConfig;\n searchEngineType = \"opensearch\";\n }\n\n if (searchEngineParams) {\n const params = searchEngineParams;\n if (typeof params === \"object\") {\n if (params.endpoint) {\n process.env.OPENSEARCH_ENDPOINT = params.endpoint;\n }\n\n if (params.domainName) {\n process.env.AWS_OS_DOMAIN_NAME = params.domainName;\n }\n\n if (params.indexPrefix) {\n process.env.OPENSEARCH_INDEX_PREFIX = params.indexPrefix;\n }\n\n if (params.sharedIndexes) {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n }\n\n if (params.username) {\n process.env.OPENSEARCH_USERNAME = params.username;\n }\n\n if (params.password) {\n process.env.OPENSEARCH_PASSWORD = params.password;\n }\n }\n }\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 // <-------------------- Enterprise start -------------------->\n app.addHandler(async () => {\n const usingAdvancedVpcParams =\n vpcExtensionsConfig && typeof vpcExtensionsConfig !== \"boolean\";\n\n const featureFlags = await sdk.getFeatureFlags();\n if (featureFlags.isFileManagerThreatDetectionEnabled()) {\n configureS3BucketMalwareProtection(app as CorePulumiApp);\n }\n\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return;\n }\n\n const { resources, addResource, onResource } = app as CorePulumiApp;\n const { useExistingVpc, useVpcEndpoints } = vpcExtensionsConfig;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (\"useVpcEndpoints\" in vpcExtensionsConfig) {\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 (opensearchExtensionConfig) {\n if (!useExistingVpc.openSearchDomainVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `openSearchDomainVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.opensearch.Domain)) {\n resource.config.vpcOptions(\n useExistingVpc!.openSearchDomainVpcConfig\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 const canUseVpc = resource.meta.canUseVpc !== false;\n if (canUseVpc) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\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:\n aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n\n return;\n }\n\n // 2. Now we deal with \"non-existing VPC\" setup.\n if (useVpcEndpoints) {\n const region = getAwsRegion(app);\n\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: pulumi.interpolate`com.amazonaws.${region}.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: pulumi.interpolate`com.amazonaws.${region}.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: pulumi.interpolate`com.amazonaws.${region}.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: pulumi.interpolate`com.amazonaws.${region}.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 // <-------------------- Enterprise end -------------------->\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 sdk.getContainer().registerComposite(corePulumi);\n const pulumiHandlers = sdk.getContainer().resolve(CorePulumi);\n\n app.addHandler(() => {\n return pulumiHandlers.execute(app as CorePulumiApp);\n });\n\n const isProduction = app.env.isProduction;\n const protect = isProduction;\n\n // Setup DynamoDB table\n const dynamoDbTable = app.addModule(CoreDynamo, { protect });\n const auditLogsDynamoDbTable = app.addModule(CoreAuditLogsDynamo, { protect });\n\n // Setup VPC\n const vpcEnabled =\n vpcExtensionsConfig === true ||\n typeof vpcExtensionsConfig === \"object\" ||\n isProduction;\n\n const vpc = vpcEnabled ? app.addModule(CoreVpc) : null;\n\n // Setup Cognito\n const cognito = app.addModule(CoreCognito, {\n protect,\n 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 let opensearch;\n if (searchEngineType === \"opensearch\") {\n const prevDomainName = coreStackOutput?.opensearchDomainName;\n\n // When upgrading from old code that never stored opensearchDomainName, the old\n // code always generated domain names without any prefix (app.params.create\n // .pulumiResourceNamePrefix was never a real Pulumi param, so it returned \"\").\n // Using the SDK default \"wby-\" prefix here would generate a different name and\n // cause Pulumi to destroy and recreate the cluster.\n const isUpgradeFromOldCode =\n !!coreStackOutput?.primaryDynamodbTableName && !prevDomainName;\n const namePrefixForOs = isUpgradeFromOldCode ? \"\" : pulumiResourceNamePrefix || \"\";\n\n opensearch = app.addModule(OpenSearch, {\n protect,\n namePrefix: namePrefixForOs,\n prevDomainName\n });\n }\n\n app.addModule(WatchCommand, { deploymentId: deploymentId.hex });\n\n app.addOutputs({\n deploymentId: deploymentId.hex,\n region: aws.config.region,\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 auditLogsDynamodbTableArn: auditLogsDynamoDbTable.output.arn,\n auditLogsDynamodbTableName: auditLogsDynamoDbTable.output.name,\n auditLogsDynamodbTableHashKey: auditLogsDynamoDbTable.output.hashKey,\n auditLogsDynamodbTableRangeKey: auditLogsDynamoDbTable.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 eventBusName: eventBus.output.name,\n eventBusArn: eventBus.output.arn\n });\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"core\");\n\n return {\n dynamoDbTable,\n vpc,\n ...cognito,\n fileManagerBucket,\n eventBus,\n opensearch\n };\n }\n });\n\n const app = withServiceManifest(baseApp, manifests => {\n const dynamoTable = baseApp.resources.dynamoDbTable;\n\n const table: TableDefinition = {\n tableName: dynamoTable.output.name,\n hashKey: dynamoTable.output.hashKey,\n rangeKey: dynamoTable.output.rangeKey\n };\n\n manifests.forEach(manifest => addServiceManifestTableItem(baseApp, table, manifest));\n });\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"core\",\n manifest: {\n eventBus: {\n arn: baseApp.resources.eventBus.output.arn,\n name: baseApp.resources.eventBus.output.name\n },\n dynamodbTable: {\n arn: baseApp.resources.dynamoDbTable.output.arn,\n name: baseApp.resources.dynamoDbTable.output.name,\n hashKey: baseApp.resources.dynamoDbTable.output.hashKey,\n rangeKey: baseApp.resources.dynamoDbTable.output.rangeKey\n }\n }\n });\n });\n\n return app;\n}\n"],"names":["createCorePulumiApp","baseApp","createPulumiApp","app","sdk","getAwsProjectSdk","projectConfig","pulumiResourceNamePrefix","coreStackOutput","vpcExtensionsConfig","getVpcConfigFromExtension","opensearchExtensionConfig","getOsConfigFromExtension","deploymentId","random","searchEngineType","searchEngineParams","params","process","resource","usingAdvancedVpcParams","featureFlags","configureS3BucketMalwareProtection","resources","addResource","onResource","useExistingVpc","useVpcEndpoints","Error","isResourceOfType","aws","canUseVpc","region","getAwsRegion","vpc","subnets","routeTables","pulumi","subNet","corePulumi","pulumiHandlers","CorePulumi","isProduction","protect","dynamoDbTable","CoreDynamo","auditLogsDynamoDbTable","CoreAuditLogsDynamo","vpcEnabled","CoreVpc","cognito","CoreCognito","eventBus","CoreEventBus","fileManagerBucket","CoreFileManger","opensearch","prevDomainName","isUpgradeFromOldCode","namePrefixForOs","OpenSearch","WatchCommand","applyAwsResourceTags","withServiceManifest","manifests","dynamoTable","table","manifest","addServiceManifestTableItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BO,SAASA;IACZ,MAAMC,UAAUC,gBAAgB;QAC5B,MAAM;QACN,MAAM;QACN,SAAS,OAAMC;YACX,MAAMC,MAAM,MAAMC;YAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;YAEhD,MAAMG,2BAA2B,MAAMH,IAAI,2BAA2B;YACtE,MAAMI,kBAAkB,MAAMJ,IAAI,iBAAiB,CAGhD;YACH,MAAMK,sBAAsBC,0BAA0BJ;YACtD,MAAMK,4BAA4BC,yBAAyBN;YAE3D,MAAMO,eAAe,IAAIC,0CAAAA,QAAe,CAAC,gBAAgB;gBAAE,YAAY;YAAE;YAEzE,IAAIC,mBAAwC;YAC5C,IAAIC,qBAA8D;YAElE,IAAIL,2BAA2B;gBAC3BK,qBAAqBL;gBACrBI,mBAAmB;YACvB;YAEA,IAAIC,oBAAoB;gBACpB,MAAMC,SAASD;gBACf,IAAI,AAAkB,YAAlB,OAAOC,QAAqB;oBAC5B,IAAIA,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OAAO,QAAQ;oBAGrD,IAAIA,OAAO,UAA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S,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ;gBAC7D;YACJ;QACJ;IACJ;IAEA,OAAOE;AACX"}
|
|
@@ -3,13 +3,13 @@ export declare const getVpcConfigFromExtension: (projectConfig: IProjectConfigMo
|
|
|
3
3
|
enabled: boolean;
|
|
4
4
|
useVpcEndpoints?: boolean | undefined;
|
|
5
5
|
useExistingVpc?: {
|
|
6
|
-
lambdaFunctionsVpcConfig: {
|
|
7
|
-
securityGroupIds: string[];
|
|
8
|
-
subnetIds: string[];
|
|
9
|
-
};
|
|
10
6
|
openSearchDomainVpcConfig?: {
|
|
11
7
|
securityGroupIds: string[];
|
|
12
8
|
subnetIds: string[];
|
|
13
9
|
} | undefined;
|
|
10
|
+
lambdaFunctionsVpcConfig: {
|
|
11
|
+
securityGroupIds: string[];
|
|
12
|
+
subnetIds: string[];
|
|
13
|
+
};
|
|
14
14
|
} | undefined;
|
|
15
15
|
}, "enabled"> | undefined;
|
|
@@ -21,7 +21,6 @@ export interface CreateReactPulumiAppParams {
|
|
|
21
21
|
pulumi?: (app: ReactPulumiApp) => void | Promise<void>;
|
|
22
22
|
}
|
|
23
23
|
export declare const createReactPulumiApp: (projectAppParams: CreateReactPulumiAppParams) => import("@webiny/pulumi").PulumiApp<{
|
|
24
|
-
cloudfront: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/distribution.js").Distribution>;
|
|
25
24
|
bucket: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucket.js").Bucket>;
|
|
26
25
|
bucketOwnershipControls: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketOwnershipControls.js").BucketOwnershipControls>;
|
|
27
26
|
bucketAcl: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketAcl.js").BucketAcl>;
|
|
@@ -29,4 +28,5 @@ export declare const createReactPulumiApp: (projectAppParams: CreateReactPulumiA
|
|
|
29
28
|
origin: aws.types.input.cloudfront.DistributionOrigin;
|
|
30
29
|
bucketPublicAccessBlock: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketPublicAccessBlock.js").BucketPublicAccessBlock>;
|
|
31
30
|
bucketPolicy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketPolicy.js").BucketPolicy>;
|
|
31
|
+
cloudfront: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/distribution.js").Distribution>;
|
|
32
32
|
}> & import("~/pulumi/utils/withServiceManifest.js").WithServiceManifest;
|
|
@@ -4,7 +4,7 @@ import { createPrivateAppBucket } from "../createAppBucket.js";
|
|
|
4
4
|
import { applyCustomDomain } from "../customDomain.js";
|
|
5
5
|
import { withServiceManifest } from "../../utils/withServiceManifest.js";
|
|
6
6
|
import { ApiOutput, CoreOutput } from "../index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getAwsProjectSdk } from "../../getAwsProjectSdk.js";
|
|
8
8
|
import { applyAwsResourceTags } from "../awsUtils.js";
|
|
9
9
|
import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
|
|
10
10
|
import * as __rspack_external__pulumi_pulumi_f3e773ed from "@pulumi/pulumi";
|
|
@@ -14,7 +14,7 @@ const createReactPulumiApp = (projectAppParams)=>{
|
|
|
14
14
|
path: projectAppParams.folder,
|
|
15
15
|
config: projectAppParams,
|
|
16
16
|
program: async (app)=>{
|
|
17
|
-
const sdk = await
|
|
17
|
+
const sdk = await getAwsProjectSdk();
|
|
18
18
|
const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();
|
|
19
19
|
if (pulumiResourceNamePrefix) app.onResource((resource)=>{
|
|
20
20
|
if (!resource.name.startsWith(pulumiResourceNamePrefix)) resource.name = `${pulumiResourceNamePrefix}${resource.name}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/react/createReactPulumiApp.js","sources":["../../../../src/pulumi/apps/react/createReactPulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { createPulumiApp, type PulumiAppParamCallback } from \"@webiny/pulumi\";\nimport { addDomainsUrlsOutputs } from \"~/pulumi/utils/index.js\";\nimport { createPrivateAppBucket } from \"../createAppBucket.js\";\nimport { applyCustomDomain, type CustomDomainParams } from \"../customDomain.js\";\nimport { withServiceManifest } from \"~/pulumi/utils/withServiceManifest.js\";\nimport { ApiOutput, CoreOutput } from \"~/pulumi/apps/index.js\";\nimport { type AppName, getProjectSdk } from \"@webiny/project\";\nimport { applyAwsResourceTags } from \"~/pulumi/apps/awsUtils.js\";\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: AppName;\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\nexport const createReactPulumiApp = (projectAppParams: CreateReactPulumiAppParams) => {\n const app = createPulumiApp({\n name: projectAppParams.name,\n path: projectAppParams.folder,\n config: projectAppParams,\n program: async app => {\n const sdk = await getProjectSdk();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\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 app.addModule(ApiOutput);\n\n // Overrides must be applied at the very start of the program, before other resources\n // (e.g. the CloudFront distribution) are added. The callback registers its work via\n // `app.addHandler`, so invoking it directly here (instead of wrapping it in yet another\n // handler) ensures those handlers are queued before - and therefore run before - the\n // resources they adjust get instantiated. This also mirrors how the API app behaves.\n if (projectAppParams.pulumi) {\n await projectAppParams.pulumi(app as unknown as ReactPulumiApp);\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 httpVersion: \"http2and3\",\n enabled: true,\n waitForDeployment: true,\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 opts: {\n // We are ignoring changes to the \"staging\" property. This is because of the following.\n // With the 5.41.0 release of Webiny, we also upgraded Pulumi to v6. This introduced a change\n // with how Cloudfront distributions are deployed, where Pulumi now also controls the new\n // `staging` property.\n // If not set, Pulumi will default it to `false`. Which is fine, but, the problem is\n // that, because this property did not exist before, it will always be considered as a change\n // upon deployment.\n // We might think this is fine, but, the problem is that a change in this property causes\n // a full replacement of the Cloudfront distribution, which is not acceptable. Especially\n // if a custom domain has already been associated with the distribution. This then would\n // require the user to disassociate the domain, wait for the distribution to be replaced,\n // and then re-associate the domain. This is not a good experience.\n ignoreChanges: [\"staging\"]\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 app.addHandler(() => {\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\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(name);\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\": \"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 return withServiceManifest(app);\n};\n"],"names":["createReactPulumiApp","projectAppParams","app","createPulumiApp","sdk","getProjectSdk","pulumiResourceNamePrefix","resource","name","core","CoreOutput","ApiOutput","bucket","createPrivateAppBucket","cloudfront","aws","domains","applyCustomDomain","addDomainsUrlsOutputs","applyAwsResourceTags","pulumi","key","value","withServiceManifest"],"mappings":";;;;;;;;;;AAkCO,MAAMA,uBAAuB,CAACC;IACjC,MAAMC,MAAMC,gBAAgB;QACxB,MAAMF,iBAAiB,IAAI;QAC3B,MAAMA,iBAAiB,MAAM;QAC7B,QAAQA;QACR,SAAS,OAAMC;YACX,MAAME,MAAM,MAAMC;YAElB,MAAMC,2BAA2B,MAAMF,IAAI,2BAA2B;YAEtE,IAAIE,0BACAJ,IAAI,UAAU,CAACK,CAAAA;gBACX,IAAI,CAACA,SAAS,IAAI,CAAC,UAAU,CAACD,2BAC1BC,SAAS,IAA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gBACXgB,sBAAsB;oBAClBhB;oBACA,wBAAwBY;oBACxB,KAAK;wBACD,oBAAoB;wBACpB,iBAAiB;wBACjB,YAAY;wBACZ,SAAS;oBACb;gBACJ;YACJ;YAGA,MAAMK,qBAAqBX;YAK3BN,IAAI,WAAW,CAACa,uCAAAA,QAAAA,CAAAA,SAAsB,EAAE;gBACpC,MAAM;gBACN,QAAQ;oBACJ,WAAWN,KAAK,wBAAwB;oBACxC,SAASA,KAAK,2BAA2B;oBACzC,UAAUW,0CAAAA,MACC,CAACX,KAAK,4BAA4B,EACxC,KAAK,CAACY,CAAAA,MAAOA,OAAO;oBACzB,MAAMD,0CAAAA,WAAkB,CAAC;;;;;;sCAMP,EAAEN,WAAW,MAAM,CAAC,UAAU,CAAC,KAAK,CACtCQ,CAAAA,QAAS,CAAC,QAAQ,EAAEA,OAAO,EAC7B;;;;yBAIT,CAAC;gBACV;YACJ;YAEA,OAAO;gBACH,GAAGV,MAAM;gBACTE;YACJ;QACJ;IACJ;IAEA,OAAOS,oBAAoBrB;AAC/B"}
|
|
1
|
+
{"version":3,"file":"pulumi/apps/react/createReactPulumiApp.js","sources":["../../../../src/pulumi/apps/react/createReactPulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { createPulumiApp, type PulumiAppParamCallback } from \"@webiny/pulumi\";\nimport { addDomainsUrlsOutputs } from \"~/pulumi/utils/index.js\";\nimport { createPrivateAppBucket } from \"../createAppBucket.js\";\nimport { applyCustomDomain, type CustomDomainParams } from \"../customDomain.js\";\nimport { withServiceManifest } from \"~/pulumi/utils/withServiceManifest.js\";\nimport { ApiOutput, CoreOutput } from \"~/pulumi/apps/index.js\";\nimport { type AppName } from \"@webiny/project\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport { applyAwsResourceTags } from \"~/pulumi/apps/awsUtils.js\";\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: AppName;\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\nexport const createReactPulumiApp = (projectAppParams: CreateReactPulumiAppParams) => {\n const app = createPulumiApp({\n name: projectAppParams.name,\n path: projectAppParams.folder,\n config: projectAppParams,\n program: async app => {\n const sdk = await getAwsProjectSdk();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\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 app.addModule(ApiOutput);\n\n // Overrides must be applied at the very start of the program, before other resources\n // (e.g. the CloudFront distribution) are added. The callback registers its work via\n // `app.addHandler`, so invoking it directly here (instead of wrapping it in yet another\n // handler) ensures those handlers are queued before - and therefore run before - the\n // resources they adjust get instantiated. This also mirrors how the API app behaves.\n if (projectAppParams.pulumi) {\n await projectAppParams.pulumi(app as unknown as ReactPulumiApp);\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 httpVersion: \"http2and3\",\n enabled: true,\n waitForDeployment: true,\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 opts: {\n // We are ignoring changes to the \"staging\" property. This is because of the following.\n // With the 5.41.0 release of Webiny, we also upgraded Pulumi to v6. This introduced a change\n // with how Cloudfront distributions are deployed, where Pulumi now also controls the new\n // `staging` property.\n // If not set, Pulumi will default it to `false`. Which is fine, but, the problem is\n // that, because this property did not exist before, it will always be considered as a change\n // upon deployment.\n // We might think this is fine, but, the problem is that a change in this property causes\n // a full replacement of the Cloudfront distribution, which is not acceptable. Especially\n // if a custom domain has already been associated with the distribution. This then would\n // require the user to disassociate the domain, wait for the distribution to be replaced,\n // and then re-associate the domain. This is not a good experience.\n ignoreChanges: [\"staging\"]\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 app.addHandler(() => {\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\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(name);\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\": \"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 return withServiceManifest(app);\n};\n"],"names":["createReactPulumiApp","projectAppParams","app","createPulumiApp","sdk","getAwsProjectSdk","pulumiResourceNamePrefix","resource","name","core","CoreOutput","ApiOutput","bucket","createPrivateAppBucket","cloudfront","aws","domains","applyCustomDomain","addDomainsUrlsOutputs","applyAwsResourceTags","pulumi","key","value","withServiceManifest"],"mappings":";;;;;;;;;;AAmCO,MAAMA,uBAAuB,CAACC;IACjC,MAAMC,MAAMC,gBAAgB;QACxB,MAAMF,iBAAiB,IAAI;QAC3B,MAAMA,iBAAiB,MAAM;QAC7B,QAAQA;QACR,SAAS,OAAMC;YACX,MAAME,MAAM,MAAMC;YAElB,MAAMC,2BAA2B,MAAMF,IAAI,2BAA2B;YAEtE,IAAIE,0BACAJ,IAAI,UAAU,CAACK,CAAAA;gBACX,IAAI,CAACA,SAAS,IAAI,CAAC,UAAU,CAACD,2BAC1BC,SAAS,IAAI,GAAG,GAAGD,2BAA2BC,SAAS,IAAI,EAAE;YAErE;YAGJ,MAAM,EAAEC,IAAI,EAAE,GAAGP;YAGjB,MAAMQ,OAAOP,IAAI,SAAS,CAACQ;YAC3BR,IAAI,SAAS,CAACS;YAOd,IAAIV,iBAAiB,MAAM,EACvB,MAAMA,iBAAiB,MAAM,CAACC;YAGlC,MAAMU,SAASC,uBAAuBX,KAAK,GAAGM,KAAK,IAAI,CAAC;YAExD,MAAMM,aAAaZ,IAAI,WAAW,CAACa,uCAAAA,UAAAA,CAAAA,YAA2B,EAAE;gBAC5D,MAAM,GAAGP,KAAK,QAAQ,CAAC;gBACvB,QAAQ;oBACJ,aAAa;oBACb,SAAS;oBACT,mBAA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,MAAM,CAAC,UAAU,CAAC,KAAK,CACtCQ,CAAAA,QAAS,CAAC,QAAQ,EAAEA,OAAO,EAC7B;;;;yBAIT,CAAC;gBACV;YACJ;YAEA,OAAO;gBACH,GAAGV,MAAM;gBACTE;YACJ;QACJ;IACJ;IAEA,OAAOS,oBAAoBrB;AAC/B"}
|
|
@@ -6,7 +6,7 @@ import { SyncSystemEventBus } from "./SyncSystemEventBus.js";
|
|
|
6
6
|
import { customApp } from "./customApp.js";
|
|
7
7
|
import { SyncSystemDynamoDb } from "./SyncSystemDynamoDb.js";
|
|
8
8
|
import { SyncSystemWorkerLambda } from "./SyncSystemWorkerLambda.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getAwsProjectSdk } from "../../getAwsProjectSdk.js";
|
|
10
10
|
import { getVpcConfigFromExtension } from "../extensions/getVpcConfigFromExtension.js";
|
|
11
11
|
import { applyAwsResourceTags } from "../awsUtils.js";
|
|
12
12
|
import * as __rspack_external__pulumi_pulumi_f3e773ed from "@pulumi/pulumi";
|
|
@@ -16,7 +16,7 @@ function createSyncSystemPulumiApp() {
|
|
|
16
16
|
name: "sync",
|
|
17
17
|
path: APPS_SYNC_SYSTEM_PATH,
|
|
18
18
|
program: async (app)=>{
|
|
19
|
-
const sdk = await
|
|
19
|
+
const sdk = await getAwsProjectSdk();
|
|
20
20
|
const projectConfig = await sdk.getProjectConfig();
|
|
21
21
|
const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();
|
|
22
22
|
const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/syncSystem/createSyncSystemPulumiApp.js","sources":["../../../../src/pulumi/apps/syncSystem/createSyncSystemPulumiApp.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport { createPulumiApp, isResourceOfType } from \"@webiny/pulumi\";\nimport { SyncSystemSQS } from \"./SyncSystemSQS.js\";\nimport { SyncSystemResolverLambda } from \"./SyncSystemResolverLambda.js\";\nimport type { IGetSyncSystemOutputResult, PulumiOutput } from \"./types.js\";\nimport { APPS_SYNC_SYSTEM_PATH } from \"./constants.js\";\nimport { SyncSystemEventBus } from \"./SyncSystemEventBus.js\";\nimport { customApp } from \"./customApp.js\";\nimport { SyncSystemDynamoDb } from \"~/pulumi/apps/syncSystem/SyncSystemDynamoDb.js\";\nimport { SyncSystemWorkerLambda } from \"~/pulumi/apps/syncSystem/SyncSystemWorkerLambda.js\";\nimport { getProjectSdk } from \"@webiny/project\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { applyAwsResourceTags } from \"~/pulumi/apps/awsUtils.js\";\n\nexport function createSyncSystemPulumiApp() {\n return createPulumiApp({\n name: \"sync\",\n path: APPS_SYNC_SYSTEM_PATH,\n program: async app => {\n const sdk = await getProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n\n const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);\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 // <-------------------- Enterprise start -------------------->\n app.addHandler(async () => {\n const usingAdvancedVpcParams =\n vpcExtensionsConfig && typeof vpcExtensionsConfig !== \"boolean\";\n\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return;\n }\n\n const { onResource, addResource } = app;\n const { useExistingVpc } = vpcExtensionsConfig;\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 const canUseVpc = resource.meta.canUseVpc !== false;\n if (canUseVpc) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\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:\n aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n }\n\n return;\n });\n // <-------------------- Enterprise end -------------------->\n\n const protect = app.env.isProduction;\n const regionApp = customApp({\n app,\n protect\n });\n /**\n * Sync System services.\n */\n const { sqsQueue } = regionApp.addModule(SyncSystemSQS);\n const dynamoDb = regionApp.addModule(SyncSystemDynamoDb);\n\n const workerLambda = regionApp.addModule(SyncSystemWorkerLambda);\n\n const resolverLambda = regionApp.addModule(SyncSystemResolverLambda);\n const { eventBusRule, eventBus, eventBusTarget, eventBusPolicy } =\n regionApp.addModule(SyncSystemEventBus);\n\n const output: PulumiOutput<IGetSyncSystemOutputResult> = {\n /**\n * Region provider.\n */\n region: pulumi.output(process.env.AWS_REGION as string),\n /**\n * SyncSystemSQS\n */\n sqsUrl: sqsQueue.output.url,\n sqsArn: sqsQueue.output.arn,\n sqsName: sqsQueue.output.name,\n /**\n * DynamoDB\n */\n dynamoDbArn: dynamoDb.output.arn,\n dynamoDbName: dynamoDb.output.name,\n dynamoDbHashKey: dynamoDb.output.hashKey,\n dynamoDbRangeKey: dynamoDb.output.rangeKey as pulumi.Output<string>,\n /**\n * SyncSystemResolverLambda\n */\n resolverLambdaArn: resolverLambda.lambda.output.arn,\n resolverLambdaName: resolverLambda.lambda.output.name,\n resolverLambdaRoleArn: resolverLambda.role.output.arn,\n resolverLambdaRoleName: resolverLambda.role.output.name,\n resolverLambdaRoleId: resolverLambda.role.output.id,\n resolverLambdaPolicyArn: resolverLambda.policy.output.arn,\n resolverLambdaPolicyName: resolverLambda.policy.output.name,\n resolverLambdaPolicyId: resolverLambda.policy.output.id,\n resolverLambdaEventSourceMappingArn: resolverLambda.eventSourceMapping.output.arn,\n resolverLambdaEventSourceMappingId: resolverLambda.eventSourceMapping.output.id,\n // # We can safely cast as we know that the property exists.\n resolverLambdaEventSourceMappingEventSourceArn: resolverLambda.eventSourceMapping\n .output.eventSourceArn as pulumi.Output<string>,\n /**\n * SyncSystemWorkerLambda\n */\n workerLambdaArn: workerLambda.lambda.output.arn,\n workerLambdaName: workerLambda.lambda.output.name,\n workerLambdaRoleArn: workerLambda.role.output.arn,\n workerLambdaRoleName: workerLambda.role.output.name,\n /**\n * SyncSystemEventBus\n */\n eventBusArn: eventBus.output.arn,\n eventBusName: eventBus.output.name,\n eventBusRuleArn: eventBusRule.output.arn,\n eventBusRuleName: eventBusRule.output.id,\n eventBusTargetArn: eventBusTarget.output.arn,\n eventBusPolicyId: eventBusPolicy.output.id,\n eventBusPolicyUrn: eventBusPolicy.output.urn,\n eventBusPolicyQueueUrl: eventBusPolicy.output.queueUrl\n };\n app.addOutputs(output);\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"sync\");\n\n return {\n sqs: sqsQueue.output,\n dynamoDb: dynamoDb.output,\n eventBus: eventBus.output,\n eventBusRule: eventBusRule.output,\n eventBusTarget: eventBusTarget.output,\n eventBusPolicy: eventBusPolicy.output,\n /**\n * Worker Lambda - used to resolve actions triggered by the resolver Lambda.\n */\n workerLambda: workerLambda.lambda.output,\n workerLambdaRole: workerLambda.role.output,\n /**\n * Resolver Lambda - gets hit by SQS and resolves the data.\n */\n resolverLambda: resolverLambda.lambda.output,\n resolverLambdaRole: resolverLambda.role.output,\n resolverLambdaPolicy: resolverLambda.policy.output,\n resolverLambdaEventSourceMapping: resolverLambda.eventSourceMapping.output,\n /**\n * Systems we are connecting together.\n */\n primary: {},\n secondary: {}\n };\n }\n });\n}\n"],"names":["createSyncSystemPulumiApp","createPulumiApp","APPS_SYNC_SYSTEM_PATH","app","sdk","getProjectSdk","projectConfig","pulumiResourceNamePrefix","vpcExtensionsConfig","getVpcConfigFromExtension","resource","usingAdvancedVpcParams","onResource","addResource","useExistingVpc","Error","isResourceOfType","aws","canUseVpc","protect","regionApp","customApp","sqsQueue","SyncSystemSQS","dynamoDb","SyncSystemDynamoDb","workerLambda","SyncSystemWorkerLambda","resolverLambda","SyncSystemResolverLambda","eventBusRule","eventBus","eventBusTarget","eventBusPolicy","SyncSystemEventBus","output","pulumi","process","applyAwsResourceTags"],"mappings":";;;;;;;;;;;;;AAeO,SAASA;IACZ,OAAOC,gBAAgB;QACnB,MAAM;QACN,MAAMC;QACN,SAAS,OAAMC;YACX,MAAMC,MAAM,MAAMC;YAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;YAEhD,MAAMG,2BAA2B,MAAMH,IAAI,2BAA2B;YAEtE,MAAMI,sBAAsBC,0BAA0BH;YAEtD,IAAIC,0BACAJ,IAAI,UAAU,CAACO,CAAAA;gBACX,IAAI,CAACA,SAAS,IAAI,CAAC,UAAU,CAACH,2BAC1BG,SAAS,IAAI,GAAG,GAAGH,2BAA2BG,SAAS,IAAI,EAAE;YAErE;YAIJP,IAAI,UAAU,CAAC;gBACX,MAAMQ,yBACFH,uBAAuB,AAA+B,aAA/B,OAAOA;gBAGlC,IAAI,CAACG,wBACD;gBAGJ,MAAM,EAAEC,UAAU,EAAEC,WAAW,EAAE,GAAGV;gBACpC,MAAM,EAAEW,cAAc,EAAE,GAAGN;gBAG3B,IAAIM,gBAAgB;oBAChB,IAAI,CAACA,eAAe,wBAAwB,EACxC,MAAM,IAAIC,MACN;oBAIRH,WAAWF,CAAAA;wBACP,IAAIM,iBAAiBN,UAAUO,uCAAAA,MAAAA,CAAAA,QAAmB,GAAG;4BACjD,MAAMC,YAAYR,AAA4B,UAA5BA,SAAS,IAAI,CAAC,SAAS;4BACzC,IAAIQ,WACAR,SAAS,MAAM,CAAC,SAAS,CAACI,eAAgB,wBAAwB;wB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,eAAe,MAAM;gBAIrC,cAAcP,aAAa,MAAM,CAAC,MAAM;gBACxC,kBAAkBA,aAAa,IAAI,CAAC,MAAM;gBAI1C,gBAAgBE,eAAe,MAAM,CAAC,MAAM;gBAC5C,oBAAoBA,eAAe,IAAI,CAAC,MAAM;gBAC9C,sBAAsBA,eAAe,MAAM,CAAC,MAAM;gBAClD,kCAAkCA,eAAe,kBAAkB,CAAC,MAAM;gBAI1E,SAAS,CAAC;gBACV,WAAW,CAAC;YAChB;QACJ;IACJ;AACJ"}
|
|
1
|
+
{"version":3,"file":"pulumi/apps/syncSystem/createSyncSystemPulumiApp.js","sources":["../../../../src/pulumi/apps/syncSystem/createSyncSystemPulumiApp.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport { createPulumiApp, isResourceOfType } from \"@webiny/pulumi\";\nimport { SyncSystemSQS } from \"./SyncSystemSQS.js\";\nimport { SyncSystemResolverLambda } from \"./SyncSystemResolverLambda.js\";\nimport type { IGetSyncSystemOutputResult, PulumiOutput } from \"./types.js\";\nimport { APPS_SYNC_SYSTEM_PATH } from \"./constants.js\";\nimport { SyncSystemEventBus } from \"./SyncSystemEventBus.js\";\nimport { customApp } from \"./customApp.js\";\nimport { SyncSystemDynamoDb } from \"~/pulumi/apps/syncSystem/SyncSystemDynamoDb.js\";\nimport { SyncSystemWorkerLambda } from \"~/pulumi/apps/syncSystem/SyncSystemWorkerLambda.js\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { applyAwsResourceTags } from \"~/pulumi/apps/awsUtils.js\";\n\nexport function createSyncSystemPulumiApp() {\n return createPulumiApp({\n name: \"sync\",\n path: APPS_SYNC_SYSTEM_PATH,\n program: async app => {\n const sdk = await getAwsProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n\n const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);\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 // <-------------------- Enterprise start -------------------->\n app.addHandler(async () => {\n const usingAdvancedVpcParams =\n vpcExtensionsConfig && typeof vpcExtensionsConfig !== \"boolean\";\n\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return;\n }\n\n const { onResource, addResource } = app;\n const { useExistingVpc } = vpcExtensionsConfig;\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 const canUseVpc = resource.meta.canUseVpc !== false;\n if (canUseVpc) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\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:\n aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n }\n\n return;\n });\n // <-------------------- Enterprise end -------------------->\n\n const protect = app.env.isProduction;\n const regionApp = customApp({\n app,\n protect\n });\n /**\n * Sync System services.\n */\n const { sqsQueue } = regionApp.addModule(SyncSystemSQS);\n const dynamoDb = regionApp.addModule(SyncSystemDynamoDb);\n\n const workerLambda = regionApp.addModule(SyncSystemWorkerLambda);\n\n const resolverLambda = regionApp.addModule(SyncSystemResolverLambda);\n const { eventBusRule, eventBus, eventBusTarget, eventBusPolicy } =\n regionApp.addModule(SyncSystemEventBus);\n\n const output: PulumiOutput<IGetSyncSystemOutputResult> = {\n /**\n * Region provider.\n */\n region: pulumi.output(process.env.AWS_REGION as string),\n /**\n * SyncSystemSQS\n */\n sqsUrl: sqsQueue.output.url,\n sqsArn: sqsQueue.output.arn,\n sqsName: sqsQueue.output.name,\n /**\n * DynamoDB\n */\n dynamoDbArn: dynamoDb.output.arn,\n dynamoDbName: dynamoDb.output.name,\n dynamoDbHashKey: dynamoDb.output.hashKey,\n dynamoDbRangeKey: dynamoDb.output.rangeKey as pulumi.Output<string>,\n /**\n * SyncSystemResolverLambda\n */\n resolverLambdaArn: resolverLambda.lambda.output.arn,\n resolverLambdaName: resolverLambda.lambda.output.name,\n resolverLambdaRoleArn: resolverLambda.role.output.arn,\n resolverLambdaRoleName: resolverLambda.role.output.name,\n resolverLambdaRoleId: resolverLambda.role.output.id,\n resolverLambdaPolicyArn: resolverLambda.policy.output.arn,\n resolverLambdaPolicyName: resolverLambda.policy.output.name,\n resolverLambdaPolicyId: resolverLambda.policy.output.id,\n resolverLambdaEventSourceMappingArn: resolverLambda.eventSourceMapping.output.arn,\n resolverLambdaEventSourceMappingId: resolverLambda.eventSourceMapping.output.id,\n // # We can safely cast as we know that the property exists.\n resolverLambdaEventSourceMappingEventSourceArn: resolverLambda.eventSourceMapping\n .output.eventSourceArn as pulumi.Output<string>,\n /**\n * SyncSystemWorkerLambda\n */\n workerLambdaArn: workerLambda.lambda.output.arn,\n workerLambdaName: workerLambda.lambda.output.name,\n workerLambdaRoleArn: workerLambda.role.output.arn,\n workerLambdaRoleName: workerLambda.role.output.name,\n /**\n * SyncSystemEventBus\n */\n eventBusArn: eventBus.output.arn,\n eventBusName: eventBus.output.name,\n eventBusRuleArn: eventBusRule.output.arn,\n eventBusRuleName: eventBusRule.output.id,\n eventBusTargetArn: eventBusTarget.output.arn,\n eventBusPolicyId: eventBusPolicy.output.id,\n eventBusPolicyUrn: eventBusPolicy.output.urn,\n eventBusPolicyQueueUrl: eventBusPolicy.output.queueUrl\n };\n app.addOutputs(output);\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"sync\");\n\n return {\n sqs: sqsQueue.output,\n dynamoDb: dynamoDb.output,\n eventBus: eventBus.output,\n eventBusRule: eventBusRule.output,\n eventBusTarget: eventBusTarget.output,\n eventBusPolicy: eventBusPolicy.output,\n /**\n * Worker Lambda - used to resolve actions triggered by the resolver Lambda.\n */\n workerLambda: workerLambda.lambda.output,\n workerLambdaRole: workerLambda.role.output,\n /**\n * Resolver Lambda - gets hit by SQS and resolves the data.\n */\n resolverLambda: resolverLambda.lambda.output,\n resolverLambdaRole: resolverLambda.role.output,\n resolverLambdaPolicy: resolverLambda.policy.output,\n resolverLambdaEventSourceMapping: resolverLambda.eventSourceMapping.output,\n /**\n * Systems we are connecting together.\n */\n primary: {},\n secondary: {}\n };\n }\n });\n}\n"],"names":["createSyncSystemPulumiApp","createPulumiApp","APPS_SYNC_SYSTEM_PATH","app","sdk","getAwsProjectSdk","projectConfig","pulumiResourceNamePrefix","vpcExtensionsConfig","getVpcConfigFromExtension","resource","usingAdvancedVpcParams","onResource","addResource","useExistingVpc","Error","isResourceOfType","aws","canUseVpc","protect","regionApp","customApp","sqsQueue","SyncSystemSQS","dynamoDb","SyncSystemDynamoDb","workerLambda","SyncSystemWorkerLambda","resolverLambda","SyncSystemResolverLambda","eventBusRule","eventBus","eventBusTarget","eventBusPolicy","SyncSystemEventBus","output","pulumi","process","applyAwsResourceTags"],"mappings":";;;;;;;;;;;;;AAeO,SAASA;IACZ,OAAOC,gBAAgB;QACnB,MAAM;QACN,MAAMC;QACN,SAAS,OAAMC;YACX,MAAMC,MAAM,MAAMC;YAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;YAEhD,MAAMG,2BAA2B,MAAMH,IAAI,2BAA2B;YAEtE,MAAMI,sBAAsBC,0BAA0BH;YAEtD,IAAIC,0BACAJ,IAAI,UAAU,CAACO,CAAAA;gBACX,IAAI,C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AG;gBACjD,sBAAsBA,aAAa,IAAI,CAAC,MAAM,CAAC,IAAI;gBAInD,aAAaK,SAAS,MAAM,CAAC,GAAG;gBAChC,cAAcA,SAAS,MAAM,CAAC,IAAI;gBAClC,iBAAiBD,aAAa,MAAM,CAAC,GAAG;gBACxC,kBAAkBA,aAAa,MAAM,CAAC,EAAE;gBACxC,mBAAmBE,eAAe,MAAM,CAAC,GAAG;gBAC5C,kBAAkBC,eAAe,MAAM,CAAC,EAAE;gBAC1C,mBAAmBA,eAAe,MAAM,CAAC,GAAG;gBAC5C,wBAAwBA,eAAe,MAAM,CAAC,QAAQ;YAC1D;YACA9B,IAAI,UAAU,CAACgC;YAGf,MAAMG,qBAAqB;YAE3B,OAAO;gBACH,KAAKhB,SAAS,MAAM;gBACpB,UAAUE,SAAS,MAAM;gBACzB,UAAUO,SAAS,MAAM;gBACzB,cAAcD,aAAa,MAAM;gBACjC,gBAAgBE,eAAe,MAAM;gBACrC,gBAAgBC,eAAe,MAAM;gBAIrC,cAAcP,aAAa,MAAM,CAAC,MAAM;gBACxC,kBAAkBA,aAAa,IAAI,CAAC,MAAM;gBAI1C,gBAAgBE,eAAe,MAAM,CAAC,MAAM;gBAC5C,oBAAoBA,eAAe,IAAI,CAAC,MAAM;gBAC9C,sBAAsBA,eAAe,MAAM,CAAC,MAAM;gBAClD,kCAAkCA,eAAe,kBAAkB,CAAC,MAAM;gBAI1E,SAAS,CAAC;gBACV,WAAW,CAAC;YAChB;QACJ;IACJ;AACJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { IGetSyncSystemOutputResult } from "../../../pulumi/apps/syncSystem/types.js";
|
|
2
|
-
export declare const getSyncSystemOutput: () => Promise<
|
|
2
|
+
export declare const getSyncSystemOutput: () => Promise<IGetSyncSystemOutputResult | null>;
|
|
3
3
|
export declare const asyncGetSyncSystemOutput: () => Promise<IGetSyncSystemOutputResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/syncSystem/getSyncSystemOutput.js","sources":["../../../../src/pulumi/apps/syncSystem/getSyncSystemOutput.ts"],"sourcesContent":["import { getStackOutput } from \"
|
|
1
|
+
{"version":3,"file":"pulumi/apps/syncSystem/getSyncSystemOutput.js","sources":["../../../../src/pulumi/apps/syncSystem/getSyncSystemOutput.ts"],"sourcesContent":["import { getStackOutput } from \"~/pulumi/getStackOutput.js\";\nimport type { IGetSyncSystemOutputResult } from \"~/pulumi/apps/syncSystem/types.js\";\n\nexport const getSyncSystemOutput = () => {\n return getStackOutput<IGetSyncSystemOutputResult>(\"sync\");\n};\n\nexport const asyncGetSyncSystemOutput = async (): Promise<IGetSyncSystemOutputResult> => {\n const value = await getSyncSystemOutput();\n return value!;\n};\n"],"names":["getSyncSystemOutput","getStackOutput","asyncGetSyncSystemOutput","value"],"mappings":";AAGO,MAAMA,sBAAsB,IACxBC,eAA2C;AAG/C,MAAMC,2BAA2B;IACpC,MAAMC,QAAQ,MAAMH;IACpB,OAAOG;AACX"}
|
|
@@ -17,8 +17,6 @@ export { CorePulumi };
|
|
|
17
17
|
export { ApiPulumi };
|
|
18
18
|
export { AdminPulumi };
|
|
19
19
|
export declare const definitions: (import("@webiny/project/defineExtension/index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
|
|
20
|
-
tags: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>;
|
|
21
|
-
}, import("zod/v4/core").$strip>> | import("@webiny/project/defineExtension/index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
|
|
22
20
|
enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
23
21
|
useVpcEndpoints: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
24
22
|
useExistingVpc: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -39,6 +37,8 @@ export declare const definitions: (import("@webiny/project/defineExtension/index
|
|
|
39
37
|
endpoint: import("zod").ZodOptional<import("zod").ZodString>;
|
|
40
38
|
username: import("zod").ZodOptional<import("zod").ZodString>;
|
|
41
39
|
password: import("zod").ZodOptional<import("zod").ZodString>;
|
|
40
|
+
}, import("zod/v4/core").$strip>> | import("@webiny/project/defineExtension/index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
|
|
41
|
+
tags: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>;
|
|
42
42
|
}, import("zod/v4/core").$strip>> | import("@webiny/project/defineExtension/index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
|
|
43
43
|
domains: import("zod").ZodArray<import("zod").ZodString>;
|
|
44
44
|
sslMethod: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ProjectSdk } from "@webiny/project";
|
|
2
|
+
/**
|
|
3
|
+
* ProjectSdk for the Pulumi program. The Pulumi program runs in its own process and does NOT go
|
|
4
|
+
* through the CLI's GetProjectSdkService, so it must register the AWS pulumi services itself
|
|
5
|
+
* (name prefix, stack output, …). We register only `registerAwsPulumiServices` — not the full
|
|
6
|
+
* `registerAwsProjectFeatures` — to avoid pulling in the CLI-only deploy/workspace decorators and
|
|
7
|
+
* hooks (which would, e.g., re-run workspace builders mid-deploy).
|
|
8
|
+
*
|
|
9
|
+
* Empty params → env/variant/region are picked up from the parent process via env
|
|
10
|
+
* (getProjectSdkContextFromEnv).
|
|
11
|
+
*/
|
|
12
|
+
export declare const getAwsProjectSdk: () => Promise<ProjectSdk>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ProjectSdk } from "@webiny/project";
|
|
2
|
+
import { registerAwsPulumiServices } from "../registerAwsProjectFeatures.js";
|
|
3
|
+
const getAwsProjectSdk = ()=>ProjectSdk.init({}, registerAwsPulumiServices);
|
|
4
|
+
export { getAwsProjectSdk };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=getAwsProjectSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pulumi/getAwsProjectSdk.js","sources":["../../src/pulumi/getAwsProjectSdk.ts"],"sourcesContent":["import { ProjectSdk } from \"@webiny/project\";\nimport { registerAwsPulumiServices } from \"~/registerAwsProjectFeatures.js\";\n\n/**\n * ProjectSdk for the Pulumi program. The Pulumi program runs in its own process and does NOT go\n * through the CLI's GetProjectSdkService, so it must register the AWS pulumi services itself\n * (name prefix, stack output, …). We register only `registerAwsPulumiServices` — not the full\n * `registerAwsProjectFeatures` — to avoid pulling in the CLI-only deploy/workspace decorators and\n * hooks (which would, e.g., re-run workspace builders mid-deploy).\n *\n * Empty params → env/variant/region are picked up from the parent process via env\n * (getProjectSdkContextFromEnv).\n */\nexport const getAwsProjectSdk = () => ProjectSdk.init({}, registerAwsPulumiServices);\n"],"names":["getAwsProjectSdk","ProjectSdk","registerAwsPulumiServices"],"mappings":";;AAaO,MAAMA,mBAAmB,IAAMC,WAAW,IAAI,CAAC,CAAC,GAAGC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type AppName, type IStackOutput } from "@webiny/project";
|
|
2
|
+
/**
|
|
3
|
+
* AWS-aware equivalent of `@webiny/project`'s `getStackOutput` helper: reads an app's stack output
|
|
4
|
+
* via the aws-aware SDK. The base `getStackOutput` uses `getProjectSdk()`, which lacks the pulumi
|
|
5
|
+
* services now that they live in project-aws → "No registration found for GetAppStackOutput".
|
|
6
|
+
*/
|
|
7
|
+
export declare const getStackOutput: <TOutput extends IStackOutput = IStackOutput>(appName: AppName) => Promise<TOutput | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pulumi/getStackOutput.js","sources":["../../src/pulumi/getStackOutput.ts"],"sourcesContent":["import { type AppName, type IStackOutput } from \"@webiny/project\";\nimport { getAwsProjectSdk } from \"./getAwsProjectSdk.js\";\n\n/**\n * AWS-aware equivalent of `@webiny/project`'s `getStackOutput` helper: reads an app's stack output\n * via the aws-aware SDK. The base `getStackOutput` uses `getProjectSdk()`, which lacks the pulumi\n * services now that they live in project-aws → \"No registration found for GetAppStackOutput\".\n */\nexport const getStackOutput = async <TOutput extends IStackOutput = IStackOutput>(\n appName: AppName\n): Promise<TOutput | null> => {\n const sdk = await getAwsProjectSdk();\n return sdk.getAppStackOutput<TOutput>(appName);\n};\n"],"names":["getStackOutput","appName","sdk","getAwsProjectSdk"],"mappings":";AAQO,MAAMA,iBAAiB,OAC1BC;IAEA,MAAMC,MAAM,MAAMC;IAClB,OAAOD,IAAI,iBAAiB,CAAUD;AAC1C"}
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
+
import { pickApiRuntimeEnvVariables } from "@webiny/project";
|
|
1
2
|
import * as __rspack_external__pulumi_pulumi_f3e773ed from "@pulumi/pulumi";
|
|
2
3
|
const variablesRegistry = {};
|
|
3
4
|
if ("true" === process.env.DEBUG) variablesRegistry.NODE_OPTIONS = "--enable-source-maps";
|
|
4
5
|
let sealEnvVariables;
|
|
5
|
-
const magicPrefixes = [
|
|
6
|
-
"WEBINY_",
|
|
7
|
-
"WEBINY_API_",
|
|
8
|
-
"WEBINY_PROJECT_API_KEY",
|
|
9
|
-
"WCP_PROJECT_ENVIRONMENT",
|
|
10
|
-
"WCP_PROJECT_ENVIRONMENT_API_KEY",
|
|
11
|
-
"OKTA_",
|
|
12
|
-
"AUTH0_"
|
|
13
|
-
];
|
|
14
6
|
const variablesPromise = new Promise((resolve)=>{
|
|
15
7
|
sealEnvVariables = ()=>{
|
|
16
|
-
const baseVariables =
|
|
17
|
-
|
|
18
|
-
if (hasMagicPrefix && void 0 !== process.env[environmentVariableName]) current[environmentVariableName] = String(process.env[environmentVariableName]);
|
|
19
|
-
return current;
|
|
20
|
-
}, {
|
|
21
|
-
DEBUG: String(process.env.DEBUG),
|
|
8
|
+
const baseVariables = {
|
|
9
|
+
...pickApiRuntimeEnvVariables(),
|
|
22
10
|
PULUMI_APPS: "true"
|
|
23
|
-
}
|
|
11
|
+
};
|
|
24
12
|
resolve(Object.assign({}, baseVariables, variablesRegistry));
|
|
25
13
|
};
|
|
26
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/utils/lambdaEnvVariables.js","sources":["../../../src/pulumi/utils/lambdaEnvVariables.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\n\ntype EnvVariables = Record<string, string | pulumi.Output<string>>;\n\nconst variablesRegistry: EnvVariables = {};\n\nif (process.env.DEBUG === \"true\") {\n variablesRegistry.NODE_OPTIONS = \"--enable-source-maps\";\n}\n\nexport let sealEnvVariables: () => void;\n\nconst
|
|
1
|
+
{"version":3,"file":"pulumi/utils/lambdaEnvVariables.js","sources":["../../../src/pulumi/utils/lambdaEnvVariables.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\nimport { pickApiRuntimeEnvVariables } from \"@webiny/project\";\n\ntype EnvVariables = Record<string, string | pulumi.Output<string>>;\n\nconst variablesRegistry: EnvVariables = {};\n\nif (process.env.DEBUG === \"true\") {\n variablesRegistry.NODE_OPTIONS = \"--enable-source-maps\";\n}\n\nexport let sealEnvVariables: () => void;\n\nconst variablesPromise = new Promise<EnvVariables>(resolve => {\n sealEnvVariables = () => {\n // The api runtime allowlist (WEBINY_/WCP_PROJECT_ENVIRONMENT/OKTA_/AUTH0_ + DEBUG) is shared\n // with the self-hosted server hosting type — see @webiny/project's pickApiRuntimeEnvVariables.\n const baseVariables: EnvVariables = {\n ...pickApiRuntimeEnvVariables(),\n // This flag means that Lambda was deployed using the new Pulumi Apps architecture.\n PULUMI_APPS: \"true\"\n };\n\n resolve(Object.assign({}, baseVariables, variablesRegistry));\n };\n});\n\nexport function getCommonLambdaEnvVariables(): pulumi.Output<EnvVariables> {\n return pulumi.output(variablesPromise);\n}\n\nfunction setCommonLambdaEnvVariables(variables: EnvVariables) {\n Object.assign(variablesRegistry, variables);\n}\n\nexport interface SetCommonLambdaEnvVariables {\n (variables: EnvVariables): void;\n}\n\nexport interface WithCommonLambdaEnvVariables {\n /**\n * Set ENV variables that wil be assigned to all Lambda functions in the current Pulumi app.\n */\n setCommonLambdaEnvVariables: SetCommonLambdaEnvVariables;\n}\n\n/**\n * Augment the given app with `setCommonLambdaEnvVariables` functionality.\n * @param {PulumiApp} app\n */\nexport function withCommonLambdaEnvVariables<T extends PulumiApp>(\n app: T\n): T & WithCommonLambdaEnvVariables {\n app.decorateProgram<{ setCommonLambdaEnvVariables: typeof setCommonLambdaEnvVariables }>(\n async (program, app) => {\n const output = await program({\n ...app,\n setCommonLambdaEnvVariables\n });\n\n // Once the program is executed, we need to seal the variables (this will resolve the pulumi.output promise).\n app.addHandler(() => {\n sealEnvVariables();\n });\n\n return output;\n }\n );\n\n // Augment the original PulumiApp.\n return {\n ...app,\n setCommonLambdaEnvVariables\n };\n}\n"],"names":["variablesRegistry","process","sealEnvVariables","variablesPromise","Promise","resolve","baseVariables","pickApiRuntimeEnvVariables","Object","getCommonLambdaEnvVariables","pulumi","setCommonLambdaEnvVariables","variables","withCommonLambdaEnvVariables","app","program","output"],"mappings":";;AAMA,MAAMA,oBAAkC,CAAC;AAEzC,IAAIC,AAAsB,WAAtBA,QAAQ,GAAG,CAAC,KAAK,EACjBD,kBAAkB,YAAY,GAAG;AAG9B,IAAIE;AAEX,MAAMC,mBAAmB,IAAIC,QAAsBC,CAAAA;IAC/CH,mBAAmB;QAGf,MAAMI,gBAA8B;YAChC,GAAGC,4BAA4B;YAE/B,aAAa;QACjB;QAEAF,QAAQG,OAAO,MAAM,CAAC,CAAC,GAAGF,eAAeN;IAC7C;AACJ;AAEO,SAASS;IACZ,OAAOC,0CAAAA,MAAa,CAACP;AACzB;AAEA,SAASQ,4BAA4BC,SAAuB;IACxDJ,OAAO,MAAM,CAACR,mBAAmBY;AACrC;AAiBO,SAASC,6BACZC,GAAM;IAENA,IAAI,eAAe,CACf,OAAOC,SAASD;QACZ,MAAME,SAAS,MAAMD,QAAQ;YACzB,GAAGD,GAAG;YACNH,6BAAAA;QACJ;QAGAG,IAAI,UAAU,CAAC;YACXZ;QACJ;QAEA,OAAOc;IACX;IAIJ,OAAO;QACH,GAAGF,GAAG;QACNH,6BAAAA;IACJ;AACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Container } from "@webiny/di";
|
|
2
|
+
/**
|
|
3
|
+
* Pulumi services + features only — no deploy/workspace decorators or hooks. Safe to register in the
|
|
4
|
+
* Pulumi program's own ProjectSdk container (a separate process that must resolve the name prefix,
|
|
5
|
+
* stack output, etc. without re-running the CLI's workspace builders or deploy decorators).
|
|
6
|
+
*/
|
|
7
|
+
export declare const registerAwsPulumiServices: (container: Container) => void;
|
|
8
|
+
export declare const registerAwsProjectFeatures: (container: Container) => void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { deployApp, destroyApp, exportStack, getAppOutput, getAppStackOutput, getPulumiResourceNamePrefix, refreshApp, runPulumiCommand } from "@webiny/project/features/index.js";
|
|
2
|
+
import { isRemotePulumiBackendService, listAppLambdaFunctionsService, listDeployedEnvironmentsService, pulumiExportService, pulumiGetConfigPassphraseService, pulumiGetSecretsProviderService, pulumiGetStackOutputService, pulumiImportService, pulumiLoginService, pulumiSelectStackService, watchedLambdaFunctionsService } from "@webiny/project/services/index.js";
|
|
3
|
+
import { getPulumiService } from "./services/GetPulumiService/GetPulumiService.js";
|
|
4
|
+
import { adminAfterDeploy, adminBeforeDeploy, afterDeploy, apiAfterDeploy, apiBeforeDeploy, beforeDeploy, coreAfterBuild, coreAfterDeploy, coreBeforeBuild, coreBeforeDeploy, coreBeforeWatch } from "@webiny/project/features/hooks/index.js";
|
|
5
|
+
import { deployAppClearWatchedLambdaFunctions, deployAppRefreshStackOutputCache, deployAppWithHooks, deployAppWithWatchedLambdaReplacement, getPulumiServiceWithDownloadInfo } from "@webiny/project/decorators/index.js";
|
|
6
|
+
import { awsWatch } from "./features/Watch/AwsWatch.js";
|
|
7
|
+
import { BuildProjectWorkspace } from "./extensions/ProjectAws/BuildProjectWorkspace.js";
|
|
8
|
+
import { BuildAppWorkspace } from "./extensions/ProjectAws/BuildAppWorkspace.js";
|
|
9
|
+
const registerAwsPulumiServices = (container)=>{
|
|
10
|
+
container.register(getPulumiService).inSingletonScope();
|
|
11
|
+
container.register(isRemotePulumiBackendService).inSingletonScope();
|
|
12
|
+
container.register(listAppLambdaFunctionsService).inSingletonScope();
|
|
13
|
+
container.register(listDeployedEnvironmentsService).inSingletonScope();
|
|
14
|
+
container.register(watchedLambdaFunctionsService).inSingletonScope();
|
|
15
|
+
container.register(pulumiGetConfigPassphraseService).inSingletonScope();
|
|
16
|
+
container.register(pulumiGetSecretsProviderService).inSingletonScope();
|
|
17
|
+
container.register(pulumiExportService).inSingletonScope();
|
|
18
|
+
container.register(pulumiImportService).inSingletonScope();
|
|
19
|
+
container.register(pulumiGetStackOutputService).inSingletonScope();
|
|
20
|
+
container.register(pulumiLoginService).inSingletonScope();
|
|
21
|
+
container.register(pulumiSelectStackService).inSingletonScope();
|
|
22
|
+
container.register(deployApp).inSingletonScope();
|
|
23
|
+
container.register(destroyApp).inSingletonScope();
|
|
24
|
+
container.register(exportStack).inSingletonScope();
|
|
25
|
+
container.register(getAppOutput).inSingletonScope();
|
|
26
|
+
container.register(getAppStackOutput).inSingletonScope();
|
|
27
|
+
container.register(getPulumiResourceNamePrefix).inSingletonScope();
|
|
28
|
+
container.register(refreshApp).inSingletonScope();
|
|
29
|
+
container.register(runPulumiCommand).inSingletonScope();
|
|
30
|
+
};
|
|
31
|
+
const registerAwsProjectFeatures = (container)=>{
|
|
32
|
+
container.registerDecorator(BuildProjectWorkspace);
|
|
33
|
+
container.registerDecorator(BuildAppWorkspace);
|
|
34
|
+
registerAwsPulumiServices(container);
|
|
35
|
+
container.registerComposite(beforeDeploy);
|
|
36
|
+
container.registerComposite(afterDeploy);
|
|
37
|
+
container.registerComposite(coreBeforeBuild);
|
|
38
|
+
container.registerComposite(coreAfterBuild);
|
|
39
|
+
container.registerComposite(coreBeforeWatch);
|
|
40
|
+
container.registerComposite(coreBeforeDeploy);
|
|
41
|
+
container.registerComposite(coreAfterDeploy);
|
|
42
|
+
container.registerComposite(apiBeforeDeploy);
|
|
43
|
+
container.registerComposite(apiAfterDeploy);
|
|
44
|
+
container.registerComposite(adminBeforeDeploy);
|
|
45
|
+
container.registerComposite(adminAfterDeploy);
|
|
46
|
+
container.registerDecorator(deployAppWithWatchedLambdaReplacement);
|
|
47
|
+
container.registerDecorator(deployAppClearWatchedLambdaFunctions);
|
|
48
|
+
container.registerDecorator(deployAppRefreshStackOutputCache);
|
|
49
|
+
container.registerDecorator(deployAppWithHooks);
|
|
50
|
+
container.registerDecorator(getPulumiServiceWithDownloadInfo);
|
|
51
|
+
container.registerDecorator(awsWatch);
|
|
52
|
+
};
|
|
53
|
+
export { registerAwsProjectFeatures, registerAwsPulumiServices };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=registerAwsProjectFeatures.js.map
|