@webiny/project-aws 0.0.0-unstable.3c5210ad37
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/LICENSE +21 -0
- package/README.md +11 -0
- package/_templates/appTemplates/admin/src/App.scss +2 -0
- package/_templates/appTemplates/admin/src/App.tsx +13 -0
- package/_templates/appTemplates/admin/src/Extensions.tsx +7 -0
- package/_templates/appTemplates/admin/src/index.tsx +11 -0
- package/_templates/appTemplates/admin/tsconfig.json +7 -0
- package/_templates/appTemplates/admin/webiny.application.ts +3 -0
- package/_templates/appTemplates/admin/webiny.config.ts +3 -0
- package/_templates/appTemplates/api/graphql/package.json +43 -0
- package/_templates/appTemplates/api/graphql/src/extensions.ts +9 -0
- package/_templates/appTemplates/api/graphql/src/index.ts +80 -0
- package/_templates/appTemplates/api/graphql/src/security.ts +43 -0
- package/_templates/appTemplates/api/graphql/tsconfig.json +7 -0
- package/_templates/appTemplates/api/graphql/webiny.config.ts +8 -0
- package/_templates/appTemplates/api/migration/src/index.ts +23 -0
- package/_templates/appTemplates/api/migration/tsconfig.json +7 -0
- package/_templates/appTemplates/api/migration/webiny.config.ts +8 -0
- package/_templates/appTemplates/api/webiny.application.ts +3 -0
- package/_templates/appTemplates/blueGreen/webiny.application.ts +3 -0
- package/_templates/appTemplates/core/webiny.application.ts +3 -0
- package/_templates/appTemplates/syncSystem/webiny.application.ts +3 -0
- package/_templates/extensions/ApiLambdaFunction/package.json +9 -0
- package/_templates/extensions/ApiLambdaFunction/tsconfig.json +7 -0
- package/_templates/extensions/ApiLambdaFunction/webiny.config.ts +8 -0
- package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +90 -0
- package/_templates/extensions/OpenSearch/api/migration/src/index.ts +33 -0
- package/_templates/extensions/OpenSearch/coreDdbToEsHandler/dynamoToElastic/src/index.ts +15 -0
- package/_templates/extensions/OpenSearch/coreDdbToEsHandler/dynamoToElastic/tsconfig.json +7 -0
- package/_templates/extensions/OpenSearch/coreDdbToEsHandler/dynamoToElastic/webiny.config.ts +8 -0
- package/abstractions/ApiGqlClient.d.ts +23 -0
- package/abstractions/ApiGqlClient.js +4 -0
- package/abstractions/ApiGqlClient.js.map +1 -0
- package/abstractions/InvokeLambdaFunction.d.ts +18 -0
- package/abstractions/InvokeLambdaFunction.js +4 -0
- package/abstractions/InvokeLambdaFunction.js.map +1 -0
- package/abstractions/index.d.ts +5 -0
- package/abstractions/index.js +7 -0
- package/abstractions/index.js.map +1 -0
- package/abstractions/services/AdminStackOutputService.d.ts +13 -0
- package/abstractions/services/AdminStackOutputService.js +4 -0
- package/abstractions/services/AdminStackOutputService.js.map +1 -0
- package/abstractions/services/ApiStackOutputService.d.ts +30 -0
- package/abstractions/services/ApiStackOutputService.js +4 -0
- package/abstractions/services/ApiStackOutputService.js.map +1 -0
- package/abstractions/services/CoreStackOutputService.d.ts +16 -0
- package/abstractions/services/CoreStackOutputService.js +4 -0
- package/abstractions/services/CoreStackOutputService.js.map +1 -0
- package/admin.d.ts +22 -0
- package/admin.js +7 -0
- package/admin.js.map +1 -0
- package/api.d.ts +22 -0
- package/api.js +7 -0
- package/api.js.map +1 -0
- package/apps/createAdminApp.d.ts +15 -0
- package/apps/createAdminApp.js +15 -0
- package/apps/createAdminApp.js.map +1 -0
- package/apps/createAdminAppConfig.d.ts +2 -0
- package/apps/createAdminAppConfig.js +21 -0
- package/apps/createAdminAppConfig.js.map +1 -0
- package/apps/createApiApp.d.ts +65 -0
- package/apps/createApiApp.js +25 -0
- package/apps/createApiApp.js.map +1 -0
- package/apps/createBlueGreenApp.d.ts +24 -0
- package/apps/createBlueGreenApp.js +20 -0
- package/apps/createBlueGreenApp.js.map +1 -0
- package/apps/createCoreApp.d.ts +36 -0
- package/apps/createCoreApp.js +16 -0
- package/apps/createCoreApp.js.map +1 -0
- package/apps/createReactAppConfig.d.ts +53 -0
- package/apps/createReactAppConfig.js +79 -0
- package/apps/createReactAppConfig.js.map +1 -0
- package/apps/createSyncSystemApp.d.ts +21 -0
- package/apps/createSyncSystemApp.js +11 -0
- package/apps/createSyncSystemApp.js.map +1 -0
- package/apps/index.d.ts +7 -0
- package/apps/index.js +9 -0
- package/apps/index.js.map +1 -0
- package/cli.d.ts +9 -0
- package/cli.js +6 -0
- package/cli.js.map +1 -0
- package/exports/extensions.d.ts +5 -0
- package/exports/extensions.js +7 -0
- package/exports/extensions.js.map +1 -0
- package/exports/infra/admin.d.ts +1 -0
- package/exports/infra/admin.js +3 -0
- package/exports/infra/admin.js.map +1 -0
- package/exports/infra/api.d.ts +1 -0
- package/exports/infra/api.js +3 -0
- package/exports/infra/api.js.map +1 -0
- package/exports/infra/core.d.ts +1 -0
- package/exports/infra/core.js +3 -0
- package/exports/infra/core.js.map +1 -0
- package/exports/infra/index.d.ts +1 -0
- package/exports/infra/index.js +3 -0
- package/exports/infra/index.js.map +1 -0
- package/extensions/ApiLambdaFunction.d.ts +11 -0
- package/extensions/ApiLambdaFunction.js +68 -0
- package/extensions/ApiLambdaFunction.js.map +1 -0
- package/extensions/AwsDefaultRegion.d.ts +8 -0
- package/extensions/AwsDefaultRegion.js +22 -0
- package/extensions/AwsDefaultRegion.js.map +1 -0
- package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.d.ts +10 -0
- package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.js +40 -0
- package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.js.map +1 -0
- package/extensions/OpenSearch/EnsureOsWasDeployed.d.ts +11 -0
- package/extensions/OpenSearch/EnsureOsWasDeployed.js +34 -0
- package/extensions/OpenSearch/EnsureOsWasDeployed.js.map +1 -0
- package/extensions/OpenSearch/InjectDdbEsLambdaFnHandler.d.ts +12 -0
- package/extensions/OpenSearch/InjectDdbEsLambdaFnHandler.js +31 -0
- package/extensions/OpenSearch/InjectDdbEsLambdaFnHandler.js.map +1 -0
- package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.d.ts +12 -0
- package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js +32 -0
- package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js.map +1 -0
- package/extensions/OpenSearch.d.ts +17 -0
- package/extensions/OpenSearch.js +35 -0
- package/extensions/OpenSearch.js.map +1 -0
- package/extensions/ProjectAws/AdminStackOutputService.d.ts +1 -0
- package/extensions/ProjectAws/AdminStackOutputService.js +3 -0
- package/extensions/ProjectAws/AdminStackOutputService.js.map +1 -0
- package/extensions/ProjectAws/ApiStackOutputService.d.ts +1 -0
- package/extensions/ProjectAws/ApiStackOutputService.js +3 -0
- package/extensions/ProjectAws/ApiStackOutputService.js.map +1 -0
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +17 -0
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +108 -0
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -0
- package/extensions/ProjectAws/AutoInstall.d.ts +33 -0
- package/extensions/ProjectAws/AutoInstall.js +19 -0
- package/extensions/ProjectAws/AutoInstall.js.map +1 -0
- package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.d.ts +10 -0
- package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js +27 -0
- package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js.map +1 -0
- package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.d.ts +20 -0
- package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js +54 -0
- package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js.map +1 -0
- package/extensions/ProjectAws/BlueGreenDeployments/SetPrimaryVariantCliCommand.d.ts +18 -0
- package/extensions/ProjectAws/BlueGreenDeployments/SetPrimaryVariantCliCommand.js +60 -0
- package/extensions/ProjectAws/BlueGreenDeployments/SetPrimaryVariantCliCommand.js.map +1 -0
- package/extensions/ProjectAws/BuildAppWorkspace.d.ts +12 -0
- package/extensions/ProjectAws/BuildAppWorkspace.js +66 -0
- package/extensions/ProjectAws/BuildAppWorkspace.js.map +1 -0
- package/extensions/ProjectAws/CoreStackOutputService.d.ts +1 -0
- package/extensions/ProjectAws/CoreStackOutputService.js +3 -0
- package/extensions/ProjectAws/CoreStackOutputService.js.map +1 -0
- package/extensions/ProjectAws/ExecuteDataMigrations.d.ts +16 -0
- package/extensions/ProjectAws/ExecuteDataMigrations.js +69 -0
- package/extensions/ProjectAws/ExecuteDataMigrations.js.map +1 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.d.ts +13 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js +43 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js.map +1 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.d.ts +13 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js +24 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js.map +1 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.d.ts +13 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js +24 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js.map +1 -0
- package/extensions/ProjectAws/SetDatabaseSetupOutput.d.ts +10 -0
- package/extensions/ProjectAws/SetDatabaseSetupOutput.js +29 -0
- package/extensions/ProjectAws/SetDatabaseSetupOutput.js.map +1 -0
- package/extensions/ProjectAws/UploadAdminAppToS3.d.ts +13 -0
- package/extensions/ProjectAws/UploadAdminAppToS3.js +69 -0
- package/extensions/ProjectAws/UploadAdminAppToS3.js.map +1 -0
- package/extensions/ProjectAws/definitions.d.ts +3 -0
- package/extensions/ProjectAws/definitions.js +9 -0
- package/extensions/ProjectAws/definitions.js.map +1 -0
- package/extensions/ProjectAws.d.ts +2 -0
- package/extensions/ProjectAws.js +52 -0
- package/extensions/ProjectAws.js.map +1 -0
- package/extensions/definitions.d.ts +3 -0
- package/extensions/definitions.js +6 -0
- package/extensions/definitions.js.map +1 -0
- package/extensions/index.d.ts +5 -0
- package/extensions/index.js +7 -0
- package/extensions/index.js.map +1 -0
- package/features/ApiGqlClient.d.ts +21 -0
- package/features/ApiGqlClient.js +59 -0
- package/features/ApiGqlClient.js.map +1 -0
- package/features/InvokeLambdaFunction.d.ts +10 -0
- package/features/InvokeLambdaFunction.js +38 -0
- package/features/InvokeLambdaFunction.js.map +1 -0
- package/features/index.d.ts +2 -0
- package/features/index.js +4 -0
- package/features/index.js.map +1 -0
- package/index.d.ts +6 -0
- package/index.js +8 -0
- package/index.js.map +1 -0
- package/infra.d.ts +425 -0
- package/infra.js +54 -0
- package/infra.js.map +1 -0
- package/package.json +60 -0
- package/project.d.ts +139 -0
- package/project.js +10 -0
- package/project.js.map +1 -0
- package/pulumi/apps/admin/createAdminPulumiApp.d.ts +12 -0
- package/pulumi/apps/admin/createAdminPulumiApp.js +52 -0
- package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -0
- package/pulumi/apps/admin/index.d.ts +1 -0
- package/pulumi/apps/admin/index.js +3 -0
- package/pulumi/apps/admin/index.js.map +1 -0
- package/pulumi/apps/api/ApiBackgroundTask.d.ts +12 -0
- package/pulumi/apps/api/ApiBackgroundTask.js +148 -0
- package/pulumi/apps/api/ApiBackgroundTask.js.map +1 -0
- package/pulumi/apps/api/ApiCloudfront.d.ts +3 -0
- package/pulumi/apps/api/ApiCloudfront.js +136 -0
- package/pulumi/apps/api/ApiCloudfront.js.map +1 -0
- package/pulumi/apps/api/ApiFileManager.d.ts +11 -0
- package/pulumi/apps/api/ApiFileManager.js +39 -0
- package/pulumi/apps/api/ApiFileManager.js.map +1 -0
- package/pulumi/apps/api/ApiGateway.d.ts +18 -0
- package/pulumi/apps/api/ApiGateway.js +80 -0
- package/pulumi/apps/api/ApiGateway.js.map +1 -0
- package/pulumi/apps/api/ApiGraphql.d.ts +22 -0
- package/pulumi/apps/api/ApiGraphql.js +164 -0
- package/pulumi/apps/api/ApiGraphql.js.map +1 -0
- package/pulumi/apps/api/ApiMigration.d.ts +5 -0
- package/pulumi/apps/api/ApiMigration.js +83 -0
- package/pulumi/apps/api/ApiMigration.js.map +1 -0
- package/pulumi/apps/api/ApiOutput.d.ts +23 -0
- package/pulumi/apps/api/ApiOutput.js +36 -0
- package/pulumi/apps/api/ApiOutput.js.map +1 -0
- package/pulumi/apps/api/ApiScheduler.d.ts +8 -0
- package/pulumi/apps/api/ApiScheduler.js +100 -0
- package/pulumi/apps/api/ApiScheduler.js.map +1 -0
- package/pulumi/apps/api/ApiWebsocket.d.ts +14 -0
- package/pulumi/apps/api/ApiWebsocket.js +138 -0
- package/pulumi/apps/api/ApiWebsocket.js.map +1 -0
- package/pulumi/apps/api/backgroundTask/definition.d.ts +7 -0
- package/pulumi/apps/api/backgroundTask/definition.js +149 -0
- package/pulumi/apps/api/backgroundTask/definition.js.map +1 -0
- package/pulumi/apps/api/backgroundTask/policy.d.ts +8 -0
- package/pulumi/apps/api/backgroundTask/policy.js +26 -0
- package/pulumi/apps/api/backgroundTask/policy.js.map +1 -0
- package/pulumi/apps/api/backgroundTask/role.d.ts +9 -0
- package/pulumi/apps/api/backgroundTask/role.js +32 -0
- package/pulumi/apps/api/backgroundTask/role.js.map +1 -0
- package/pulumi/apps/api/backgroundTask/types.d.ts +91 -0
- package/pulumi/apps/api/backgroundTask/types.js +14 -0
- package/pulumi/apps/api/backgroundTask/types.js.map +1 -0
- package/pulumi/apps/api/createApiPulumiApp.d.ts +57 -0
- package/pulumi/apps/api/createApiPulumiApp.js +281 -0
- package/pulumi/apps/api/createApiPulumiApp.js.map +1 -0
- package/pulumi/apps/api/handleGuardDutyEvents.d.ts +2 -0
- package/pulumi/apps/api/handleGuardDutyEvents.js +55 -0
- package/pulumi/apps/api/handleGuardDutyEvents.js.map +1 -0
- package/pulumi/apps/api/index.d.ts +9 -0
- package/pulumi/apps/api/index.js +11 -0
- package/pulumi/apps/api/index.js.map +1 -0
- package/pulumi/apps/awsUtils.d.ts +5 -0
- package/pulumi/apps/awsUtils.js +34 -0
- package/pulumi/apps/awsUtils.js.map +1 -0
- package/pulumi/apps/blueGreen/BlueGreenRouterApiGateway.d.ts +11 -0
- package/pulumi/apps/blueGreen/BlueGreenRouterApiGateway.js +44 -0
- package/pulumi/apps/blueGreen/BlueGreenRouterApiGateway.js.map +1 -0
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFront.d.ts +17 -0
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFront.js +100 -0
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFront.js.map +1 -0
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFrontStore.d.ts +10 -0
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFrontStore.js +20 -0
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFrontStore.js.map +1 -0
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontDefaultCacheBehaviorPolicies.d.ts +7 -0
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontDefaultCacheBehaviorPolicies.js +15 -0
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontDefaultCacheBehaviorPolicies.js.map +1 -0
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontFunctionDomainMap.d.ts +14 -0
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontFunctionDomainMap.js +23 -0
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontFunctionDomainMap.js.map +1 -0
- package/pulumi/apps/blueGreen/cloudfront/createOriginId.d.ts +11 -0
- package/pulumi/apps/blueGreen/cloudfront/createOriginId.js +10 -0
- package/pulumi/apps/blueGreen/cloudfront/createOriginId.js.map +1 -0
- package/pulumi/apps/blueGreen/constants.d.ts +3 -0
- package/pulumi/apps/blueGreen/constants.js +5 -0
- package/pulumi/apps/blueGreen/constants.js.map +1 -0
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.d.ts +15 -0
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js +122 -0
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js.map +1 -0
- package/pulumi/apps/blueGreen/domains/attachDomainsToOutput.d.ts +9 -0
- package/pulumi/apps/blueGreen/domains/attachDomainsToOutput.js +30 -0
- package/pulumi/apps/blueGreen/domains/attachDomainsToOutput.js.map +1 -0
- package/pulumi/apps/blueGreen/domains/convertApplicationDomains.d.ts +6 -0
- package/pulumi/apps/blueGreen/domains/convertApplicationDomains.js +23 -0
- package/pulumi/apps/blueGreen/domains/convertApplicationDomains.js.map +1 -0
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.d.ts +18 -0
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.js +73 -0
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.js.map +1 -0
- package/pulumi/apps/blueGreen/domains/resolveDomains.d.ts +6 -0
- package/pulumi/apps/blueGreen/domains/resolveDomains.js +41 -0
- package/pulumi/apps/blueGreen/domains/resolveDomains.js.map +1 -0
- package/pulumi/apps/blueGreen/functions/buildHandlerFunction.d.ts +15 -0
- package/pulumi/apps/blueGreen/functions/buildHandlerFunction.js +18 -0
- package/pulumi/apps/blueGreen/functions/buildHandlerFunction.js.map +1 -0
- package/pulumi/apps/blueGreen/functions/handler.d.ts +1 -0
- package/pulumi/apps/blueGreen/functions/handler.js +60 -0
- package/pulumi/apps/blueGreen/functions/handler.js.map +1 -0
- package/pulumi/apps/blueGreen/types.d.ts +77 -0
- package/pulumi/apps/blueGreen/types.js +3 -0
- package/pulumi/apps/blueGreen/types.js.map +1 -0
- package/pulumi/apps/blueGreen/validation/validateDeployments.d.ts +2 -0
- package/pulumi/apps/blueGreen/validation/validateDeployments.js +33 -0
- package/pulumi/apps/blueGreen/validation/validateDeployments.js.map +1 -0
- package/pulumi/apps/common/CoreOutput.d.ts +38 -0
- package/pulumi/apps/common/CoreOutput.js +46 -0
- package/pulumi/apps/common/CoreOutput.js.map +1 -0
- package/pulumi/apps/common/VpcConfig.d.ts +8 -0
- package/pulumi/apps/common/VpcConfig.js +25 -0
- package/pulumi/apps/common/VpcConfig.js.map +1 -0
- package/pulumi/apps/common/index.d.ts +2 -0
- package/pulumi/apps/common/index.js +4 -0
- package/pulumi/apps/common/index.js.map +1 -0
- package/pulumi/apps/core/CoreAuditLogsDynamo.d.ts +5 -0
- package/pulumi/apps/core/CoreAuditLogsDynamo.js +186 -0
- package/pulumi/apps/core/CoreAuditLogsDynamo.js.map +1 -0
- package/pulumi/apps/core/CoreCognito.d.ts +10 -0
- package/pulumi/apps/core/CoreCognito.js +110 -0
- package/pulumi/apps/core/CoreCognito.js.map +1 -0
- package/pulumi/apps/core/CoreDynamo.d.ts +5 -0
- package/pulumi/apps/core/CoreDynamo.js +74 -0
- package/pulumi/apps/core/CoreDynamo.js.map +1 -0
- package/pulumi/apps/core/CoreEventBus.d.ts +1 -0
- package/pulumi/apps/core/CoreEventBus.js +13 -0
- package/pulumi/apps/core/CoreEventBus.js.map +1 -0
- package/pulumi/apps/core/CoreFileManager.d.ts +11 -0
- package/pulumi/apps/core/CoreFileManager.js +72 -0
- package/pulumi/apps/core/CoreFileManager.js.map +1 -0
- package/pulumi/apps/core/CoreOpenSearch.d.ts +16 -0
- package/pulumi/apps/core/CoreOpenSearch.js +299 -0
- package/pulumi/apps/core/CoreOpenSearch.js.map +1 -0
- package/pulumi/apps/core/CoreVpc.d.ts +13 -0
- package/pulumi/apps/core/CoreVpc.js +160 -0
- package/pulumi/apps/core/CoreVpc.js.map +1 -0
- package/pulumi/apps/core/LogDynamo.d.ts +5 -0
- package/pulumi/apps/core/LogDynamo.js +122 -0
- package/pulumi/apps/core/LogDynamo.js.map +1 -0
- package/pulumi/apps/core/WatchCommand.d.ts +7 -0
- package/pulumi/apps/core/WatchCommand.js +105 -0
- package/pulumi/apps/core/WatchCommand.js.map +1 -0
- package/pulumi/apps/core/cognitoIdentityProviders/amazon.d.ts +9 -0
- package/pulumi/apps/core/cognitoIdentityProviders/amazon.js +24 -0
- package/pulumi/apps/core/cognitoIdentityProviders/amazon.js.map +1 -0
- package/pulumi/apps/core/cognitoIdentityProviders/apple.d.ts +4 -0
- package/pulumi/apps/core/cognitoIdentityProviders/apple.js +19 -0
- package/pulumi/apps/core/cognitoIdentityProviders/apple.js.map +1 -0
- package/pulumi/apps/core/cognitoIdentityProviders/configure.d.ts +28 -0
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js +57 -0
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -0
- package/pulumi/apps/core/cognitoIdentityProviders/facebook.d.ts +4 -0
- package/pulumi/apps/core/cognitoIdentityProviders/facebook.js +19 -0
- package/pulumi/apps/core/cognitoIdentityProviders/facebook.js.map +1 -0
- package/pulumi/apps/core/cognitoIdentityProviders/getIdpConfig.d.ts +3 -0
- package/pulumi/apps/core/cognitoIdentityProviders/getIdpConfig.js +17 -0
- package/pulumi/apps/core/cognitoIdentityProviders/getIdpConfig.js.map +1 -0
- package/pulumi/apps/core/cognitoIdentityProviders/google.d.ts +4 -0
- package/pulumi/apps/core/cognitoIdentityProviders/google.js +19 -0
- package/pulumi/apps/core/cognitoIdentityProviders/google.js.map +1 -0
- package/pulumi/apps/core/cognitoIdentityProviders/index.d.ts +1 -0
- package/pulumi/apps/core/cognitoIdentityProviders/index.js +3 -0
- package/pulumi/apps/core/cognitoIdentityProviders/index.js.map +1 -0
- package/pulumi/apps/core/cognitoIdentityProviders/oidc.d.ts +4 -0
- package/pulumi/apps/core/cognitoIdentityProviders/oidc.js +20 -0
- package/pulumi/apps/core/cognitoIdentityProviders/oidc.js.map +1 -0
- package/pulumi/apps/core/configureS3BucketMalwareProtection.d.ts +2 -0
- package/pulumi/apps/core/configureS3BucketMalwareProtection.js +195 -0
- package/pulumi/apps/core/configureS3BucketMalwareProtection.js.map +1 -0
- package/pulumi/apps/core/createCorePulumiApp.d.ts +32 -0
- package/pulumi/apps/core/createCorePulumiApp.js +295 -0
- package/pulumi/apps/core/createCorePulumiApp.js.map +1 -0
- package/pulumi/apps/core/index.d.ts +8 -0
- package/pulumi/apps/core/index.js +10 -0
- package/pulumi/apps/core/index.js.map +1 -0
- package/pulumi/apps/core/webinyWatchCommand/handler.d.ts +28 -0
- package/pulumi/apps/core/webinyWatchCommand/handler.js +37 -0
- package/pulumi/apps/core/webinyWatchCommand/handler.js.map +1 -0
- package/pulumi/apps/createAppBucket.d.ts +17 -0
- package/pulumi/apps/createAppBucket.js +152 -0
- package/pulumi/apps/createAppBucket.js.map +1 -0
- package/pulumi/apps/customDomain.d.ts +9 -0
- package/pulumi/apps/customDomain.js +9 -0
- package/pulumi/apps/customDomain.js.map +1 -0
- package/pulumi/apps/extensions/getAwsTagsFromExtension.d.ts +2 -0
- package/pulumi/apps/extensions/getAwsTagsFromExtension.js +10 -0
- package/pulumi/apps/extensions/getAwsTagsFromExtension.js.map +1 -0
- package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.d.ts +23 -0
- package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js +10 -0
- package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js.map +1 -0
- package/pulumi/apps/extensions/getOsConfigFromExtension.d.ts +7 -0
- package/pulumi/apps/extensions/getOsConfigFromExtension.js +33 -0
- package/pulumi/apps/extensions/getOsConfigFromExtension.js.map +1 -0
- package/pulumi/apps/extensions/getVpcConfigFromExtension.d.ts +15 -0
- package/pulumi/apps/extensions/getVpcConfigFromExtension.js +29 -0
- package/pulumi/apps/extensions/getVpcConfigFromExtension.js.map +1 -0
- package/pulumi/apps/index.d.ts +6 -0
- package/pulumi/apps/index.js +8 -0
- package/pulumi/apps/index.js.map +1 -0
- package/pulumi/apps/lambdaUtils.d.ts +11 -0
- package/pulumi/apps/lambdaUtils.js +70 -0
- package/pulumi/apps/lambdaUtils.js.map +1 -0
- package/pulumi/apps/react/createReactPulumiApp.d.ts +32 -0
- package/pulumi/apps/react/createReactPulumiApp.js +150 -0
- package/pulumi/apps/react/createReactPulumiApp.js.map +1 -0
- package/pulumi/apps/react/index.d.ts +1 -0
- package/pulumi/apps/react/index.js +3 -0
- package/pulumi/apps/react/index.js.map +1 -0
- package/pulumi/apps/syncSystem/SyncSystemDynamo.d.ts +5 -0
- package/pulumi/apps/syncSystem/SyncSystemDynamo.js +56 -0
- package/pulumi/apps/syncSystem/SyncSystemDynamo.js.map +1 -0
- package/pulumi/apps/syncSystem/SyncSystemDynamoDb.d.ts +3 -0
- package/pulumi/apps/syncSystem/SyncSystemDynamoDb.js +52 -0
- package/pulumi/apps/syncSystem/SyncSystemDynamoDb.js.map +1 -0
- package/pulumi/apps/syncSystem/SyncSystemEventBus.d.ts +6 -0
- package/pulumi/apps/syncSystem/SyncSystemEventBus.js +77 -0
- package/pulumi/apps/syncSystem/SyncSystemEventBus.js.map +1 -0
- package/pulumi/apps/syncSystem/SyncSystemLambda.d.ts +11 -0
- package/pulumi/apps/syncSystem/SyncSystemLambda.js +99 -0
- package/pulumi/apps/syncSystem/SyncSystemLambda.js.map +1 -0
- package/pulumi/apps/syncSystem/SyncSystemOutput.d.ts +3 -0
- package/pulumi/apps/syncSystem/SyncSystemOutput.js +18 -0
- package/pulumi/apps/syncSystem/SyncSystemOutput.js.map +1 -0
- package/pulumi/apps/syncSystem/SyncSystemResolverLambda.d.ts +8 -0
- package/pulumi/apps/syncSystem/SyncSystemResolverLambda.js +73 -0
- package/pulumi/apps/syncSystem/SyncSystemResolverLambda.js.map +1 -0
- package/pulumi/apps/syncSystem/SyncSystemSQS.d.ts +3 -0
- package/pulumi/apps/syncSystem/SyncSystemSQS.js +54 -0
- package/pulumi/apps/syncSystem/SyncSystemSQS.js.map +1 -0
- package/pulumi/apps/syncSystem/SyncSystemWorkerLambda.d.ts +7 -0
- package/pulumi/apps/syncSystem/SyncSystemWorkerLambda.js +52 -0
- package/pulumi/apps/syncSystem/SyncSystemWorkerLambda.js.map +1 -0
- package/pulumi/apps/syncSystem/addTableItems.d.ts +8 -0
- package/pulumi/apps/syncSystem/addTableItems.js +51 -0
- package/pulumi/apps/syncSystem/addTableItems.js.map +1 -0
- package/pulumi/apps/syncSystem/api/addServiceManifest.d.ts +8 -0
- package/pulumi/apps/syncSystem/api/addServiceManifest.js +18 -0
- package/pulumi/apps/syncSystem/api/addServiceManifest.js.map +1 -0
- package/pulumi/apps/syncSystem/api/attachCognitoPermissions.d.ts +14 -0
- package/pulumi/apps/syncSystem/api/attachCognitoPermissions.js +59 -0
- package/pulumi/apps/syncSystem/api/attachCognitoPermissions.js.map +1 -0
- package/pulumi/apps/syncSystem/api/attachDynamoDbPermissions.d.ts +13 -0
- package/pulumi/apps/syncSystem/api/attachDynamoDbPermissions.js +44 -0
- package/pulumi/apps/syncSystem/api/attachDynamoDbPermissions.js.map +1 -0
- package/pulumi/apps/syncSystem/api/attachEventBusPermissions.d.ts +17 -0
- package/pulumi/apps/syncSystem/api/attachEventBusPermissions.js +48 -0
- package/pulumi/apps/syncSystem/api/attachEventBusPermissions.js.map +1 -0
- package/pulumi/apps/syncSystem/api/attachS3Permissions.d.ts +14 -0
- package/pulumi/apps/syncSystem/api/attachS3Permissions.js +51 -0
- package/pulumi/apps/syncSystem/api/attachS3Permissions.js.map +1 -0
- package/pulumi/apps/syncSystem/api/index.d.ts +8 -0
- package/pulumi/apps/syncSystem/api/index.js +55 -0
- package/pulumi/apps/syncSystem/api/index.js.map +1 -0
- package/pulumi/apps/syncSystem/constants.d.ts +1 -0
- package/pulumi/apps/syncSystem/constants.js +3 -0
- package/pulumi/apps/syncSystem/constants.js.map +1 -0
- package/pulumi/apps/syncSystem/createSyncResourceName.d.ts +4 -0
- package/pulumi/apps/syncSystem/createSyncResourceName.js +10 -0
- package/pulumi/apps/syncSystem/createSyncResourceName.js.map +1 -0
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.d.ts +26 -0
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js +181 -0
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js.map +1 -0
- package/pulumi/apps/syncSystem/customApp.d.ts +6 -0
- package/pulumi/apps/syncSystem/customApp.js +19 -0
- package/pulumi/apps/syncSystem/customApp.js.map +1 -0
- package/pulumi/apps/syncSystem/getSyncSystemOutput.d.ts +3 -0
- package/pulumi/apps/syncSystem/getSyncSystemOutput.js +10 -0
- package/pulumi/apps/syncSystem/getSyncSystemOutput.js.map +1 -0
- package/pulumi/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.d.ts +7 -0
- package/pulumi/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.js +48 -0
- package/pulumi/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.js.map +1 -0
- package/pulumi/apps/syncSystem/types.d.ts +56 -0
- package/pulumi/apps/syncSystem/types.js +3 -0
- package/pulumi/apps/syncSystem/types.js.map +1 -0
- package/pulumi/constants.d.ts +1 -0
- package/pulumi/constants.js +4 -0
- package/pulumi/constants.js.map +1 -0
- package/pulumi/env/awsRegion.d.ts +1 -0
- package/pulumi/env/awsRegion.js +6 -0
- package/pulumi/env/awsRegion.js.map +1 -0
- package/pulumi/env/base.d.ts +15 -0
- package/pulumi/env/base.js +29 -0
- package/pulumi/env/base.js.map +1 -0
- package/pulumi/env/env.d.ts +1 -0
- package/pulumi/env/env.js +6 -0
- package/pulumi/env/env.js.map +1 -0
- package/pulumi/env/projectName.d.ts +1 -0
- package/pulumi/env/projectName.js +6 -0
- package/pulumi/env/projectName.js.map +1 -0
- package/pulumi/env/variant.d.ts +1 -0
- package/pulumi/env/variant.js +7 -0
- package/pulumi/env/variant.js.map +1 -0
- package/pulumi/extensions/AdminCustomDomains.d.ts +14 -0
- package/pulumi/extensions/AdminCustomDomains.js +16 -0
- package/pulumi/extensions/AdminCustomDomains.js.map +1 -0
- package/pulumi/extensions/AwsTags.d.ts +8 -0
- package/pulumi/extensions/AwsTags.js +15 -0
- package/pulumi/extensions/AwsTags.js.map +1 -0
- package/pulumi/extensions/BlueGreenDeployments.d.ts +134 -0
- package/pulumi/extensions/BlueGreenDeployments.js +34 -0
- package/pulumi/extensions/BlueGreenDeployments.js.map +1 -0
- package/pulumi/extensions/OpenSearch.d.ts +17 -0
- package/pulumi/extensions/OpenSearch.js +17 -0
- package/pulumi/extensions/OpenSearch.js.map +1 -0
- package/pulumi/extensions/Vpc.d.ts +71 -0
- package/pulumi/extensions/Vpc.js +25 -0
- package/pulumi/extensions/Vpc.js.map +1 -0
- package/pulumi/extensions/index.d.ts +220 -0
- package/pulumi/extensions/index.js +13 -0
- package/pulumi/extensions/index.js.map +1 -0
- package/pulumi/index.d.ts +3 -0
- package/pulumi/index.js +5 -0
- package/pulumi/index.js.map +1 -0
- package/pulumi/types.d.ts +44 -0
- package/pulumi/types.js +3 -0
- package/pulumi/types.js.map +1 -0
- package/pulumi/utils/addDomainsUrlsOutputs.d.ts +18 -0
- package/pulumi/utils/addDomainsUrlsOutputs.js +40 -0
- package/pulumi/utils/addDomainsUrlsOutputs.js.map +1 -0
- package/pulumi/utils/addServiceManifestTableItem.d.ts +12 -0
- package/pulumi/utils/addServiceManifestTableItem.js +28 -0
- package/pulumi/utils/addServiceManifestTableItem.js.map +1 -0
- package/pulumi/utils/crawlDirectory.d.ts +1 -0
- package/pulumi/utils/crawlDirectory.js +19 -0
- package/pulumi/utils/crawlDirectory.js.map +1 -0
- package/pulumi/utils/createAssetArchive.d.ts +2 -0
- package/pulumi/utils/createAssetArchive.js +8 -0
- package/pulumi/utils/createAssetArchive.js.map +1 -0
- package/pulumi/utils/dynamodb.d.ts +14 -0
- package/pulumi/utils/dynamodb.js +29 -0
- package/pulumi/utils/dynamodb.js.map +1 -0
- package/pulumi/utils/getPresignedPost.d.ts +11 -0
- package/pulumi/utils/getPresignedPost.js +34 -0
- package/pulumi/utils/getPresignedPost.js.map +1 -0
- package/pulumi/utils/index.d.ts +5 -0
- package/pulumi/utils/index.js +7 -0
- package/pulumi/utils/index.js.map +1 -0
- package/pulumi/utils/lambdaEnvVariables.d.ts +20 -0
- package/pulumi/utils/lambdaEnvVariables.js +62 -0
- package/pulumi/utils/lambdaEnvVariables.js.map +1 -0
- package/pulumi/utils/tagResources.d.ts +5 -0
- package/pulumi/utils/tagResources.js +33 -0
- package/pulumi/utils/tagResources.js.map +1 -0
- package/pulumi/utils/uploadFolderToS3.d.ts +26 -0
- package/pulumi/utils/uploadFolderToS3.js +147 -0
- package/pulumi/utils/uploadFolderToS3.js.map +1 -0
- package/pulumi/utils/withServiceManifest.d.ts +14 -0
- package/pulumi/utils/withServiceManifest.js +45 -0
- package/pulumi/utils/withServiceManifest.js.map +1 -0
- package/services/AdminStackOutputService.d.ts +10 -0
- package/services/AdminStackOutputService.js +16 -0
- package/services/AdminStackOutputService.js.map +1 -0
- package/services/ApiStackOutputService.d.ts +10 -0
- package/services/ApiStackOutputService.js +16 -0
- package/services/ApiStackOutputService.js.map +1 -0
- package/services/CoreStackOutputService.d.ts +10 -0
- package/services/CoreStackOutputService.js +16 -0
- package/services/CoreStackOutputService.js.map +1 -0
- package/utils/getTemplatesFolderPath.d.ts +1 -0
- package/utils/getTemplatesFolderPath.js +16 -0
- package/utils/getTemplatesFolderPath.js.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +3 -0
- package/utils/index.js.map +1 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import { tagResources } from "../utils/index.js";
|
|
3
|
+
import { getEnvVariableWebinyProjectName } from "../env/projectName.js";
|
|
4
|
+
import { getEnvVariableWebinyEnv } from "../env/env.js";
|
|
5
|
+
import { getEnvVariableWebinyVariant } from "../env/variant.js";
|
|
6
|
+
import { getProjectSdk } from "@webiny/project";
|
|
7
|
+
import { AwsTags as awsTagsExt } from "../extensions/AwsTags.js";
|
|
8
|
+
export function getAwsAccountId(app) {
|
|
9
|
+
return app.addHandler(() => {
|
|
10
|
+
return aws.getCallerIdentity({}).then(x => x.accountId);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export function getAwsRegion(app) {
|
|
14
|
+
return app.addHandler(() => {
|
|
15
|
+
return aws.config.requireRegion();
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export async function applyAwsResourceTags(appName) {
|
|
19
|
+
const sdk = await getProjectSdk();
|
|
20
|
+
const projectConfig = await sdk.getProjectConfig();
|
|
21
|
+
const awsTagsFromExtensions = {};
|
|
22
|
+
projectConfig.extensionsByType(awsTagsExt).forEach(ext => {
|
|
23
|
+
Object.assign(awsTagsFromExtensions, ext.params.tags);
|
|
24
|
+
});
|
|
25
|
+
tagResources({
|
|
26
|
+
...awsTagsFromExtensions,
|
|
27
|
+
WbyApp: appName,
|
|
28
|
+
WbyProjectName: getEnvVariableWebinyProjectName(),
|
|
29
|
+
WbyEnvironment: getEnvVariableWebinyEnv(),
|
|
30
|
+
WbyEnvironmentVariant: getEnvVariableWebinyVariant()
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=awsUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["aws","tagResources","getEnvVariableWebinyProjectName","getEnvVariableWebinyEnv","getEnvVariableWebinyVariant","getProjectSdk","AwsTags","awsTagsExt","getAwsAccountId","app","addHandler","getCallerIdentity","then","x","accountId","getAwsRegion","config","requireRegion","applyAwsResourceTags","appName","sdk","projectConfig","getProjectConfig","awsTagsFromExtensions","extensionsByType","forEach","ext","Object","assign","params","tags","WbyApp","WbyProjectName","WbyEnvironment","WbyEnvironmentVariant"],"sources":["awsUtils.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { type PulumiApp } from \"@webiny/pulumi\";\nimport { tagResources } from \"~/pulumi/utils/index.js\";\nimport { getEnvVariableWebinyProjectName } from \"~/pulumi/env/projectName.js\";\nimport { getEnvVariableWebinyEnv } from \"~/pulumi/env/env.js\";\nimport { getEnvVariableWebinyVariant } from \"~/pulumi/env/variant.js\";\nimport { type AppName, getProjectSdk } from \"@webiny/project\";\nimport { AwsTags as awsTagsExt } from \"~/pulumi/extensions/AwsTags.js\";\n\nexport function getAwsAccountId(app: PulumiApp) {\n return app.addHandler(() => {\n return aws.getCallerIdentity({}).then(x => x.accountId);\n });\n}\n\nexport function getAwsRegion(app: PulumiApp) {\n return app.addHandler(() => {\n return aws.config.requireRegion();\n });\n}\n\nexport async function applyAwsResourceTags(appName: AppName) {\n const sdk = await getProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const awsTagsFromExtensions: Record<string, string> = {};\n projectConfig.extensionsByType(awsTagsExt).forEach(ext => {\n Object.assign(awsTagsFromExtensions, ext.params.tags);\n });\n\n tagResources({\n ...awsTagsFromExtensions,\n WbyApp: appName,\n WbyProjectName: getEnvVariableWebinyProjectName(),\n WbyEnvironment: getEnvVariableWebinyEnv(),\n WbyEnvironmentVariant: getEnvVariableWebinyVariant()\n });\n}\n"],"mappings":"AAAA,OAAO,KAAKA,GAAG,MAAM,aAAa;AAElC,SAASC,YAAY;AACrB,SAASC,+BAA+B;AACxC,SAASC,uBAAuB;AAChC,SAASC,2BAA2B;AACpC,SAAuBC,aAAa,QAAQ,iBAAiB;AAC7D,SAASC,OAAO,IAAIC,UAAU;AAE9B,OAAO,SAASC,eAAeA,CAACC,GAAc,EAAE;EAC5C,OAAOA,GAAG,CAACC,UAAU,CAAC,MAAM;IACxB,OAAOV,GAAG,CAACW,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,SAAS,CAAC;EAC3D,CAAC,CAAC;AACN;AAEA,OAAO,SAASC,YAAYA,CAACN,GAAc,EAAE;EACzC,OAAOA,GAAG,CAACC,UAAU,CAAC,MAAM;IACxB,OAAOV,GAAG,CAACgB,MAAM,CAACC,aAAa,CAAC,CAAC;EACrC,CAAC,CAAC;AACN;AAEA,OAAO,eAAeC,oBAAoBA,CAACC,OAAgB,EAAE;EACzD,MAAMC,GAAG,GAAG,MAAMf,aAAa,CAAC,CAAC;EACjC,MAAMgB,aAAa,GAAG,MAAMD,GAAG,CAACE,gBAAgB,CAAC,CAAC;EAElD,MAAMC,qBAA6C,GAAG,CAAC,CAAC;EACxDF,aAAa,CAACG,gBAAgB,CAACjB,UAAU,CAAC,CAACkB,OAAO,CAACC,GAAG,IAAI;IACtDC,MAAM,CAACC,MAAM,CAACL,qBAAqB,EAAEG,GAAG,CAACG,MAAM,CAACC,IAAI,CAAC;EACzD,CAAC,CAAC;EAEF7B,YAAY,CAAC;IACT,GAAGsB,qBAAqB;IACxBQ,MAAM,EAAEZ,OAAO;IACfa,cAAc,EAAE9B,+BAA+B,CAAC,CAAC;IACjD+B,cAAc,EAAE9B,uBAAuB,CAAC,CAAC;IACzC+B,qBAAqB,EAAE9B,2BAA2B,CAAC;EACvD,CAAC,CAAC;AACN","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import type { PulumiAppModule } from "@webiny/pulumi";
|
|
3
|
+
export type BlueGreenRouterApiGateway = PulumiAppModule<typeof BlueGreenRouterApiGateway>;
|
|
4
|
+
export interface IBlueGreenRouterApiGatewayParams {
|
|
5
|
+
region: aws.Provider;
|
|
6
|
+
protect: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const BlueGreenRouterApiGateway: import("@webiny/pulumi").PulumiAppModuleDefinition<{
|
|
9
|
+
apiStage: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/stage").Stage>;
|
|
10
|
+
apiGateway: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/api").Api>;
|
|
11
|
+
}, IBlueGreenRouterApiGatewayParams>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import { createAppModule } from "@webiny/pulumi";
|
|
3
|
+
export const BlueGreenRouterApiGateway = createAppModule({
|
|
4
|
+
name: "BlueGreenRouterApiGateway",
|
|
5
|
+
config(app, params) {
|
|
6
|
+
const apiGateway = app.addResource(aws.apigatewayv2.Api, {
|
|
7
|
+
name: "blueGreenRouterApi",
|
|
8
|
+
opts: {
|
|
9
|
+
protect: params.protect,
|
|
10
|
+
provider: params.region
|
|
11
|
+
},
|
|
12
|
+
config: {
|
|
13
|
+
protocolType: "HTTP",
|
|
14
|
+
description: "Blue / Green Router API"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const apiStage = app.addResource(aws.apigatewayv2.Stage, {
|
|
18
|
+
name: "blue-green-stage",
|
|
19
|
+
opts: {
|
|
20
|
+
protect: params.protect,
|
|
21
|
+
provider: params.region
|
|
22
|
+
},
|
|
23
|
+
config: {
|
|
24
|
+
apiId: apiGateway.output.id,
|
|
25
|
+
autoDeploy: true,
|
|
26
|
+
name: app.params.run.env,
|
|
27
|
+
defaultRouteSettings: {
|
|
28
|
+
// Only enable when debugging. Note that by default, API Gateway does not
|
|
29
|
+
// have the required permissions to write logs to CloudWatch logs. More:
|
|
30
|
+
// https://coady.tech/aws-cloudwatch-logs-arn/
|
|
31
|
+
// loggingLevel: "INFO",
|
|
32
|
+
throttlingBurstLimit: 5000,
|
|
33
|
+
throttlingRateLimit: 10000
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
apiStage,
|
|
39
|
+
apiGateway
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=BlueGreenRouterApiGateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["aws","createAppModule","BlueGreenRouterApiGateway","name","config","app","params","apiGateway","addResource","apigatewayv2","Api","opts","protect","provider","region","protocolType","description","apiStage","Stage","apiId","output","id","autoDeploy","run","env","defaultRouteSettings","throttlingBurstLimit","throttlingRateLimit"],"sources":["BlueGreenRouterApiGateway.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\n\nexport type BlueGreenRouterApiGateway = PulumiAppModule<typeof BlueGreenRouterApiGateway>;\n\nexport interface IBlueGreenRouterApiGatewayParams {\n region: aws.Provider;\n protect: boolean;\n}\n\nexport const BlueGreenRouterApiGateway = createAppModule({\n name: \"BlueGreenRouterApiGateway\",\n config(app: PulumiApp, params: IBlueGreenRouterApiGatewayParams) {\n const apiGateway = app.addResource(aws.apigatewayv2.Api, {\n name: \"blueGreenRouterApi\",\n opts: {\n protect: params.protect,\n provider: params.region\n },\n config: {\n protocolType: \"HTTP\",\n description: \"Blue / Green Router API\"\n }\n });\n\n const apiStage = app.addResource(aws.apigatewayv2.Stage, {\n name: \"blue-green-stage\",\n opts: {\n protect: params.protect,\n provider: params.region\n },\n config: {\n apiId: apiGateway.output.id,\n autoDeploy: true,\n name: app.params.run.env,\n defaultRouteSettings: {\n // Only enable when debugging. Note that by default, API Gateway does not\n // have the required permissions to write logs to CloudWatch logs. More:\n // https://coady.tech/aws-cloudwatch-logs-arn/\n // loggingLevel: \"INFO\",\n throttlingBurstLimit: 5000,\n throttlingRateLimit: 10000\n }\n }\n });\n\n return {\n apiStage,\n apiGateway\n };\n }\n});\n"],"mappings":"AAAA,OAAO,KAAKA,GAAG,MAAM,aAAa;AAElC,SAASC,eAAe,QAAQ,gBAAgB;AAShD,OAAO,MAAMC,yBAAyB,GAAGD,eAAe,CAAC;EACrDE,IAAI,EAAE,2BAA2B;EACjCC,MAAMA,CAACC,GAAc,EAAEC,MAAwC,EAAE;IAC7D,MAAMC,UAAU,GAAGF,GAAG,CAACG,WAAW,CAACR,GAAG,CAACS,YAAY,CAACC,GAAG,EAAE;MACrDP,IAAI,EAAE,oBAAoB;MAC1BQ,IAAI,EAAE;QACFC,OAAO,EAAEN,MAAM,CAACM,OAAO;QACvBC,QAAQ,EAAEP,MAAM,CAACQ;MACrB,CAAC;MACDV,MAAM,EAAE;QACJW,YAAY,EAAE,MAAM;QACpBC,WAAW,EAAE;MACjB;IACJ,CAAC,CAAC;IAEF,MAAMC,QAAQ,GAAGZ,GAAG,CAACG,WAAW,CAACR,GAAG,CAACS,YAAY,CAACS,KAAK,EAAE;MACrDf,IAAI,EAAE,kBAAkB;MACxBQ,IAAI,EAAE;QACFC,OAAO,EAAEN,MAAM,CAACM,OAAO;QACvBC,QAAQ,EAAEP,MAAM,CAACQ;MACrB,CAAC;MACDV,MAAM,EAAE;QACJe,KAAK,EAAEZ,UAAU,CAACa,MAAM,CAACC,EAAE;QAC3BC,UAAU,EAAE,IAAI;QAChBnB,IAAI,EAAEE,GAAG,CAACC,MAAM,CAACiB,GAAG,CAACC,GAAG;QACxBC,oBAAoB,EAAE;UAClB;UACA;UACA;UACA;UACAC,oBAAoB,EAAE,IAAI;UAC1BC,mBAAmB,EAAE;QACzB;MACJ;IACJ,CAAC,CAAC;IAEF,OAAO;MACHV,QAAQ;MACRV;IACJ,CAAC;EACL;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import type { PulumiAppModule } from "@webiny/pulumi";
|
|
3
|
+
import type { GetCachePolicyResult } from "@pulumi/aws/cloudfront/getCachePolicy.js";
|
|
4
|
+
import type { GetOriginRequestPolicyResult } from "@pulumi/aws/cloudfront/getOriginRequestPolicy.js";
|
|
5
|
+
import type { IResolvedDomains } from "./types.js";
|
|
6
|
+
export type BlueGreenRouterCloudFront = PulumiAppModule<typeof BlueGreenRouterCloudFront>;
|
|
7
|
+
export interface IBlueGreenRouterCloudFrontConfig {
|
|
8
|
+
region: aws.Provider;
|
|
9
|
+
protect: boolean;
|
|
10
|
+
domains: IResolvedDomains;
|
|
11
|
+
cachePolicyId: GetCachePolicyResult;
|
|
12
|
+
originRequestPolicyId: GetOriginRequestPolicyResult;
|
|
13
|
+
}
|
|
14
|
+
export declare const BlueGreenRouterCloudFront: import("@webiny/pulumi").PulumiAppModuleDefinition<{
|
|
15
|
+
cloudFront: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/distribution.js").Distribution>;
|
|
16
|
+
cloudFrontFunction: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/function.js").Function>;
|
|
17
|
+
}, IBlueGreenRouterCloudFrontConfig>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import { createAppModule } from "@webiny/pulumi";
|
|
3
|
+
import { BlueGreenRouterApiGateway } from "./BlueGreenRouterApiGateway.js";
|
|
4
|
+
import { BlueGreenRouterCloudFrontStore } from "./BlueGreenRouterCloudFrontStore.js";
|
|
5
|
+
import { buildHandlerFunction } from "./functions/buildHandlerFunction.js";
|
|
6
|
+
import { BLUE_GREEN_ALLOWED_METHODS, BLUE_GREEN_CACHED_METHODS, BLUE_GREEN_ROUTER_STORE_KEY } from "./constants.js";
|
|
7
|
+
import { createCloudFrontFunctionDomainMap } from "./cloudfront/createCloudFrontFunctionDomainMap.js";
|
|
8
|
+
export const BlueGreenRouterCloudFront = createAppModule({
|
|
9
|
+
name: "BlueGreenRouterCloudFront",
|
|
10
|
+
config(app, config) {
|
|
11
|
+
const api = app.getModule(BlueGreenRouterApiGateway);
|
|
12
|
+
const store = app.getModule(BlueGreenRouterCloudFrontStore);
|
|
13
|
+
const domains = createCloudFrontFunctionDomainMap(config);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create a new CloudFront function that will be used to route the incoming requests to the correct CloudFront distribution.
|
|
17
|
+
*/
|
|
18
|
+
const cloudFrontFunction = app.addResource(aws.cloudfront.Function, {
|
|
19
|
+
name: `blue-green-router-viewer-request`,
|
|
20
|
+
opts: {
|
|
21
|
+
provider: config.region,
|
|
22
|
+
protect: config.protect
|
|
23
|
+
},
|
|
24
|
+
config: {
|
|
25
|
+
runtime: "cloudfront-js-2.0",
|
|
26
|
+
publish: true,
|
|
27
|
+
code: store.cloudFrontStore.output.arn.apply(arn => {
|
|
28
|
+
/**
|
|
29
|
+
* Unfortunately this is the only way to get the ID of the store.
|
|
30
|
+
* It is a UUID value.
|
|
31
|
+
*/
|
|
32
|
+
const id = arn.split("/").pop();
|
|
33
|
+
return buildHandlerFunction({
|
|
34
|
+
storeId: id,
|
|
35
|
+
storeKey: BLUE_GREEN_ROUTER_STORE_KEY,
|
|
36
|
+
domains
|
|
37
|
+
});
|
|
38
|
+
}),
|
|
39
|
+
keyValueStoreAssociations: store.cloudFrontStore.output.arn.apply(arn => {
|
|
40
|
+
return [arn];
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Create a CloudFront with attached function.
|
|
46
|
+
*/
|
|
47
|
+
const cloudFront = app.addResource(aws.cloudfront.Distribution, {
|
|
48
|
+
name: `blue-green-router-cloudfront`,
|
|
49
|
+
opts: {
|
|
50
|
+
provider: config.region,
|
|
51
|
+
protect: config.protect
|
|
52
|
+
},
|
|
53
|
+
config: {
|
|
54
|
+
httpVersion: "http2and3",
|
|
55
|
+
enabled: true,
|
|
56
|
+
priceClass: "PriceClass_100",
|
|
57
|
+
origins: [
|
|
58
|
+
/**
|
|
59
|
+
* A default origin that will be used in case of no match.
|
|
60
|
+
*/
|
|
61
|
+
{
|
|
62
|
+
domainName: api.apiGateway.output.apiEndpoint.apply(url => url.replace("https://", "")),
|
|
63
|
+
originId: "defaultOrigin",
|
|
64
|
+
customOriginConfig: {
|
|
65
|
+
originProtocolPolicy: "https-only",
|
|
66
|
+
httpPort: 80,
|
|
67
|
+
httpsPort: 443,
|
|
68
|
+
originSslProtocols: ["TLSv1.2"]
|
|
69
|
+
}
|
|
70
|
+
}],
|
|
71
|
+
defaultCacheBehavior: {
|
|
72
|
+
targetOriginId: `defaultOrigin`,
|
|
73
|
+
viewerProtocolPolicy: "redirect-to-https",
|
|
74
|
+
allowedMethods: BLUE_GREEN_ALLOWED_METHODS,
|
|
75
|
+
cachedMethods: BLUE_GREEN_CACHED_METHODS,
|
|
76
|
+
cachePolicyId: config.cachePolicyId.id,
|
|
77
|
+
originRequestPolicyId: config.originRequestPolicyId.id,
|
|
78
|
+
functionAssociations: [{
|
|
79
|
+
eventType: "viewer-request",
|
|
80
|
+
functionArn: cloudFrontFunction.output.arn
|
|
81
|
+
}]
|
|
82
|
+
},
|
|
83
|
+
restrictions: {
|
|
84
|
+
geoRestriction: {
|
|
85
|
+
restrictionType: "none"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
viewerCertificate: {
|
|
89
|
+
cloudfrontDefaultCertificate: true
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
cloudFront,
|
|
95
|
+
cloudFrontFunction
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=BlueGreenRouterCloudFront.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["aws","createAppModule","BlueGreenRouterApiGateway","BlueGreenRouterCloudFrontStore","buildHandlerFunction","BLUE_GREEN_ALLOWED_METHODS","BLUE_GREEN_CACHED_METHODS","BLUE_GREEN_ROUTER_STORE_KEY","createCloudFrontFunctionDomainMap","BlueGreenRouterCloudFront","name","config","app","api","getModule","store","domains","cloudFrontFunction","addResource","cloudfront","Function","opts","provider","region","protect","runtime","publish","code","cloudFrontStore","output","arn","apply","id","split","pop","storeId","storeKey","keyValueStoreAssociations","cloudFront","Distribution","httpVersion","enabled","priceClass","origins","domainName","apiGateway","apiEndpoint","url","replace","originId","customOriginConfig","originProtocolPolicy","httpPort","httpsPort","originSslProtocols","defaultCacheBehavior","targetOriginId","viewerProtocolPolicy","allowedMethods","cachedMethods","cachePolicyId","originRequestPolicyId","functionAssociations","eventType","functionArn","restrictions","geoRestriction","restrictionType","viewerCertificate","cloudfrontDefaultCertificate"],"sources":["BlueGreenRouterCloudFront.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport type { GetCachePolicyResult } from \"@pulumi/aws/cloudfront/getCachePolicy.js\";\nimport type { GetOriginRequestPolicyResult } from \"@pulumi/aws/cloudfront/getOriginRequestPolicy.js\";\nimport { BlueGreenRouterApiGateway } from \"./BlueGreenRouterApiGateway.js\";\nimport { BlueGreenRouterCloudFrontStore } from \"./BlueGreenRouterCloudFrontStore.js\";\nimport { buildHandlerFunction } from \"./functions/buildHandlerFunction.js\";\nimport {\n BLUE_GREEN_ALLOWED_METHODS,\n BLUE_GREEN_CACHED_METHODS,\n BLUE_GREEN_ROUTER_STORE_KEY\n} from \"./constants.js\";\nimport { createCloudFrontFunctionDomainMap } from \"./cloudfront/createCloudFrontFunctionDomainMap.js\";\nimport type { IResolvedDomains } from \"./types.js\";\n\nexport type BlueGreenRouterCloudFront = PulumiAppModule<typeof BlueGreenRouterCloudFront>;\n\nexport interface IBlueGreenRouterCloudFrontConfig {\n region: aws.Provider;\n protect: boolean;\n domains: IResolvedDomains;\n cachePolicyId: GetCachePolicyResult;\n originRequestPolicyId: GetOriginRequestPolicyResult;\n}\n\nexport const BlueGreenRouterCloudFront = createAppModule({\n name: \"BlueGreenRouterCloudFront\",\n config(app, config: IBlueGreenRouterCloudFrontConfig) {\n const api = app.getModule(BlueGreenRouterApiGateway);\n\n const store = app.getModule(BlueGreenRouterCloudFrontStore);\n\n const domains = createCloudFrontFunctionDomainMap(config);\n\n /**\n * Create a new CloudFront function that will be used to route the incoming requests to the correct CloudFront distribution.\n */\n const cloudFrontFunction = app.addResource(aws.cloudfront.Function, {\n name: `blue-green-router-viewer-request`,\n opts: {\n provider: config.region,\n protect: config.protect\n },\n config: {\n runtime: \"cloudfront-js-2.0\",\n publish: true,\n code: store.cloudFrontStore.output.arn.apply(arn => {\n /**\n * Unfortunately this is the only way to get the ID of the store.\n * It is a UUID value.\n */\n const id = arn.split(\"/\").pop() as string;\n return buildHandlerFunction({\n storeId: id,\n storeKey: BLUE_GREEN_ROUTER_STORE_KEY,\n domains\n });\n }),\n keyValueStoreAssociations: store.cloudFrontStore.output.arn.apply(arn => {\n return [arn];\n })\n }\n });\n /**\n * Create a CloudFront with attached function.\n */\n const cloudFront = app.addResource(aws.cloudfront.Distribution, {\n name: `blue-green-router-cloudfront`,\n opts: {\n provider: config.region,\n protect: config.protect\n },\n config: {\n httpVersion: \"http2and3\",\n enabled: true,\n priceClass: \"PriceClass_100\",\n origins: [\n /**\n * A default origin that will be used in case of no match.\n */\n {\n domainName: api.apiGateway.output.apiEndpoint.apply(url =>\n url.replace(\"https://\", \"\")\n ),\n originId: \"defaultOrigin\",\n customOriginConfig: {\n originProtocolPolicy: \"https-only\",\n httpPort: 80,\n httpsPort: 443,\n originSslProtocols: [\"TLSv1.2\"]\n }\n }\n ],\n defaultCacheBehavior: {\n targetOriginId: `defaultOrigin`,\n viewerProtocolPolicy: \"redirect-to-https\",\n allowedMethods: BLUE_GREEN_ALLOWED_METHODS,\n cachedMethods: BLUE_GREEN_CACHED_METHODS,\n cachePolicyId: config.cachePolicyId.id,\n originRequestPolicyId: config.originRequestPolicyId.id,\n functionAssociations: [\n {\n eventType: \"viewer-request\",\n functionArn: cloudFrontFunction.output.arn\n }\n ]\n },\n restrictions: {\n geoRestriction: {\n restrictionType: \"none\"\n }\n },\n viewerCertificate: {\n cloudfrontDefaultCertificate: true\n }\n }\n });\n\n return {\n cloudFront,\n cloudFrontFunction\n };\n }\n});\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import type { PulumiAppModule } from "@webiny/pulumi";
|
|
3
|
+
export type BlueGreenRouterCloudFrontStore = PulumiAppModule<typeof BlueGreenRouterCloudFrontStore>;
|
|
4
|
+
export interface IBlueGreenRouterCloudFrontStoreParams {
|
|
5
|
+
region: aws.Provider;
|
|
6
|
+
protect: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const BlueGreenRouterCloudFrontStore: import("@webiny/pulumi").PulumiAppModuleDefinition<{
|
|
9
|
+
cloudFrontStore: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/keyValueStore").KeyValueStore>;
|
|
10
|
+
}, IBlueGreenRouterCloudFrontStoreParams>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import { createAppModule } from "@webiny/pulumi";
|
|
3
|
+
export const BlueGreenRouterCloudFrontStore = createAppModule({
|
|
4
|
+
name: "BlueGreenRouterCloudFrontStore",
|
|
5
|
+
config(app, params) {
|
|
6
|
+
const cloudFrontStore = app.addResource(aws.cloudfront.KeyValueStore, {
|
|
7
|
+
name: "blueGreenRouterCloudFrontStore",
|
|
8
|
+
opts: {
|
|
9
|
+
provider: params.region,
|
|
10
|
+
protect: params.protect
|
|
11
|
+
},
|
|
12
|
+
config: {}
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
cloudFrontStore
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=BlueGreenRouterCloudFrontStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["aws","createAppModule","BlueGreenRouterCloudFrontStore","name","config","app","params","cloudFrontStore","addResource","cloudfront","KeyValueStore","opts","provider","region","protect"],"sources":["BlueGreenRouterCloudFrontStore.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\n\nexport type BlueGreenRouterCloudFrontStore = PulumiAppModule<typeof BlueGreenRouterCloudFrontStore>;\n\nexport interface IBlueGreenRouterCloudFrontStoreParams {\n region: aws.Provider;\n protect: boolean;\n}\n\nexport const BlueGreenRouterCloudFrontStore = createAppModule({\n name: \"BlueGreenRouterCloudFrontStore\",\n config(app: PulumiApp, params: IBlueGreenRouterCloudFrontStoreParams) {\n const cloudFrontStore = app.addResource(aws.cloudfront.KeyValueStore, {\n name: \"blueGreenRouterCloudFrontStore\",\n opts: {\n provider: params.region,\n protect: params.protect\n },\n config: {}\n });\n\n return {\n cloudFrontStore\n };\n }\n});\n"],"mappings":"AAAA,OAAO,KAAKA,GAAG,MAAM,aAAa;AAElC,SAASC,eAAe,QAAQ,gBAAgB;AAShD,OAAO,MAAMC,8BAA8B,GAAGD,eAAe,CAAC;EAC1DE,IAAI,EAAE,gCAAgC;EACtCC,MAAMA,CAACC,GAAc,EAAEC,MAA6C,EAAE;IAClE,MAAMC,eAAe,GAAGF,GAAG,CAACG,WAAW,CAACR,GAAG,CAACS,UAAU,CAACC,aAAa,EAAE;MAClEP,IAAI,EAAE,gCAAgC;MACtCQ,IAAI,EAAE;QACFC,QAAQ,EAAEN,MAAM,CAACO,MAAM;QACvBC,OAAO,EAAER,MAAM,CAACQ;MACpB,CAAC;MACDV,MAAM,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,OAAO;MACHG;IACJ,CAAC;EACL;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GetCachePolicyResult } from "@pulumi/aws/cloudfront/getCachePolicy.js";
|
|
2
|
+
import type { GetOriginRequestPolicyResult } from "@pulumi/aws/cloudfront/getOriginRequestPolicy.js";
|
|
3
|
+
export interface ICreateCloudFrontDefaultCacheBehaviorPoliciesOutput {
|
|
4
|
+
disableCachingCachePolicyId: GetCachePolicyResult;
|
|
5
|
+
forwardEverythingOriginRequestPolicyId: GetOriginRequestPolicyResult;
|
|
6
|
+
}
|
|
7
|
+
export declare const createCloudFrontDefaultCacheBehaviorPolicies: () => Promise<ICreateCloudFrontDefaultCacheBehaviorPoliciesOutput>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
export const createCloudFrontDefaultCacheBehaviorPolicies = async () => {
|
|
3
|
+
const disableCachingCachePolicyId = await aws.cloudfront.getCachePolicy({
|
|
4
|
+
name: "Managed-CachingDisabled"
|
|
5
|
+
});
|
|
6
|
+
const forwardEverythingOriginRequestPolicyId = await aws.cloudfront.getOriginRequestPolicy({
|
|
7
|
+
name: "Managed-AllViewerExceptHostHeader"
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
disableCachingCachePolicyId,
|
|
11
|
+
forwardEverythingOriginRequestPolicyId
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=createCloudFrontDefaultCacheBehaviorPolicies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["aws","createCloudFrontDefaultCacheBehaviorPolicies","disableCachingCachePolicyId","cloudfront","getCachePolicy","name","forwardEverythingOriginRequestPolicyId","getOriginRequestPolicy"],"sources":["createCloudFrontDefaultCacheBehaviorPolicies.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { GetCachePolicyResult } from \"@pulumi/aws/cloudfront/getCachePolicy.js\";\nimport type { GetOriginRequestPolicyResult } from \"@pulumi/aws/cloudfront/getOriginRequestPolicy.js\";\n\nexport interface ICreateCloudFrontDefaultCacheBehaviorPoliciesOutput {\n disableCachingCachePolicyId: GetCachePolicyResult;\n forwardEverythingOriginRequestPolicyId: GetOriginRequestPolicyResult;\n}\n\nexport const createCloudFrontDefaultCacheBehaviorPolicies =\n async (): Promise<ICreateCloudFrontDefaultCacheBehaviorPoliciesOutput> => {\n const disableCachingCachePolicyId = await aws.cloudfront.getCachePolicy({\n name: \"Managed-CachingDisabled\"\n });\n\n const forwardEverythingOriginRequestPolicyId = await aws.cloudfront.getOriginRequestPolicy({\n name: \"Managed-AllViewerExceptHostHeader\"\n });\n return {\n disableCachingCachePolicyId,\n forwardEverythingOriginRequestPolicyId\n };\n };\n"],"mappings":"AAAA,OAAO,KAAKA,GAAG,MAAM,aAAa;AASlC,OAAO,MAAMC,4CAA4C,GACrD,MAAAA,CAAA,KAA0E;EACtE,MAAMC,2BAA2B,GAAG,MAAMF,GAAG,CAACG,UAAU,CAACC,cAAc,CAAC;IACpEC,IAAI,EAAE;EACV,CAAC,CAAC;EAEF,MAAMC,sCAAsC,GAAG,MAAMN,GAAG,CAACG,UAAU,CAACI,sBAAsB,CAAC;IACvFF,IAAI,EAAE;EACV,CAAC,CAAC;EACF,OAAO;IACHH,2BAA2B;IAC3BI;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IResolvedDomains } from "../types.js";
|
|
2
|
+
export interface ICreateCloudFrontFunctionDomainMapParamsResult {
|
|
3
|
+
/**
|
|
4
|
+
* Name of the deployment (eg. green, blue, orange, etc.).
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
sourceDomain: string;
|
|
8
|
+
targetOriginId: string;
|
|
9
|
+
targetDomain: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ICreateCloudFrontFunctionDomainMapParams {
|
|
12
|
+
domains: IResolvedDomains;
|
|
13
|
+
}
|
|
14
|
+
export declare const createCloudFrontFunctionDomainMap: (params: ICreateCloudFrontFunctionDomainMapParams) => ICreateCloudFrontFunctionDomainMapParamsResult[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createOriginId } from "./createOriginId.js";
|
|
2
|
+
export const createCloudFrontFunctionDomainMap = params => {
|
|
3
|
+
const {
|
|
4
|
+
domains
|
|
5
|
+
} = params;
|
|
6
|
+
const results = [];
|
|
7
|
+
for (const domain of domains) {
|
|
8
|
+
for (const source of domain.sources) {
|
|
9
|
+
results.push({
|
|
10
|
+
name: domain.name,
|
|
11
|
+
sourceDomain: source,
|
|
12
|
+
targetDomain: domain.target,
|
|
13
|
+
targetOriginId: createOriginId({
|
|
14
|
+
type: domain.type,
|
|
15
|
+
name: domain.name
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return results;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=createCloudFrontFunctionDomainMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createOriginId","createCloudFrontFunctionDomainMap","params","domains","results","domain","source","sources","push","name","sourceDomain","targetDomain","target","targetOriginId","type"],"sources":["createCloudFrontFunctionDomainMap.ts"],"sourcesContent":["import type { IResolvedDomains } from \"../types.js\";\nimport { createOriginId } from \"./createOriginId.js\";\n\nexport interface ICreateCloudFrontFunctionDomainMapParamsResult {\n /**\n * Name of the deployment (eg. green, blue, orange, etc.).\n */\n name: string;\n sourceDomain: string;\n targetOriginId: string;\n targetDomain: string;\n}\n\nexport interface ICreateCloudFrontFunctionDomainMapParams {\n domains: IResolvedDomains;\n}\n\nexport const createCloudFrontFunctionDomainMap = (\n params: ICreateCloudFrontFunctionDomainMapParams\n): ICreateCloudFrontFunctionDomainMapParamsResult[] => {\n const { domains } = params;\n\n const results: ICreateCloudFrontFunctionDomainMapParamsResult[] = [];\n for (const domain of domains) {\n for (const source of domain.sources) {\n results.push({\n name: domain.name,\n sourceDomain: source,\n targetDomain: domain.target,\n targetOriginId: createOriginId({\n type: domain.type,\n name: domain.name\n })\n });\n }\n }\n return results;\n};\n"],"mappings":"AACA,SAASA,cAAc;AAgBvB,OAAO,MAAMC,iCAAiC,GAC1CC,MAAgD,IACG;EACnD,MAAM;IAAEC;EAAQ,CAAC,GAAGD,MAAM;EAE1B,MAAME,OAAyD,GAAG,EAAE;EACpE,KAAK,MAAMC,MAAM,IAAIF,OAAO,EAAE;IAC1B,KAAK,MAAMG,MAAM,IAAID,MAAM,CAACE,OAAO,EAAE;MACjCH,OAAO,CAACI,IAAI,CAAC;QACTC,IAAI,EAAEJ,MAAM,CAACI,IAAI;QACjBC,YAAY,EAAEJ,MAAM;QACpBK,YAAY,EAAEN,MAAM,CAACO,MAAM;QAC3BC,cAAc,EAAEb,cAAc,CAAC;UAC3Bc,IAAI,EAAET,MAAM,CAACS,IAAI;UACjBL,IAAI,EAAEJ,MAAM,CAACI;QACjB,CAAC;MACL,CAAC,CAAC;IACN;EACJ;EACA,OAAOL,OAAO;AAClB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ICreateOriginIdParams {
|
|
2
|
+
/**
|
|
3
|
+
* Name of the deployment (eg. green, blue, orange, etc.).
|
|
4
|
+
*/
|
|
5
|
+
name: string;
|
|
6
|
+
/**
|
|
7
|
+
* Type of the deployment (eg. api, etc.).
|
|
8
|
+
*/
|
|
9
|
+
type: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const createOriginId: (params: ICreateOriginIdParams) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["lodashUcFirst","createOriginId","params","type","name"],"sources":["createOriginId.ts"],"sourcesContent":["import lodashUcFirst from \"lodash/startCase.js\";\n\nexport interface ICreateOriginIdParams {\n /**\n * Name of the deployment (eg. green, blue, orange, etc.).\n */\n name: string;\n /**\n * Type of the deployment (eg. api, etc.).\n */\n type: string;\n}\n\nexport const createOriginId = (params: ICreateOriginIdParams): string => {\n const { type, name } = params;\n return `${type}${lodashUcFirst(name)}BlueGreenCloudFront`;\n};\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,qBAAqB;AAa/C,OAAO,MAAMC,cAAc,GAAIC,MAA6B,IAAa;EACrE,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAC7B,OAAO,GAAGC,IAAI,GAAGH,aAAa,CAACI,IAAI,CAAC,qBAAqB;AAC7D,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const BLUE_GREEN_ROUTER_STORE_KEY = "blueGreenRouterStore";
|
|
2
|
+
export const BLUE_GREEN_ALLOWED_METHODS = ["GET", "HEAD", "POST", "PUT", "PATCH", "OPTIONS", "DELETE"];
|
|
3
|
+
export const BLUE_GREEN_CACHED_METHODS = ["GET", "HEAD"];
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BLUE_GREEN_ROUTER_STORE_KEY","BLUE_GREEN_ALLOWED_METHODS","BLUE_GREEN_CACHED_METHODS"],"sources":["constants.ts"],"sourcesContent":["export const BLUE_GREEN_ROUTER_STORE_KEY = \"blueGreenRouterStore\";\nexport const BLUE_GREEN_ALLOWED_METHODS = [\n \"GET\",\n \"HEAD\",\n \"POST\",\n \"PUT\",\n \"PATCH\",\n \"OPTIONS\",\n \"DELETE\"\n];\nexport const BLUE_GREEN_CACHED_METHODS = [\"GET\", \"HEAD\"];\n"],"mappings":"AAAA,OAAO,MAAMA,2BAA2B,GAAG,sBAAsB;AACjE,OAAO,MAAMC,0BAA0B,GAAG,CACtC,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,SAAS,EACT,QAAQ,CACX;AACD,OAAO,MAAMC,yBAAyB,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
export declare function createBlueGreenPulumiApp(): import("@webiny/pulumi").PulumiApp<{
|
|
3
|
+
region: aws.Provider;
|
|
4
|
+
cloudfront: {
|
|
5
|
+
cloudFront: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/distribution.js").Distribution>;
|
|
6
|
+
cloudFrontFunction: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/function.js").Function>;
|
|
7
|
+
};
|
|
8
|
+
apiGateway: {
|
|
9
|
+
apiStage: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/stage.js").Stage>;
|
|
10
|
+
apiGateway: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/api.js").Api>;
|
|
11
|
+
};
|
|
12
|
+
store: {
|
|
13
|
+
cloudFrontStore: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/keyValueStore.js").KeyValueStore>;
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import { Region } from "@pulumi/aws";
|
|
3
|
+
import { createPulumiApp } from "@webiny/pulumi";
|
|
4
|
+
import { BlueGreenRouterCloudFront } from "./BlueGreenRouterCloudFront.js";
|
|
5
|
+
import { createCloudFrontDefaultCacheBehaviorPolicies } from "./cloudfront/createCloudFrontDefaultCacheBehaviorPolicies.js";
|
|
6
|
+
import { BlueGreenRouterApiGateway } from "./BlueGreenRouterApiGateway.js";
|
|
7
|
+
import { BlueGreenRouterCloudFrontStore } from "./BlueGreenRouterCloudFrontStore.js";
|
|
8
|
+
import { validateDeployments } from "./validation/validateDeployments.js";
|
|
9
|
+
import { getApplicationDomains } from "./domains/getApplicationDomains.js";
|
|
10
|
+
import { convertApplicationDomains } from "./domains/convertApplicationDomains.js";
|
|
11
|
+
import { resolveDomains } from "./domains/resolveDomains.js";
|
|
12
|
+
import { applyCustomDomain } from "../customDomain.js";
|
|
13
|
+
import { attachDomainsToOutput } from "./domains/attachDomainsToOutput.js";
|
|
14
|
+
import { BLUE_GREEN_ROUTER_STORE_KEY } from "./constants.js";
|
|
15
|
+
import { getProjectSdk } from "@webiny/project";
|
|
16
|
+
import { applyAwsResourceTags } from "../awsUtils.js";
|
|
17
|
+
import { getBgDeploymentsConfigFromExtension } from "../extensions/getBgDeploymentsConfigFromExtension.js";
|
|
18
|
+
export function createBlueGreenPulumiApp() {
|
|
19
|
+
return createPulumiApp({
|
|
20
|
+
name: "blueGreen",
|
|
21
|
+
path: "apps/blueGreen",
|
|
22
|
+
program: async app => {
|
|
23
|
+
const sdk = await getProjectSdk();
|
|
24
|
+
const projectConfig = await sdk.getProjectConfig();
|
|
25
|
+
const blueGreenConfig = getBgDeploymentsConfigFromExtension(projectConfig);
|
|
26
|
+
if (!blueGreenConfig) {
|
|
27
|
+
throw new Error(`Blue/Green deployments are not enabled. Please enable them in the project configuration.`);
|
|
28
|
+
}
|
|
29
|
+
const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();
|
|
30
|
+
const deployments = validateDeployments(blueGreenConfig.deployments);
|
|
31
|
+
const applicationsDomains = await getApplicationDomains({
|
|
32
|
+
stacks: deployments
|
|
33
|
+
});
|
|
34
|
+
if (pulumiResourceNamePrefix) {
|
|
35
|
+
app.onResource(resource => {
|
|
36
|
+
if (!resource.name.startsWith(pulumiResourceNamePrefix)) {
|
|
37
|
+
resource.name = `${pulumiResourceNamePrefix}${resource.name}`;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const deploymentsDomains = convertApplicationDomains({
|
|
42
|
+
input: applicationsDomains
|
|
43
|
+
});
|
|
44
|
+
const attachedDomains = blueGreenConfig.domains;
|
|
45
|
+
const domains = resolveDomains({
|
|
46
|
+
attachedDomains,
|
|
47
|
+
deploymentsDomains
|
|
48
|
+
});
|
|
49
|
+
const protect = app.env.isProduction;
|
|
50
|
+
const region = new aws.Provider(Region.USEast1, {
|
|
51
|
+
region: Region.USEast1
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Policies required for default Cache Behavior in CloudFront.
|
|
56
|
+
* We need to do this outside the module creation because it is async.
|
|
57
|
+
*/
|
|
58
|
+
const {
|
|
59
|
+
forwardEverythingOriginRequestPolicyId,
|
|
60
|
+
disableCachingCachePolicyId
|
|
61
|
+
} = await createCloudFrontDefaultCacheBehaviorPolicies();
|
|
62
|
+
const store = app.addModule(BlueGreenRouterCloudFrontStore, {
|
|
63
|
+
protect,
|
|
64
|
+
region
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* TODO Maybe have switching via deployment instead of changing the key?
|
|
68
|
+
* Key takes up to few minutes to propagate.
|
|
69
|
+
* Deployment takes 10 seconds + 30-60 seconds for the CloudFront to propagate.
|
|
70
|
+
*/
|
|
71
|
+
app.addResource(aws.cloudfront.KeyvaluestoreKey, {
|
|
72
|
+
name: "blue-green-router-store-key",
|
|
73
|
+
config: {
|
|
74
|
+
keyValueStoreArn: store.cloudFrontStore.output.arn,
|
|
75
|
+
key: BLUE_GREEN_ROUTER_STORE_KEY,
|
|
76
|
+
value: "green"
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const apiGateway = app.addModule(BlueGreenRouterApiGateway, {
|
|
80
|
+
protect,
|
|
81
|
+
region
|
|
82
|
+
});
|
|
83
|
+
const cloudfront = app.addModule(BlueGreenRouterCloudFront, {
|
|
84
|
+
protect,
|
|
85
|
+
region,
|
|
86
|
+
domains,
|
|
87
|
+
cachePolicyId: disableCachingCachePolicyId,
|
|
88
|
+
originRequestPolicyId: forwardEverythingOriginRequestPolicyId
|
|
89
|
+
});
|
|
90
|
+
const domainNames = domains.reduce((collection, domain) => {
|
|
91
|
+
for (const source of domain.sources) {
|
|
92
|
+
if (collection.includes(source)) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
collection.push(source);
|
|
96
|
+
}
|
|
97
|
+
return collection;
|
|
98
|
+
}, []);
|
|
99
|
+
applyCustomDomain(cloudfront.cloudFront, {
|
|
100
|
+
domains: domainNames,
|
|
101
|
+
sslSupportMethod: attachedDomains.sslSupportMethod,
|
|
102
|
+
acmCertificateArn: attachedDomains.acmCertificateArn
|
|
103
|
+
});
|
|
104
|
+
attachDomainsToOutput({
|
|
105
|
+
app,
|
|
106
|
+
domains,
|
|
107
|
+
cloudFront: cloudfront.cloudFront
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Applies internal and user-defined AWS tags.
|
|
111
|
+
await applyAwsResourceTags("blueGreen");
|
|
112
|
+
return {
|
|
113
|
+
region,
|
|
114
|
+
cloudfront,
|
|
115
|
+
apiGateway,
|
|
116
|
+
store
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=createBlueGreenPulumiApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["aws","Region","createPulumiApp","BlueGreenRouterCloudFront","createCloudFrontDefaultCacheBehaviorPolicies","BlueGreenRouterApiGateway","BlueGreenRouterCloudFrontStore","validateDeployments","getApplicationDomains","convertApplicationDomains","resolveDomains","applyCustomDomain","attachDomainsToOutput","BLUE_GREEN_ROUTER_STORE_KEY","getProjectSdk","applyAwsResourceTags","getBgDeploymentsConfigFromExtension","createBlueGreenPulumiApp","name","path","program","app","sdk","projectConfig","getProjectConfig","blueGreenConfig","Error","pulumiResourceNamePrefix","getPulumiResourceNamePrefix","deployments","applicationsDomains","stacks","onResource","resource","startsWith","deploymentsDomains","input","attachedDomains","domains","protect","env","isProduction","region","Provider","USEast1","forwardEverythingOriginRequestPolicyId","disableCachingCachePolicyId","store","addModule","addResource","cloudfront","KeyvaluestoreKey","config","keyValueStoreArn","cloudFrontStore","output","arn","key","value","apiGateway","cachePolicyId","originRequestPolicyId","domainNames","reduce","collection","domain","source","sources","includes","push","cloudFront","sslSupportMethod","acmCertificateArn"],"sources":["createBlueGreenPulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { Region } from \"@pulumi/aws\";\nimport { createPulumiApp } from \"@webiny/pulumi\";\nimport { BlueGreenRouterCloudFront } from \"./BlueGreenRouterCloudFront.js\";\nimport { createCloudFrontDefaultCacheBehaviorPolicies } from \"./cloudfront/createCloudFrontDefaultCacheBehaviorPolicies.js\";\nimport { BlueGreenRouterApiGateway } from \"./BlueGreenRouterApiGateway.js\";\nimport { BlueGreenRouterCloudFrontStore } from \"./BlueGreenRouterCloudFrontStore.js\";\nimport { validateDeployments } from \"./validation/validateDeployments.js\";\nimport { getApplicationDomains } from \"./domains/getApplicationDomains.js\";\nimport { convertApplicationDomains } from \"./domains/convertApplicationDomains.js\";\nimport { resolveDomains } from \"./domains/resolveDomains.js\";\nimport { applyCustomDomain } from \"~/pulumi/apps/customDomain.js\";\nimport { attachDomainsToOutput } from \"~/pulumi/apps/blueGreen/domains/attachDomainsToOutput.js\";\nimport { BLUE_GREEN_ROUTER_STORE_KEY } from \"./constants.js\";\nimport { getProjectSdk } from \"@webiny/project\";\nimport { applyAwsResourceTags } from \"~/pulumi/apps/awsUtils.js\";\nimport { getBgDeploymentsConfigFromExtension } from \"~/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js\";\n\nexport function createBlueGreenPulumiApp() {\n return createPulumiApp({\n name: \"blueGreen\",\n path: \"apps/blueGreen\",\n program: async app => {\n const sdk = await getProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const blueGreenConfig = getBgDeploymentsConfigFromExtension(projectConfig);\n if (!blueGreenConfig) {\n throw new Error(\n `Blue/Green deployments are not enabled. Please enable them in the project configuration.`\n );\n }\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n const deployments = validateDeployments(blueGreenConfig.deployments);\n\n const applicationsDomains = await getApplicationDomains({\n stacks: deployments\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 const deploymentsDomains = convertApplicationDomains({\n input: applicationsDomains\n });\n\n const attachedDomains = blueGreenConfig.domains;\n\n const domains = resolveDomains({\n attachedDomains,\n deploymentsDomains\n });\n const protect = app.env.isProduction;\n\n const region = new aws.Provider(Region.USEast1, {\n region: Region.USEast1\n });\n\n /**\n * Policies required for default Cache Behavior in CloudFront.\n * We need to do this outside the module creation because it is async.\n */\n const { forwardEverythingOriginRequestPolicyId, disableCachingCachePolicyId } =\n await createCloudFrontDefaultCacheBehaviorPolicies();\n const store = app.addModule(BlueGreenRouterCloudFrontStore, {\n protect,\n region\n });\n /**\n * TODO Maybe have switching via deployment instead of changing the key?\n * Key takes up to few minutes to propagate.\n * Deployment takes 10 seconds + 30-60 seconds for the CloudFront to propagate.\n */\n app.addResource(aws.cloudfront.KeyvaluestoreKey, {\n name: \"blue-green-router-store-key\",\n config: {\n keyValueStoreArn: store.cloudFrontStore.output.arn,\n key: BLUE_GREEN_ROUTER_STORE_KEY,\n value: \"green\"\n }\n });\n\n const apiGateway = app.addModule(BlueGreenRouterApiGateway, {\n protect,\n region\n });\n\n const cloudfront = app.addModule(BlueGreenRouterCloudFront, {\n protect,\n region,\n domains,\n cachePolicyId: disableCachingCachePolicyId,\n originRequestPolicyId: forwardEverythingOriginRequestPolicyId\n });\n\n const domainNames = domains.reduce<string[]>((collection, domain) => {\n for (const source of domain.sources) {\n if (collection.includes(source)) {\n continue;\n }\n collection.push(source);\n }\n return collection;\n }, []);\n\n applyCustomDomain(cloudfront.cloudFront, {\n domains: domainNames,\n sslSupportMethod: attachedDomains.sslSupportMethod,\n acmCertificateArn: attachedDomains.acmCertificateArn\n });\n\n attachDomainsToOutput({\n app,\n domains,\n cloudFront: cloudfront.cloudFront\n });\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"blueGreen\");\n\n return {\n region,\n cloudfront,\n apiGateway,\n store\n };\n }\n });\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as aws from "@pulumi/aws";
|
|
2
|
+
import { type PulumiApp, type PulumiAppResource } from "@webiny/pulumi";
|
|
3
|
+
import type { IResolvedDomains } from "../../../../pulumi/apps/blueGreen/types.js";
|
|
4
|
+
export interface IAttachDomainsToOutputParams {
|
|
5
|
+
app: PulumiApp;
|
|
6
|
+
domains: IResolvedDomains;
|
|
7
|
+
cloudFront: PulumiAppResource<typeof aws.cloudfront.Distribution>;
|
|
8
|
+
}
|
|
9
|
+
export declare const attachDomainsToOutput: (params: IAttachDomainsToOutputParams) => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const attachDomainsToOutput = params => {
|
|
2
|
+
const {
|
|
3
|
+
app,
|
|
4
|
+
cloudFront
|
|
5
|
+
} = params;
|
|
6
|
+
app.addHandler(() => {
|
|
7
|
+
const distributionDomain = cloudFront.output.domainName;
|
|
8
|
+
const distributionUrl = distributionDomain.apply(value => `https://${value}`);
|
|
9
|
+
app.addOutputs({
|
|
10
|
+
["distributionDomain"]: distributionDomain,
|
|
11
|
+
["distributionUrl"]: distributionUrl,
|
|
12
|
+
["environments"]: params.domains,
|
|
13
|
+
["domains"]: []
|
|
14
|
+
});
|
|
15
|
+
// We're adjusting the outputs via the `config.aliases` setter.
|
|
16
|
+
// At the time of implementing this, could not find a better solution.
|
|
17
|
+
cloudFront.config.aliases(aliases => {
|
|
18
|
+
const domains = [];
|
|
19
|
+
for (const alias of aliases || []) {
|
|
20
|
+
domains.push(alias);
|
|
21
|
+
}
|
|
22
|
+
app.addOutputs({
|
|
23
|
+
["domains"]: domains
|
|
24
|
+
});
|
|
25
|
+
return aliases;
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=attachDomainsToOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["attachDomainsToOutput","params","app","cloudFront","addHandler","distributionDomain","output","domainName","distributionUrl","apply","value","addOutputs","domains","config","aliases","alias","push"],"sources":["attachDomainsToOutput.ts"],"sourcesContent":["import type * as aws from \"@pulumi/aws\";\nimport { type PulumiApp, type PulumiAppResource } from \"@webiny/pulumi\";\nimport type { IResolvedDomains } from \"~/pulumi/apps/blueGreen/types.js\";\n\nexport interface IAttachDomainsToOutputParams {\n app: PulumiApp;\n domains: IResolvedDomains;\n cloudFront: PulumiAppResource<typeof aws.cloudfront.Distribution>;\n}\n\nexport const attachDomainsToOutput = (params: IAttachDomainsToOutputParams) => {\n const { app, cloudFront } = params;\n\n app.addHandler(() => {\n const distributionDomain = cloudFront.output.domainName;\n const distributionUrl = distributionDomain.apply(value => `https://${value}`);\n\n app.addOutputs({\n [\"distributionDomain\"]: distributionDomain,\n [\"distributionUrl\"]: distributionUrl,\n [\"environments\"]: params.domains,\n [\"domains\"]: []\n });\n // We're adjusting the outputs via the `config.aliases` setter.\n // At the time of implementing this, could not find a better solution.\n cloudFront.config.aliases(aliases => {\n const domains: string[] = [];\n\n for (const alias of aliases || []) {\n domains.push(alias);\n }\n\n app.addOutputs({\n [\"domains\"]: domains\n });\n\n return aliases;\n });\n });\n};\n"],"mappings":"AAUA,OAAO,MAAMA,qBAAqB,GAAIC,MAAoC,IAAK;EAC3E,MAAM;IAAEC,GAAG;IAAEC;EAAW,CAAC,GAAGF,MAAM;EAElCC,GAAG,CAACE,UAAU,CAAC,MAAM;IACjB,MAAMC,kBAAkB,GAAGF,UAAU,CAACG,MAAM,CAACC,UAAU;IACvD,MAAMC,eAAe,GAAGH,kBAAkB,CAACI,KAAK,CAACC,KAAK,IAAI,WAAWA,KAAK,EAAE,CAAC;IAE7ER,GAAG,CAACS,UAAU,CAAC;MACX,CAAC,oBAAoB,GAAGN,kBAAkB;MAC1C,CAAC,iBAAiB,GAAGG,eAAe;MACpC,CAAC,cAAc,GAAGP,MAAM,CAACW,OAAO;MAChC,CAAC,SAAS,GAAG;IACjB,CAAC,CAAC;IACF;IACA;IACAT,UAAU,CAACU,MAAM,CAACC,OAAO,CAACA,OAAO,IAAI;MACjC,MAAMF,OAAiB,GAAG,EAAE;MAE5B,KAAK,MAAMG,KAAK,IAAID,OAAO,IAAI,EAAE,EAAE;QAC/BF,OAAO,CAACI,IAAI,CAACD,KAAK,CAAC;MACvB;MAEAb,GAAG,CAACS,UAAU,CAAC;QACX,CAAC,SAAS,GAAGC;MACjB,CAAC,CAAC;MAEF,OAAOE,OAAO;IAClB,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|