terruvim-core-test 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/dist/src/core/config.js +2 -0
  2. package/dist/src/core/configMerge.js +266 -0
  3. package/dist/src/core/configUtils.js +72 -0
  4. package/dist/src/core/dependencyResolver.js +17 -0
  5. package/dist/src/core/deployUtils.js +73 -0
  6. package/dist/src/core/dynamicResourceManager.js +709 -0
  7. package/dist/src/core/entrypoint.js +56 -0
  8. package/dist/src/core/generateFinalConfig.js +45 -0
  9. package/dist/src/core/index.js +24 -0
  10. package/dist/src/core/resourceMap.js +99 -0
  11. package/dist/src/factories/accountPermissions.js +134 -0
  12. package/dist/src/factories/acmFactory.js +30 -0
  13. package/dist/src/factories/albFactory.js +331 -0
  14. package/dist/src/factories/attachSecretAccessPolicy.js +56 -0
  15. package/dist/src/factories/auroraFactory.js +619 -0
  16. package/dist/src/factories/backupPolicy.js +152 -0
  17. package/dist/src/factories/bastionFactory.js +91 -0
  18. package/dist/src/factories/bedrockFactory.js +334 -0
  19. package/dist/src/factories/budgetFactory.js +64 -0
  20. package/dist/src/factories/buildAlbCloudWatchAlarmsHelper.js +79 -0
  21. package/dist/src/factories/buildAlbCloudWatchDashboardHelper.js +106 -0
  22. package/dist/src/factories/buildAlbListenerRulesHelper.js +45 -0
  23. package/dist/src/factories/buildAlbListenersHelper.js +64 -0
  24. package/dist/src/factories/buildAlbResourceHelper.js +54 -0
  25. package/dist/src/factories/buildAlbRoute53RecordHelper.js +49 -0
  26. package/dist/src/factories/buildAlbTargetGroupsHelper.js +47 -0
  27. package/dist/src/factories/buildAlbWafAssociationHelper.js +43 -0
  28. package/dist/src/factories/buildAndPushDockerImage.js +57 -0
  29. package/dist/src/factories/buildAwsCloudWatchAlarmsHelper.js +118 -0
  30. package/dist/src/factories/buildCloudFrontRoute53RecordHelper.js +49 -0
  31. package/dist/src/factories/buildEcsClusterArgs.js +32 -0
  32. package/dist/src/factories/buildEcsSecrets.js +48 -0
  33. package/dist/src/factories/buildForceRedeployEnv.js +8 -0
  34. package/dist/src/factories/buildResourceOptions.js +11 -0
  35. package/dist/src/factories/buildS3StaticHostingCicdHelper.js +142 -0
  36. package/dist/src/factories/buildS3StaticHostingCloudWatchDashboardHelper.js +122 -0
  37. package/dist/src/factories/cloudTrailFactory.js +22 -0
  38. package/dist/src/factories/cloudWatchCompositeAlarmFactory.js +91 -0
  39. package/dist/src/factories/cloudWatchInsightsQueryFactory.js +83 -0
  40. package/dist/src/factories/cloudWatchLogGroupFactory.js +84 -0
  41. package/dist/src/factories/cloudfrontCodePipelineFactory.js +357 -0
  42. package/dist/src/factories/cloudwatchAlarmsFactory.js +121 -0
  43. package/dist/src/factories/codePipelineNotificationFactory.js +193 -0
  44. package/dist/src/factories/codePipelineNotificationRulesFactory.js +117 -0
  45. package/dist/src/factories/codeStarConnectionFactory.js +56 -0
  46. package/dist/src/factories/collectSecretKeys.js +18 -0
  47. package/dist/src/factories/comprehensiveNotificationFactory.js +250 -0
  48. package/dist/src/factories/costAndUsageReportFactory.js +32 -0
  49. package/dist/src/factories/createAwsAcmCertificate.js +40 -0
  50. package/dist/src/factories/createAwsBudget.js +40 -0
  51. package/dist/src/factories/createAwsCloudTrail.js +59 -0
  52. package/dist/src/factories/createAwsCloudwatchDashboard.js +59 -0
  53. package/dist/src/factories/createAwsEc2Instance.js +40 -0
  54. package/dist/src/factories/createAwsEventBridgeEventBus.js +40 -0
  55. package/dist/src/factories/createAwsGuardDutyDetector.js +40 -0
  56. package/dist/src/factories/createAwsGuardDutyDetectorFeature.js +45 -0
  57. package/dist/src/factories/createAwsGuardDutyFilter.js +46 -0
  58. package/dist/src/factories/createAwsGuardDutyPublishingDestination.js +50 -0
  59. package/dist/src/factories/createAwsHostedZone.js +40 -0
  60. package/dist/src/factories/createAwsIamRole.js +49 -0
  61. package/dist/src/factories/createAwsIamRoleInlinePolicies.js +48 -0
  62. package/dist/src/factories/createAwsIdentitystoreGroup.js +44 -0
  63. package/dist/src/factories/createAwsIdentitystoreGroupMembership.js +56 -0
  64. package/dist/src/factories/createAwsIdentitystoreUser.js +47 -0
  65. package/dist/src/factories/createAwsInspectorAssessmentTarget.js +47 -0
  66. package/dist/src/factories/createAwsInspectorDelegatedAdminAccount.js +47 -0
  67. package/dist/src/factories/createAwsInspectorEnabler.js +49 -0
  68. package/dist/src/factories/createAwsInspectorOrganizationConfiguration.js +55 -0
  69. package/dist/src/factories/createAwsKmsAliases.js +47 -0
  70. package/dist/src/factories/createAwsKmsKey.js +51 -0
  71. package/dist/src/factories/createAwsMacieAccount.js +45 -0
  72. package/dist/src/factories/createAwsMacieClassificationJob.js +53 -0
  73. package/dist/src/factories/createAwsMacieMember.js +49 -0
  74. package/dist/src/factories/createAwsMacieOrganizationConfiguration.js +44 -0
  75. package/dist/src/factories/createAwsRdsCluster.js +40 -0
  76. package/dist/src/factories/createAwsRdsClusterInstance.js +40 -0
  77. package/dist/src/factories/createAwsRdsInstance.js +40 -0
  78. package/dist/src/factories/createAwsRdsSubnetGroup.js +40 -0
  79. package/dist/src/factories/createAwsRoute53Record.js +40 -0
  80. package/dist/src/factories/createAwsSecret.js +40 -0
  81. package/dist/src/factories/createAwsSecretRotation.js +40 -0
  82. package/dist/src/factories/createAwsSecretVersion.js +40 -0
  83. package/dist/src/factories/createAwsSecurityGroup.js +40 -0
  84. package/dist/src/factories/createAwsSecurityGroupRule.js +40 -0
  85. package/dist/src/factories/createAwsSecurityHubAccount.js +40 -0
  86. package/dist/src/factories/createAwsSecurityHubAutomationRule.js +48 -0
  87. package/dist/src/factories/createAwsSecurityHubStandardsControl.js +44 -0
  88. package/dist/src/factories/createAwsSecurityHubStandardsSubscription.js +42 -0
  89. package/dist/src/factories/createAwsSesDomainDkim.js +40 -0
  90. package/dist/src/factories/createAwsSesDomainIdentity.js +40 -0
  91. package/dist/src/factories/createAwsSesEmailIdentity.js +40 -0
  92. package/dist/src/factories/createAwsSnsSubscription.js +62 -0
  93. package/dist/src/factories/createAwsSnsTopic.js +41 -0
  94. package/dist/src/factories/createAwsSqsQueue.js +40 -0
  95. package/dist/src/factories/createAwsSsmParameters.js +66 -0
  96. package/dist/src/factories/createAwsSsoAccountAssignment.js +66 -0
  97. package/dist/src/factories/createAwsSsoPermissionSet.js +64 -0
  98. package/dist/src/factories/createAwsStepFunctionsStateMachine.js +40 -0
  99. package/dist/src/factories/createBudget.js +56 -0
  100. package/dist/src/factories/createBudgetWithSnsAlert.js +79 -0
  101. package/dist/src/factories/createCostAndUsageReport.js +40 -0
  102. package/dist/src/factories/createEcrRepo.js +69 -0
  103. package/dist/src/factories/createEcsRolesAndPolicies.js +84 -0
  104. package/dist/src/factories/createEcsService.js +71 -0
  105. package/dist/src/factories/createEnvSecret.js +60 -0
  106. package/dist/src/factories/createGithubCodeStarConnection.js +44 -0
  107. package/dist/src/factories/createIamUserWithAccessKey.js +44 -0
  108. package/dist/src/factories/createLambdaFunction.js +89 -0
  109. package/dist/src/factories/createLambdaPermission.js +57 -0
  110. package/dist/src/factories/createListenerRule.js +68 -0
  111. package/dist/src/factories/createLogGroup.js +44 -0
  112. package/dist/src/factories/createSlackChannelConfiguration.js +49 -0
  113. package/dist/src/factories/createTargetGroup.js +50 -0
  114. package/dist/src/factories/createTaskDefinition.js +49 -0
  115. package/dist/src/factories/createVpcEndpoint.js +49 -0
  116. package/dist/src/factories/dashboardFactory.js +94 -0
  117. package/dist/src/factories/dataProtectionPolicyBuilder.js +103 -0
  118. package/dist/src/factories/ec2Factory.js +67 -0
  119. package/dist/src/factories/ecsClusterFactory.js +90 -0
  120. package/dist/src/factories/ecsCodePipelineFactory.js +308 -0
  121. package/dist/src/factories/ecsServiceFactory.js +350 -0
  122. package/dist/src/factories/enhancedCloudFrontCodePipelineFactory.js +205 -0
  123. package/dist/src/factories/enhancedEcsCodePipelineFactory.js +189 -0
  124. package/dist/src/factories/eventBridgeBusFactory.js +84 -0
  125. package/dist/src/factories/eventBridgeFactory.js +26 -0
  126. package/dist/src/factories/eventBridgeRuleFactory.js +114 -0
  127. package/dist/src/factories/fetchAllSecrets.js +51 -0
  128. package/dist/src/factories/getDeterministicPriority.js +13 -0
  129. package/dist/src/factories/getOrCreateSshKeyPair.js +57 -0
  130. package/dist/src/factories/guardDutyFactory.js +151 -0
  131. package/dist/src/factories/hostedZoneFactory.js +30 -0
  132. package/dist/src/factories/iamRoleFactory.js +29 -0
  133. package/dist/src/factories/inspectorFactory.js +109 -0
  134. package/dist/src/factories/kmsKeyFactory.js +32 -0
  135. package/dist/src/factories/lambdaFactory.js +133 -0
  136. package/dist/src/factories/lambdaPermissionFactory.js +32 -0
  137. package/dist/src/factories/logDataProtectionPolicyFactory.js +81 -0
  138. package/dist/src/factories/macieFactory.js +85 -0
  139. package/dist/src/factories/networkingFactory.js +429 -0
  140. package/dist/src/factories/opensearchCollectionFactory.js +109 -0
  141. package/dist/src/factories/organizationFactory.js +221 -0
  142. package/dist/src/factories/processReservedInstances.js +6 -0
  143. package/dist/src/factories/processSavingsPlans.js +43 -0
  144. package/dist/src/factories/rdsFactory.js +40 -0
  145. package/dist/src/factories/recordFactory.js +36 -0
  146. package/dist/src/factories/resolveEnvSecrets.js +14 -0
  147. package/dist/src/factories/resourceFactory.js +12 -0
  148. package/dist/src/factories/s3Factory.js +262 -0
  149. package/dist/src/factories/s3StaticHostingFactory.backup.js +424 -0
  150. package/dist/src/factories/s3StaticHostingFactory.js +348 -0
  151. package/dist/src/factories/s3StaticHostingFactory.refactored.js +334 -0
  152. package/dist/src/factories/savingsPlanFactory.js +26 -0
  153. package/dist/src/factories/secretsManagerFactory.js +107 -0
  154. package/dist/src/factories/securityGroupFactory.js +28 -0
  155. package/dist/src/factories/securityGroupRuleFactory.js +43 -0
  156. package/dist/src/factories/securityHubFactory.js +96 -0
  157. package/dist/src/factories/sesDomainDkimFactory.js +25 -0
  158. package/dist/src/factories/sesFactory.js +25 -0
  159. package/dist/src/factories/sesIdentitiesFactory.js +134 -0
  160. package/dist/src/factories/simpleNotificationFactory.js +112 -0
  161. package/dist/src/factories/smtpUserFactory.js +108 -0
  162. package/dist/src/factories/snsFactory.js +87 -0
  163. package/dist/src/factories/sqsFactory.js +41 -0
  164. package/dist/src/factories/ssmParameterFactory.js +67 -0
  165. package/dist/src/factories/ssoFactory.js +32 -0
  166. package/dist/src/factories/ssoGroupFactory.js +41 -0
  167. package/dist/src/factories/ssoPermissionSetFactory.js +29 -0
  168. package/dist/src/factories/ssoUserFactory.js +30 -0
  169. package/dist/src/factories/stepFunctionsFactory.js +32 -0
  170. package/dist/src/factories/tagPolicies.js +99 -0
  171. package/dist/src/factories/transformBudgetCostFilters.js +8 -0
  172. package/dist/src/factories/transformBudgetNotifications.js +12 -0
  173. package/dist/src/factories/transformBudgetPlannedLimits.js +8 -0
  174. package/dist/src/factories/types.js +2 -0
  175. package/dist/src/factories/validateAcmConfig.js +26 -0
  176. package/dist/src/factories/validateAuroraConfig.js +8 -0
  177. package/dist/src/factories/validateBedrockConfig.js +124 -0
  178. package/dist/src/factories/validateDashboardConfig.js +28 -0
  179. package/dist/src/factories/validateEventBridgeConfig.js +14 -0
  180. package/dist/src/factories/validateHostedZoneConfig.js +26 -0
  181. package/dist/src/factories/validateIamRoleConfig.js +8 -0
  182. package/dist/src/factories/validateKmsKeyConfig.js +8 -0
  183. package/dist/src/factories/validateRdsConfig.js +17 -0
  184. package/dist/src/factories/validateRoute53RecordConfig.js +41 -0
  185. package/dist/src/factories/validateS3Config.js +8 -0
  186. package/dist/src/factories/validateSecretsManagerConfig.js +8 -0
  187. package/dist/src/factories/validateSecurityGroupConfig.js +8 -0
  188. package/dist/src/factories/validateSecurityGroupRuleConfig.js +8 -0
  189. package/dist/src/factories/validateSesDomainDkimConfig.js +8 -0
  190. package/dist/src/factories/validateSesDomainIdentityConfig.js +8 -0
  191. package/dist/src/factories/validateSesIdentitiesConfig.js +40 -0
  192. package/dist/src/factories/validateSnsConfig.js +11 -0
  193. package/dist/src/factories/validateSqsConfig.js +11 -0
  194. package/dist/src/factories/validateSsmParameterFactoryConfig.js +9 -0
  195. package/dist/src/factories/validateStepFunctionsConfig.js +8 -0
  196. package/dist/src/factories/vpcEndpointFactory.js +98 -0
  197. package/dist/src/factories/wafFactory.js +499 -0
  198. package/package.json +71 -0
  199. package/scripts/copy-assets.js +136 -0
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.EnhancedCloudFrontCodePipelineFactory = void 0;
37
+ const aws = __importStar(require("@pulumi/aws"));
38
+ const resourceFactory_1 = require("./resourceFactory");
39
+ const cloudfrontCodePipelineFactory_1 = require("./cloudfrontCodePipelineFactory");
40
+ const dataProtectionPolicyBuilder_1 = require("./dataProtectionPolicyBuilder");
41
+ const codePipelineNotificationFactory_1 = require("./codePipelineNotificationFactory");
42
+ const codePipelineNotificationRulesFactory_1 = require("./codePipelineNotificationRulesFactory");
43
+ class EnhancedCloudFrontCodePipelineFactory extends resourceFactory_1.ResourceFactory {
44
+ buildDataProtectionPolicy(config, logGroupName) {
45
+ if (!config?.enabled) {
46
+ return undefined;
47
+ }
48
+ return (0, dataProtectionPolicyBuilder_1.buildDataProtectionPolicy)(config, logGroupName, dataProtectionPolicyBuilder_1.DEFAULT_DATA_IDENTIFIERS.CODEPIPELINE_LOGS, "CloudFront CodePipeline");
49
+ }
50
+ validateConfig(config) {
51
+ if (!config.configuration?.pipeline) {
52
+ throw new Error("Pipeline configuration is required");
53
+ }
54
+ const pipeline = config.configuration.pipeline;
55
+ if (!pipeline.repoOwner || !pipeline.repoName || !pipeline.branch) {
56
+ throw new Error("Repository owner, name, and branch are required");
57
+ }
58
+ if (!pipeline.codestarConnectionArn) {
59
+ throw new Error("CodeStar connection ARN is required");
60
+ }
61
+ if (!pipeline.cloudfrontDistributionId || !pipeline.s3BucketName) {
62
+ throw new Error("CloudFront distribution ID and S3 bucket name are required");
63
+ }
64
+ if (config.configuration.notifications?.enabled && !config.configuration.notifications.snsTopicArn) {
65
+ throw new Error("SNS topic ARN is required when notifications are enabled");
66
+ }
67
+ }
68
+ async createResource(config) {
69
+ const cloudFrontPipelineFactory = new cloudfrontCodePipelineFactory_1.CloudFrontCodePipelineFactory();
70
+ const cloudFrontConfig = {
71
+ id: config.id,
72
+ meta: config.meta,
73
+ configuration: {
74
+ ...config.configuration.pipeline,
75
+ buildImage: config.configuration.pipeline.buildImage || "aws/codebuild/amazonlinux2-x86_64-standard:5.0",
76
+ buildTimeout: config.configuration.pipeline.buildTimeout || 20,
77
+ privilegedMode: config.configuration.pipeline.privilegedMode || false,
78
+ computeType: config.configuration.pipeline.computeType || "BUILD_GENERAL1_LARGE",
79
+ environmentType: config.configuration.pipeline.environmentType || "LINUX_CONTAINER",
80
+ deployCodePipelineInVpc: config.configuration.pipeline.deployCodePipelineInVpc ?? true,
81
+ buildspecPath: config.configuration.pipeline.buildspecPath || "./assets/buildspecs/buildspec-cloudfront-enhanced.yml",
82
+ },
83
+ inputs: config.inputs || {},
84
+ };
85
+ const cloudFrontPipeline = await cloudFrontPipelineFactory.createResource(cloudFrontConfig);
86
+ const resources = {
87
+ pipeline: cloudFrontPipeline,
88
+ };
89
+ if (config.configuration.notifications?.enabled) {
90
+ if (config.configuration.notifications.useNotificationRules) {
91
+ const notificationRulesFactory = new codePipelineNotificationRulesFactory_1.CodePipelineNotificationRulesFactory();
92
+ const notificationRulesConfig = {
93
+ id: `${config.id}-notification-rules`,
94
+ configuration: {
95
+ pipelineArn: cloudFrontPipeline.arn,
96
+ snsTopicArn: config.configuration.notifications.snsTopicArn,
97
+ eventTypeIds: config.configuration.notifications.notificationEventTypes || [
98
+ "codepipeline-pipeline-pipeline-execution-started",
99
+ "codepipeline-pipeline-pipeline-execution-succeeded",
100
+ "codepipeline-pipeline-pipeline-execution-failed",
101
+ "codepipeline-pipeline-manual-approval-needed"
102
+ ],
103
+ detailType: config.configuration.notifications.notificationDetailType || "FULL",
104
+ name: `${config.id}-pipeline-notifications`,
105
+ tags: config.tags
106
+ }
107
+ };
108
+ const notificationRulesResources = await notificationRulesFactory.createResource(notificationRulesConfig);
109
+ resources.notificationRules = notificationRulesResources;
110
+ }
111
+ else {
112
+ const notificationFactory = new codePipelineNotificationFactory_1.CodePipelineNotificationFactory();
113
+ const notificationConfig = {
114
+ id: `${config.id}-notifications`,
115
+ configuration: {
116
+ pipelineName: cloudFrontPipeline.name,
117
+ snsTopicArn: config.configuration.notifications.snsTopicArn,
118
+ eventTypes: (config.configuration.notifications.eventTypes || [
119
+ "PIPELINE_EXECUTION_STARTED",
120
+ "PIPELINE_EXECUTION_SUCCEEDED",
121
+ "PIPELINE_EXECUTION_FAILED",
122
+ "STAGE_EXECUTION_FAILED"
123
+ ]),
124
+ detailType: config.configuration.notifications.detailType || "Full",
125
+ },
126
+ };
127
+ const notificationResources = await notificationFactory.createResource(notificationConfig);
128
+ resources.notifications = notificationResources;
129
+ }
130
+ }
131
+ if (config.configuration.cloudwatchLogsDataProtection?.enabled) {
132
+ const buildProjectName = `${config.meta.environment}-${config.id}-build`;
133
+ const logGroupName = `/aws/codebuild/${buildProjectName}`;
134
+ const dataProtectionPolicy = this.buildDataProtectionPolicy(config.configuration.cloudwatchLogsDataProtection, logGroupName);
135
+ if (dataProtectionPolicy) {
136
+ new aws.cloudwatch.LogDataProtectionPolicy(`${config.meta.environment}-${config.id}-build-data-protection`, {
137
+ logGroupName: logGroupName,
138
+ policyDocument: JSON.stringify(dataProtectionPolicy),
139
+ }, {
140
+ dependsOn: [cloudFrontPipeline]
141
+ });
142
+ console.log(`CloudFront CodePipeline: Applied data protection policy to existing CodeBuild log group: ${logGroupName}`);
143
+ }
144
+ }
145
+ return resources;
146
+ }
147
+ getOutputs(resources) {
148
+ const cloudFrontFactory = new cloudfrontCodePipelineFactory_1.CloudFrontCodePipelineFactory();
149
+ const cloudFrontOutputs = cloudFrontFactory.getOutputs(resources.pipeline);
150
+ const outputs = {
151
+ arn: cloudFrontOutputs.arn,
152
+ name: cloudFrontOutputs.name,
153
+ url: cloudFrontOutputs.url,
154
+ codebuildProjectName: cloudFrontOutputs.codebuildProjectName,
155
+ };
156
+ if (resources.notifications) {
157
+ outputs.notificationEventRuleArn = resources.notifications.eventRule.arn;
158
+ outputs.notificationEventRuleName = resources.notifications.eventRule.name;
159
+ }
160
+ if (resources.notificationRules) {
161
+ const notificationRulesFactory = new codePipelineNotificationRulesFactory_1.CodePipelineNotificationRulesFactory();
162
+ const notificationRulesOutputs = notificationRulesFactory.getOutputs(resources.notificationRules);
163
+ outputs.notificationRuleArn = notificationRulesOutputs.notificationRuleArn;
164
+ }
165
+ return outputs;
166
+ }
167
+ static createPipeline(config) {
168
+ const factory = new EnhancedCloudFrontCodePipelineFactory();
169
+ const enhancedConfig = {
170
+ id: config.id,
171
+ meta: config.meta,
172
+ configuration: {
173
+ pipeline: {
174
+ repoOwner: config.repoOwner,
175
+ repoName: config.repoName,
176
+ branch: config.branch,
177
+ codestarConnectionArn: config.codestarConnectionArn,
178
+ cloudfrontDistributionId: config.cloudfrontDistributionId,
179
+ s3BucketName: config.s3BucketName,
180
+ buildImage: "aws/codebuild/amazonlinux2-x86_64-standard:5.0",
181
+ buildTimeout: config.buildTimeout || 20,
182
+ deployCodePipelineInVpc: config.deployCodePipelineInVpc ?? true,
183
+ vpcConfig: config.vpcConfig,
184
+ tags: config.tags,
185
+ },
186
+ notifications: config.snsTopicArn ? {
187
+ enabled: true,
188
+ snsTopicArn: config.snsTopicArn,
189
+ eventTypes: [
190
+ "PIPELINE_EXECUTION_STARTED",
191
+ "PIPELINE_EXECUTION_SUCCEEDED",
192
+ "PIPELINE_EXECUTION_FAILED",
193
+ "STAGE_EXECUTION_FAILED"
194
+ ],
195
+ detailType: "Full",
196
+ successNotifications: true,
197
+ failureNotifications: true,
198
+ startNotifications: true,
199
+ } : undefined,
200
+ },
201
+ };
202
+ return factory.createResource(enhancedConfig);
203
+ }
204
+ }
205
+ exports.EnhancedCloudFrontCodePipelineFactory = EnhancedCloudFrontCodePipelineFactory;
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.EnhancedEcsCodePipelineFactory = void 0;
37
+ const aws = __importStar(require("@pulumi/aws"));
38
+ const resourceFactory_1 = require("./resourceFactory");
39
+ const ecsCodePipelineFactory_1 = require("./ecsCodePipelineFactory");
40
+ const dataProtectionPolicyBuilder_1 = require("./dataProtectionPolicyBuilder");
41
+ const codePipelineNotificationFactory_1 = require("./codePipelineNotificationFactory");
42
+ const codePipelineNotificationRulesFactory_1 = require("./codePipelineNotificationRulesFactory");
43
+ class EnhancedEcsCodePipelineFactory extends resourceFactory_1.ResourceFactory {
44
+ buildDataProtectionPolicy(config, logGroupName) {
45
+ if (!config?.enabled) {
46
+ return undefined;
47
+ }
48
+ return (0, dataProtectionPolicyBuilder_1.buildDataProtectionPolicy)(config, logGroupName, dataProtectionPolicyBuilder_1.DEFAULT_DATA_IDENTIFIERS.CODEPIPELINE_LOGS, "ECS CodePipeline");
49
+ }
50
+ validateConfig(config) {
51
+ if (!config.configuration?.pipeline) {
52
+ throw new Error("Pipeline configuration is required");
53
+ }
54
+ const pipeline = config.configuration.pipeline;
55
+ if (!pipeline.repoOwner || !pipeline.repoName || !pipeline.branch) {
56
+ throw new Error("Repository owner, name, and branch are required");
57
+ }
58
+ const serviceName = pipeline.serviceName || pipeline.ecsServiceName;
59
+ const clusterName = pipeline.clusterName || pipeline.ecsClusterName;
60
+ if (!serviceName || !clusterName) {
61
+ throw new Error("ECS service name and cluster name are required (serviceName/clusterName or ecsServiceName/ecsClusterName)");
62
+ }
63
+ if (!pipeline.codestarConnectionArn) {
64
+ throw new Error("CodeStar connection ARN is required");
65
+ }
66
+ if (config.configuration.notifications?.enabled && !config.configuration.notifications.snsTopicArn) {
67
+ throw new Error("SNS topic ARN is required when notifications are enabled");
68
+ }
69
+ }
70
+ async createResource(config) {
71
+ const ecsPipelineFactory = new ecsCodePipelineFactory_1.ECSCodePipelineFactory();
72
+ const pipeline = config.configuration.pipeline;
73
+ const serviceName = pipeline.serviceName || pipeline.ecsServiceName;
74
+ const clusterName = pipeline.clusterName || pipeline.ecsClusterName;
75
+ const ecsConfig = {
76
+ id: config.id,
77
+ meta: config.meta,
78
+ configuration: {
79
+ repoOwner: pipeline.repoOwner,
80
+ repoName: pipeline.repoName,
81
+ branch: pipeline.branch,
82
+ codestarConnectionArn: pipeline.codestarConnectionArn,
83
+ buildspecPath: pipeline.buildspecPath,
84
+ buildImage: pipeline.buildImage || "aws/codebuild/amazonlinux2-x86_64-standard:5.0",
85
+ buildTimeout: pipeline.buildTimeout || 20,
86
+ privilegedMode: pipeline.privilegedMode || false,
87
+ computeType: pipeline.computeType || "BUILD_GENERAL1_LARGE",
88
+ environmentType: pipeline.environmentType || "LINUX_CONTAINER",
89
+ buildEnvironmentVariables: pipeline.buildEnvironmentVariables,
90
+ ecsServiceName: serviceName,
91
+ ecsClusterName: clusterName,
92
+ containerName: pipeline.containerName,
93
+ badgeEnabled: pipeline.badgeEnabled,
94
+ s3BucketForceDestroy: pipeline.s3BucketForceDestroy,
95
+ githubWebhookEvents: pipeline.githubWebhookEvents,
96
+ pollSourceChanges: pipeline.pollSourceChanges,
97
+ webhookEnabled: pipeline.webhookEnabled,
98
+ deployCodePipelineInVpc: pipeline.deployCodePipelineInVpc,
99
+ tags: pipeline.tags
100
+ },
101
+ inputs: config.inputs || {},
102
+ };
103
+ const ecsPipeline = await ecsPipelineFactory.createResource(ecsConfig);
104
+ const resources = {
105
+ pipeline: ecsPipeline,
106
+ };
107
+ if (config.configuration.notifications?.enabled) {
108
+ if (config.configuration.notifications.useNotificationRules) {
109
+ const notificationRulesFactory = new codePipelineNotificationRulesFactory_1.CodePipelineNotificationRulesFactory();
110
+ const notificationRulesConfig = {
111
+ id: `${config.id}-notification-rules`,
112
+ configuration: {
113
+ pipelineArn: ecsPipeline.arn,
114
+ snsTopicArn: config.configuration.notifications.snsTopicArn,
115
+ eventTypeIds: config.configuration.notifications.notificationEventTypes || [
116
+ "codepipeline-pipeline-pipeline-execution-started",
117
+ "codepipeline-pipeline-pipeline-execution-succeeded",
118
+ "codepipeline-pipeline-pipeline-execution-failed",
119
+ "codepipeline-pipeline-manual-approval-needed"
120
+ ],
121
+ detailType: config.configuration.notifications.notificationDetailType || "FULL",
122
+ name: `${config.id}-pipeline-notifications`,
123
+ tags: config.tags
124
+ }
125
+ };
126
+ const notificationRulesResources = await notificationRulesFactory.createResource(notificationRulesConfig);
127
+ resources.notificationRules = notificationRulesResources;
128
+ }
129
+ else {
130
+ const notificationFactory = new codePipelineNotificationFactory_1.CodePipelineNotificationFactory();
131
+ const notificationConfig = {
132
+ id: `${config.id}-notifications`,
133
+ configuration: {
134
+ pipelineName: ecsPipeline.name,
135
+ snsTopicArn: config.configuration.notifications.snsTopicArn,
136
+ eventTypes: (config.configuration.notifications.eventTypes || [
137
+ "PIPELINE_EXECUTION_STARTED",
138
+ "PIPELINE_EXECUTION_SUCCEEDED",
139
+ "PIPELINE_EXECUTION_FAILED",
140
+ "STAGE_EXECUTION_FAILED"
141
+ ]),
142
+ detailType: config.configuration.notifications.detailType || "Full",
143
+ },
144
+ };
145
+ const notificationResources = await notificationFactory.createResource(notificationConfig);
146
+ resources.notifications = notificationResources;
147
+ }
148
+ }
149
+ if (config.configuration.cloudwatchLogsDataProtection?.enabled) {
150
+ const buildProjectName = `${config.meta.environment}-${config.id}-build`;
151
+ const logGroupName = `/aws/codebuild/${buildProjectName}`;
152
+ const dataProtectionPolicy = this.buildDataProtectionPolicy(config.configuration.cloudwatchLogsDataProtection, logGroupName);
153
+ if (dataProtectionPolicy) {
154
+ new aws.cloudwatch.LogDataProtectionPolicy(`${config.meta.environment}-${config.id}-build-data-protection`, {
155
+ logGroupName: logGroupName,
156
+ policyDocument: JSON.stringify(dataProtectionPolicy),
157
+ }, {
158
+ dependsOn: [ecsPipeline]
159
+ });
160
+ }
161
+ else {
162
+ }
163
+ }
164
+ else {
165
+ }
166
+ return resources;
167
+ }
168
+ getOutputs(resources) {
169
+ const ecsFactory = new ecsCodePipelineFactory_1.ECSCodePipelineFactory();
170
+ const ecsOutputs = ecsFactory.getOutputs(resources.pipeline);
171
+ const outputs = {
172
+ arn: ecsOutputs.arn,
173
+ name: ecsOutputs.name,
174
+ url: ecsOutputs.url,
175
+ codebuildProjectName: ecsOutputs.name,
176
+ };
177
+ if (resources.notifications) {
178
+ outputs.notificationEventRuleArn = resources.notifications.eventRule.arn;
179
+ outputs.notificationEventRuleName = resources.notifications.eventRule.name;
180
+ }
181
+ if (resources.notificationRules) {
182
+ const notificationRulesFactory = new codePipelineNotificationRulesFactory_1.CodePipelineNotificationRulesFactory();
183
+ const notificationRulesOutputs = notificationRulesFactory.getOutputs(resources.notificationRules);
184
+ outputs.notificationRuleArn = notificationRulesOutputs.notificationRuleArn;
185
+ }
186
+ return outputs;
187
+ }
188
+ }
189
+ exports.EnhancedEcsCodePipelineFactory = EnhancedEcsCodePipelineFactory;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.EventBridgeBusFactory = void 0;
37
+ const aws = __importStar(require("@pulumi/aws"));
38
+ const resourceFactory_1 = require("./resourceFactory");
39
+ class EventBridgeBusFactory extends resourceFactory_1.ResourceFactory {
40
+ async createResource(config) {
41
+ if (config.hooks?.beforeCreateResources)
42
+ await config.hooks.beforeCreateResources(config);
43
+ const resources = {};
44
+ if (config.configuration.buses) {
45
+ resources.buses = config.configuration.buses.map(bus => new aws.cloudwatch.EventBus(bus.name, {
46
+ name: bus.name,
47
+ tags: bus.tags,
48
+ }));
49
+ }
50
+ if (config.configuration.rules) {
51
+ resources.rules = config.configuration.rules.map(rule => new aws.cloudwatch.EventRule(rule.name, {
52
+ name: rule.name,
53
+ eventBusName: rule.eventBusName,
54
+ eventPattern: rule.eventPattern,
55
+ scheduleExpression: rule.scheduleExpression,
56
+ description: rule.description,
57
+ isEnabled: rule.isEnabled,
58
+ tags: rule.tags,
59
+ }));
60
+ }
61
+ if (config.configuration.targets) {
62
+ resources.targets = config.configuration.targets.map(target => new aws.cloudwatch.EventTarget(target.id, {
63
+ rule: target.ruleName,
64
+ eventBusName: target.eventBusName,
65
+ arn: target.arn,
66
+ input: target.input,
67
+ inputPath: target.inputPath,
68
+ inputTransformer: target.inputTransformer,
69
+ roleArn: target.roleArn,
70
+ }));
71
+ }
72
+ if (config.hooks?.afterCreateResources)
73
+ await config.hooks.afterCreateResources(resources, config);
74
+ return resources;
75
+ }
76
+ getOutputs(resource) {
77
+ return resource;
78
+ }
79
+ validateConfig(config) {
80
+ if (!config.id)
81
+ throw new Error("EventBridgeBusFactoryConfig must include id");
82
+ }
83
+ }
84
+ exports.EventBridgeBusFactory = EventBridgeBusFactory;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventBridgeFactory = void 0;
4
+ const resourceFactory_1 = require("./resourceFactory");
5
+ const validateEventBridgeConfig_1 = require("./validateEventBridgeConfig");
6
+ const createAwsEventBridgeEventBus_1 = require("./createAwsEventBridgeEventBus");
7
+ class EventBridgeFactory extends resourceFactory_1.ResourceFactory {
8
+ async createResource(config, provider) {
9
+ (0, validateEventBridgeConfig_1.validateEventBridgeConfig)(config);
10
+ return (0, createAwsEventBridgeEventBus_1.createAwsEventBridgeEventBus)(config.configuration.name, {
11
+ name: config.configuration.name,
12
+ tags: config.configuration.tags,
13
+ policy: config.configuration.policy ? JSON.stringify(config.configuration.policy) : undefined,
14
+ }, provider);
15
+ }
16
+ getOutputs(resource) {
17
+ return {
18
+ arn: resource.arn,
19
+ name: resource.name,
20
+ };
21
+ }
22
+ validateConfig(config) {
23
+ (0, validateEventBridgeConfig_1.validateEventBridgeConfig)(config);
24
+ }
25
+ }
26
+ exports.EventBridgeFactory = EventBridgeFactory;
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.EventBridgeRuleFactory = void 0;
37
+ const aws = __importStar(require("@pulumi/aws"));
38
+ const resourceFactory_1 = require("./resourceFactory");
39
+ class EventBridgeRuleFactory extends resourceFactory_1.ResourceFactory {
40
+ async createResource(config, provider) {
41
+ const ruleArgs = {
42
+ name: config.configuration.name,
43
+ description: config.configuration.description,
44
+ eventBusName: config.configuration.eventBusName,
45
+ state: config.configuration.state || "ENABLED",
46
+ roleArn: config.configuration.roleArn,
47
+ tags: config.configuration.tags,
48
+ };
49
+ if (config.configuration.eventPattern) {
50
+ ruleArgs.eventPattern = config.configuration.eventPattern;
51
+ }
52
+ else if (config.configuration.scheduleExpression) {
53
+ ruleArgs.scheduleExpression = config.configuration.scheduleExpression;
54
+ }
55
+ else {
56
+ throw new Error("EventBridge Rule must have either eventPattern or scheduleExpression");
57
+ }
58
+ const rule = new aws.cloudwatch.EventRule(config.id, ruleArgs, { provider });
59
+ if (config.configuration.targets && config.configuration.targets.length > 0) {
60
+ config.configuration.targets.forEach((target, index) => {
61
+ const targetArgs = {
62
+ rule: rule.name,
63
+ arn: target.arn,
64
+ targetId: target.id,
65
+ eventBusName: config.configuration.eventBusName,
66
+ };
67
+ if (target.input)
68
+ targetArgs.input = target.input;
69
+ if (target.inputPath)
70
+ targetArgs.inputPath = target.inputPath;
71
+ if (target.roleArn)
72
+ targetArgs.roleArn = target.roleArn;
73
+ if (target.runCommandParameters)
74
+ targetArgs.runCommandTargets = target.runCommandParameters;
75
+ if (target.ecsParameters)
76
+ targetArgs.ecsTarget = target.ecsParameters;
77
+ if (target.batchParameters)
78
+ targetArgs.batchTarget = target.batchParameters;
79
+ if (target.sqsParameters)
80
+ targetArgs.sqsTarget = target.sqsParameters;
81
+ if (target.httpParameters)
82
+ targetArgs.httpTarget = target.httpParameters;
83
+ if (target.redshiftDataParameters)
84
+ targetArgs.redshiftTarget = target.redshiftDataParameters;
85
+ if (target.sageMakerPipelineParameters)
86
+ targetArgs.sagemakerPipelineTarget = target.sageMakerPipelineParameters;
87
+ if (target.deadLetterConfig)
88
+ targetArgs.deadLetterConfig = target.deadLetterConfig;
89
+ if (target.retryPolicy)
90
+ targetArgs.retryPolicy = target.retryPolicy;
91
+ new aws.cloudwatch.EventTarget(`${config.id}-target-${index}`, targetArgs, { provider });
92
+ });
93
+ }
94
+ return rule;
95
+ }
96
+ getOutputs(resource) {
97
+ return {
98
+ arn: resource.arn,
99
+ name: resource.name,
100
+ };
101
+ }
102
+ validateConfig(config) {
103
+ if (!config.configuration || !config.configuration.name) {
104
+ throw new Error("EventBridge Rule configuration must include a name");
105
+ }
106
+ if (!config.configuration.eventPattern && !config.configuration.scheduleExpression) {
107
+ throw new Error("EventBridge Rule must have either eventPattern or scheduleExpression");
108
+ }
109
+ if (config.configuration.eventPattern && config.configuration.scheduleExpression) {
110
+ throw new Error("EventBridge Rule cannot have both eventPattern and scheduleExpression");
111
+ }
112
+ }
113
+ }
114
+ exports.EventBridgeRuleFactory = EventBridgeRuleFactory;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.fetchAllSecrets = fetchAllSecrets;
37
+ const aws = __importStar(require("@pulumi/aws"));
38
+ async function fetchAllSecrets(secretsById) {
39
+ const allSecrets = {};
40
+ for (const secretId of Object.keys(secretsById)) {
41
+ const secret = await aws.secretsmanager.getSecretVersion({ secretId });
42
+ const secretString = secret.secretString ? JSON.parse(secret.secretString) : {};
43
+ allSecrets[secretId] = {};
44
+ for (const key of secretsById[secretId]) {
45
+ if (secretString[key] !== undefined) {
46
+ allSecrets[secretId][key] = secretString[key];
47
+ }
48
+ }
49
+ }
50
+ return allSecrets;
51
+ }