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.
- package/dist/src/core/config.js +2 -0
- package/dist/src/core/configMerge.js +266 -0
- package/dist/src/core/configUtils.js +72 -0
- package/dist/src/core/dependencyResolver.js +17 -0
- package/dist/src/core/deployUtils.js +73 -0
- package/dist/src/core/dynamicResourceManager.js +709 -0
- package/dist/src/core/entrypoint.js +56 -0
- package/dist/src/core/generateFinalConfig.js +45 -0
- package/dist/src/core/index.js +24 -0
- package/dist/src/core/resourceMap.js +99 -0
- package/dist/src/factories/accountPermissions.js +134 -0
- package/dist/src/factories/acmFactory.js +30 -0
- package/dist/src/factories/albFactory.js +331 -0
- package/dist/src/factories/attachSecretAccessPolicy.js +56 -0
- package/dist/src/factories/auroraFactory.js +619 -0
- package/dist/src/factories/backupPolicy.js +152 -0
- package/dist/src/factories/bastionFactory.js +91 -0
- package/dist/src/factories/bedrockFactory.js +334 -0
- package/dist/src/factories/budgetFactory.js +64 -0
- package/dist/src/factories/buildAlbCloudWatchAlarmsHelper.js +79 -0
- package/dist/src/factories/buildAlbCloudWatchDashboardHelper.js +106 -0
- package/dist/src/factories/buildAlbListenerRulesHelper.js +45 -0
- package/dist/src/factories/buildAlbListenersHelper.js +64 -0
- package/dist/src/factories/buildAlbResourceHelper.js +54 -0
- package/dist/src/factories/buildAlbRoute53RecordHelper.js +49 -0
- package/dist/src/factories/buildAlbTargetGroupsHelper.js +47 -0
- package/dist/src/factories/buildAlbWafAssociationHelper.js +43 -0
- package/dist/src/factories/buildAndPushDockerImage.js +57 -0
- package/dist/src/factories/buildAwsCloudWatchAlarmsHelper.js +118 -0
- package/dist/src/factories/buildCloudFrontRoute53RecordHelper.js +49 -0
- package/dist/src/factories/buildEcsClusterArgs.js +32 -0
- package/dist/src/factories/buildEcsSecrets.js +48 -0
- package/dist/src/factories/buildForceRedeployEnv.js +8 -0
- package/dist/src/factories/buildResourceOptions.js +11 -0
- package/dist/src/factories/buildS3StaticHostingCicdHelper.js +142 -0
- package/dist/src/factories/buildS3StaticHostingCloudWatchDashboardHelper.js +122 -0
- package/dist/src/factories/cloudTrailFactory.js +22 -0
- package/dist/src/factories/cloudWatchCompositeAlarmFactory.js +91 -0
- package/dist/src/factories/cloudWatchInsightsQueryFactory.js +83 -0
- package/dist/src/factories/cloudWatchLogGroupFactory.js +84 -0
- package/dist/src/factories/cloudfrontCodePipelineFactory.js +357 -0
- package/dist/src/factories/cloudwatchAlarmsFactory.js +121 -0
- package/dist/src/factories/codePipelineNotificationFactory.js +193 -0
- package/dist/src/factories/codePipelineNotificationRulesFactory.js +117 -0
- package/dist/src/factories/codeStarConnectionFactory.js +56 -0
- package/dist/src/factories/collectSecretKeys.js +18 -0
- package/dist/src/factories/comprehensiveNotificationFactory.js +250 -0
- package/dist/src/factories/costAndUsageReportFactory.js +32 -0
- package/dist/src/factories/createAwsAcmCertificate.js +40 -0
- package/dist/src/factories/createAwsBudget.js +40 -0
- package/dist/src/factories/createAwsCloudTrail.js +59 -0
- package/dist/src/factories/createAwsCloudwatchDashboard.js +59 -0
- package/dist/src/factories/createAwsEc2Instance.js +40 -0
- package/dist/src/factories/createAwsEventBridgeEventBus.js +40 -0
- package/dist/src/factories/createAwsGuardDutyDetector.js +40 -0
- package/dist/src/factories/createAwsGuardDutyDetectorFeature.js +45 -0
- package/dist/src/factories/createAwsGuardDutyFilter.js +46 -0
- package/dist/src/factories/createAwsGuardDutyPublishingDestination.js +50 -0
- package/dist/src/factories/createAwsHostedZone.js +40 -0
- package/dist/src/factories/createAwsIamRole.js +49 -0
- package/dist/src/factories/createAwsIamRoleInlinePolicies.js +48 -0
- package/dist/src/factories/createAwsIdentitystoreGroup.js +44 -0
- package/dist/src/factories/createAwsIdentitystoreGroupMembership.js +56 -0
- package/dist/src/factories/createAwsIdentitystoreUser.js +47 -0
- package/dist/src/factories/createAwsInspectorAssessmentTarget.js +47 -0
- package/dist/src/factories/createAwsInspectorDelegatedAdminAccount.js +47 -0
- package/dist/src/factories/createAwsInspectorEnabler.js +49 -0
- package/dist/src/factories/createAwsInspectorOrganizationConfiguration.js +55 -0
- package/dist/src/factories/createAwsKmsAliases.js +47 -0
- package/dist/src/factories/createAwsKmsKey.js +51 -0
- package/dist/src/factories/createAwsMacieAccount.js +45 -0
- package/dist/src/factories/createAwsMacieClassificationJob.js +53 -0
- package/dist/src/factories/createAwsMacieMember.js +49 -0
- package/dist/src/factories/createAwsMacieOrganizationConfiguration.js +44 -0
- package/dist/src/factories/createAwsRdsCluster.js +40 -0
- package/dist/src/factories/createAwsRdsClusterInstance.js +40 -0
- package/dist/src/factories/createAwsRdsInstance.js +40 -0
- package/dist/src/factories/createAwsRdsSubnetGroup.js +40 -0
- package/dist/src/factories/createAwsRoute53Record.js +40 -0
- package/dist/src/factories/createAwsSecret.js +40 -0
- package/dist/src/factories/createAwsSecretRotation.js +40 -0
- package/dist/src/factories/createAwsSecretVersion.js +40 -0
- package/dist/src/factories/createAwsSecurityGroup.js +40 -0
- package/dist/src/factories/createAwsSecurityGroupRule.js +40 -0
- package/dist/src/factories/createAwsSecurityHubAccount.js +40 -0
- package/dist/src/factories/createAwsSecurityHubAutomationRule.js +48 -0
- package/dist/src/factories/createAwsSecurityHubStandardsControl.js +44 -0
- package/dist/src/factories/createAwsSecurityHubStandardsSubscription.js +42 -0
- package/dist/src/factories/createAwsSesDomainDkim.js +40 -0
- package/dist/src/factories/createAwsSesDomainIdentity.js +40 -0
- package/dist/src/factories/createAwsSesEmailIdentity.js +40 -0
- package/dist/src/factories/createAwsSnsSubscription.js +62 -0
- package/dist/src/factories/createAwsSnsTopic.js +41 -0
- package/dist/src/factories/createAwsSqsQueue.js +40 -0
- package/dist/src/factories/createAwsSsmParameters.js +66 -0
- package/dist/src/factories/createAwsSsoAccountAssignment.js +66 -0
- package/dist/src/factories/createAwsSsoPermissionSet.js +64 -0
- package/dist/src/factories/createAwsStepFunctionsStateMachine.js +40 -0
- package/dist/src/factories/createBudget.js +56 -0
- package/dist/src/factories/createBudgetWithSnsAlert.js +79 -0
- package/dist/src/factories/createCostAndUsageReport.js +40 -0
- package/dist/src/factories/createEcrRepo.js +69 -0
- package/dist/src/factories/createEcsRolesAndPolicies.js +84 -0
- package/dist/src/factories/createEcsService.js +71 -0
- package/dist/src/factories/createEnvSecret.js +60 -0
- package/dist/src/factories/createGithubCodeStarConnection.js +44 -0
- package/dist/src/factories/createIamUserWithAccessKey.js +44 -0
- package/dist/src/factories/createLambdaFunction.js +89 -0
- package/dist/src/factories/createLambdaPermission.js +57 -0
- package/dist/src/factories/createListenerRule.js +68 -0
- package/dist/src/factories/createLogGroup.js +44 -0
- package/dist/src/factories/createSlackChannelConfiguration.js +49 -0
- package/dist/src/factories/createTargetGroup.js +50 -0
- package/dist/src/factories/createTaskDefinition.js +49 -0
- package/dist/src/factories/createVpcEndpoint.js +49 -0
- package/dist/src/factories/dashboardFactory.js +94 -0
- package/dist/src/factories/dataProtectionPolicyBuilder.js +103 -0
- package/dist/src/factories/ec2Factory.js +67 -0
- package/dist/src/factories/ecsClusterFactory.js +90 -0
- package/dist/src/factories/ecsCodePipelineFactory.js +308 -0
- package/dist/src/factories/ecsServiceFactory.js +350 -0
- package/dist/src/factories/enhancedCloudFrontCodePipelineFactory.js +205 -0
- package/dist/src/factories/enhancedEcsCodePipelineFactory.js +189 -0
- package/dist/src/factories/eventBridgeBusFactory.js +84 -0
- package/dist/src/factories/eventBridgeFactory.js +26 -0
- package/dist/src/factories/eventBridgeRuleFactory.js +114 -0
- package/dist/src/factories/fetchAllSecrets.js +51 -0
- package/dist/src/factories/getDeterministicPriority.js +13 -0
- package/dist/src/factories/getOrCreateSshKeyPair.js +57 -0
- package/dist/src/factories/guardDutyFactory.js +151 -0
- package/dist/src/factories/hostedZoneFactory.js +30 -0
- package/dist/src/factories/iamRoleFactory.js +29 -0
- package/dist/src/factories/inspectorFactory.js +109 -0
- package/dist/src/factories/kmsKeyFactory.js +32 -0
- package/dist/src/factories/lambdaFactory.js +133 -0
- package/dist/src/factories/lambdaPermissionFactory.js +32 -0
- package/dist/src/factories/logDataProtectionPolicyFactory.js +81 -0
- package/dist/src/factories/macieFactory.js +85 -0
- package/dist/src/factories/networkingFactory.js +429 -0
- package/dist/src/factories/opensearchCollectionFactory.js +109 -0
- package/dist/src/factories/organizationFactory.js +221 -0
- package/dist/src/factories/processReservedInstances.js +6 -0
- package/dist/src/factories/processSavingsPlans.js +43 -0
- package/dist/src/factories/rdsFactory.js +40 -0
- package/dist/src/factories/recordFactory.js +36 -0
- package/dist/src/factories/resolveEnvSecrets.js +14 -0
- package/dist/src/factories/resourceFactory.js +12 -0
- package/dist/src/factories/s3Factory.js +262 -0
- package/dist/src/factories/s3StaticHostingFactory.backup.js +424 -0
- package/dist/src/factories/s3StaticHostingFactory.js +348 -0
- package/dist/src/factories/s3StaticHostingFactory.refactored.js +334 -0
- package/dist/src/factories/savingsPlanFactory.js +26 -0
- package/dist/src/factories/secretsManagerFactory.js +107 -0
- package/dist/src/factories/securityGroupFactory.js +28 -0
- package/dist/src/factories/securityGroupRuleFactory.js +43 -0
- package/dist/src/factories/securityHubFactory.js +96 -0
- package/dist/src/factories/sesDomainDkimFactory.js +25 -0
- package/dist/src/factories/sesFactory.js +25 -0
- package/dist/src/factories/sesIdentitiesFactory.js +134 -0
- package/dist/src/factories/simpleNotificationFactory.js +112 -0
- package/dist/src/factories/smtpUserFactory.js +108 -0
- package/dist/src/factories/snsFactory.js +87 -0
- package/dist/src/factories/sqsFactory.js +41 -0
- package/dist/src/factories/ssmParameterFactory.js +67 -0
- package/dist/src/factories/ssoFactory.js +32 -0
- package/dist/src/factories/ssoGroupFactory.js +41 -0
- package/dist/src/factories/ssoPermissionSetFactory.js +29 -0
- package/dist/src/factories/ssoUserFactory.js +30 -0
- package/dist/src/factories/stepFunctionsFactory.js +32 -0
- package/dist/src/factories/tagPolicies.js +99 -0
- package/dist/src/factories/transformBudgetCostFilters.js +8 -0
- package/dist/src/factories/transformBudgetNotifications.js +12 -0
- package/dist/src/factories/transformBudgetPlannedLimits.js +8 -0
- package/dist/src/factories/types.js +2 -0
- package/dist/src/factories/validateAcmConfig.js +26 -0
- package/dist/src/factories/validateAuroraConfig.js +8 -0
- package/dist/src/factories/validateBedrockConfig.js +124 -0
- package/dist/src/factories/validateDashboardConfig.js +28 -0
- package/dist/src/factories/validateEventBridgeConfig.js +14 -0
- package/dist/src/factories/validateHostedZoneConfig.js +26 -0
- package/dist/src/factories/validateIamRoleConfig.js +8 -0
- package/dist/src/factories/validateKmsKeyConfig.js +8 -0
- package/dist/src/factories/validateRdsConfig.js +17 -0
- package/dist/src/factories/validateRoute53RecordConfig.js +41 -0
- package/dist/src/factories/validateS3Config.js +8 -0
- package/dist/src/factories/validateSecretsManagerConfig.js +8 -0
- package/dist/src/factories/validateSecurityGroupConfig.js +8 -0
- package/dist/src/factories/validateSecurityGroupRuleConfig.js +8 -0
- package/dist/src/factories/validateSesDomainDkimConfig.js +8 -0
- package/dist/src/factories/validateSesDomainIdentityConfig.js +8 -0
- package/dist/src/factories/validateSesIdentitiesConfig.js +40 -0
- package/dist/src/factories/validateSnsConfig.js +11 -0
- package/dist/src/factories/validateSqsConfig.js +11 -0
- package/dist/src/factories/validateSsmParameterFactoryConfig.js +9 -0
- package/dist/src/factories/validateStepFunctionsConfig.js +8 -0
- package/dist/src/factories/vpcEndpointFactory.js +98 -0
- package/dist/src/factories/wafFactory.js +499 -0
- package/package.json +71 -0
- package/scripts/copy-assets.js +136 -0
|
@@ -0,0 +1,49 @@
|
|
|
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.createTaskDefinition = createTaskDefinition;
|
|
37
|
+
const aws = __importStar(require("@pulumi/aws"));
|
|
38
|
+
function createTaskDefinition(params, provider) {
|
|
39
|
+
return new aws.ecs.TaskDefinition(`${params.name}-task`, {
|
|
40
|
+
family: params.name,
|
|
41
|
+
cpu: params.cpu.toString(),
|
|
42
|
+
memory: params.memory.toString(),
|
|
43
|
+
networkMode: "awsvpc",
|
|
44
|
+
requiresCompatibilities: ["FARGATE"],
|
|
45
|
+
executionRoleArn: params.executionRoleArn,
|
|
46
|
+
taskRoleArn: params.taskRoleArn,
|
|
47
|
+
containerDefinitions: params.containerDefinitions,
|
|
48
|
+
}, Object.assign({}, params.dependsOn ? { dependsOn: params.dependsOn } : undefined, provider ? { provider } : undefined));
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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.createVpcEndpoint = createVpcEndpoint;
|
|
37
|
+
const aws = __importStar(require("@pulumi/aws"));
|
|
38
|
+
function createVpcEndpoint({ name, vpcId, serviceName, vpcEndpointType, subnetIds, routeTableIds, securityGroupIds, privateDnsEnabled, tags, provider, }) {
|
|
39
|
+
return new aws.ec2.VpcEndpoint(name, {
|
|
40
|
+
vpcId,
|
|
41
|
+
serviceName,
|
|
42
|
+
vpcEndpointType,
|
|
43
|
+
subnetIds,
|
|
44
|
+
routeTableIds,
|
|
45
|
+
securityGroupIds,
|
|
46
|
+
privateDnsEnabled,
|
|
47
|
+
tags,
|
|
48
|
+
}, provider ? { provider } : undefined);
|
|
49
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
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.DashboardFactory = void 0;
|
|
37
|
+
const pulumi = __importStar(require("@pulumi/pulumi"));
|
|
38
|
+
const resourceFactory_1 = require("./resourceFactory");
|
|
39
|
+
const validateDashboardConfig_1 = require("./validateDashboardConfig");
|
|
40
|
+
const createAwsCloudwatchDashboard_1 = require("./createAwsCloudwatchDashboard");
|
|
41
|
+
class DashboardFactory extends resourceFactory_1.ResourceFactory {
|
|
42
|
+
async createResource(config) {
|
|
43
|
+
function getProp(key) {
|
|
44
|
+
if (!config)
|
|
45
|
+
return undefined;
|
|
46
|
+
if (key in config)
|
|
47
|
+
return config[key];
|
|
48
|
+
if (config.configuration && key in config.configuration)
|
|
49
|
+
return config.configuration[key];
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const dashboardConfig = {
|
|
53
|
+
id: getProp("id"),
|
|
54
|
+
name: getProp("name"),
|
|
55
|
+
widgets: getProp("widgets"),
|
|
56
|
+
description: getProp("description"),
|
|
57
|
+
tags: getProp("tags"),
|
|
58
|
+
provider: getProp("provider"),
|
|
59
|
+
hooks: getProp("hooks"),
|
|
60
|
+
notes: getProp("notes")
|
|
61
|
+
};
|
|
62
|
+
(0, validateDashboardConfig_1.validateDashboardConfig)(dashboardConfig);
|
|
63
|
+
return await (0, createAwsCloudwatchDashboard_1.createAwsCloudwatchDashboard)(dashboardConfig);
|
|
64
|
+
}
|
|
65
|
+
getOutputs(resource) {
|
|
66
|
+
return {
|
|
67
|
+
id: resource.id,
|
|
68
|
+
url: pulumi.interpolate `https://console.aws.amazon.com/cloudwatch/home#dashboards:name=${resource.dashboardName}`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
validateConfig(config) {
|
|
72
|
+
function getProp(key) {
|
|
73
|
+
if (!config)
|
|
74
|
+
return undefined;
|
|
75
|
+
if (key in config)
|
|
76
|
+
return config[key];
|
|
77
|
+
if (config.configuration && key in config.configuration)
|
|
78
|
+
return config.configuration[key];
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
const dashboardConfig = {
|
|
82
|
+
id: getProp("id"),
|
|
83
|
+
name: getProp("name"),
|
|
84
|
+
widgets: getProp("widgets"),
|
|
85
|
+
description: getProp("description"),
|
|
86
|
+
tags: getProp("tags"),
|
|
87
|
+
provider: getProp("provider"),
|
|
88
|
+
hooks: getProp("hooks"),
|
|
89
|
+
notes: getProp("notes")
|
|
90
|
+
};
|
|
91
|
+
(0, validateDashboardConfig_1.validateDashboardConfig)(dashboardConfig);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.DashboardFactory = DashboardFactory;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_DATA_IDENTIFIERS = void 0;
|
|
4
|
+
exports.buildDataProtectionPolicy = buildDataProtectionPolicy;
|
|
5
|
+
function buildDataProtectionPolicy(config, logGroupName, defaultDataIdentifiers, contextPrefix = "Log Group") {
|
|
6
|
+
if (config.policy) {
|
|
7
|
+
return config.policy;
|
|
8
|
+
}
|
|
9
|
+
let needsAuditStatement = false;
|
|
10
|
+
let needsRedactionStatement = false;
|
|
11
|
+
if (config.operations) {
|
|
12
|
+
needsAuditStatement = config.operations.audit?.enabled === true;
|
|
13
|
+
needsRedactionStatement = config.operations.redaction?.enabled === true;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
needsAuditStatement = config.enableAudit === true;
|
|
17
|
+
needsRedactionStatement = config.enableRedaction === true;
|
|
18
|
+
}
|
|
19
|
+
const dataIdentifiers = config.dataIdentifiers || defaultDataIdentifiers;
|
|
20
|
+
const auditLogGroup = config.auditLogGroup || config.operations?.audit?.logGroup || "/aws/logs/audit/PROJECT-prod";
|
|
21
|
+
const statements = [];
|
|
22
|
+
if (needsAuditStatement) {
|
|
23
|
+
statements.push({
|
|
24
|
+
Sid: "DataProtectionAuditStatement",
|
|
25
|
+
DataIdentifier: dataIdentifiers,
|
|
26
|
+
Operation: {
|
|
27
|
+
Audit: {
|
|
28
|
+
FindingsDestination: {
|
|
29
|
+
CloudWatchLogs: {
|
|
30
|
+
LogGroup: auditLogGroup
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (needsRedactionStatement) {
|
|
38
|
+
statements.push({
|
|
39
|
+
Sid: "DataProtectionDeidentifyStatement",
|
|
40
|
+
DataIdentifier: dataIdentifiers,
|
|
41
|
+
Operation: {
|
|
42
|
+
Deidentify: {
|
|
43
|
+
MaskConfig: config.operations?.redaction?.maskConfig?.MaskConfig || {}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (statements.length === 0) {
|
|
49
|
+
throw new Error(`${contextPrefix}: Data Protection Policy for ${logGroupName} must have at least one operation`);
|
|
50
|
+
}
|
|
51
|
+
if (statements.length > 2) {
|
|
52
|
+
throw new Error(`${contextPrefix}: AWS CloudWatch LogDataProtectionPolicy can only have maximum 2 statements, got ${statements.length} for ${logGroupName}`);
|
|
53
|
+
}
|
|
54
|
+
const policy = {
|
|
55
|
+
Name: "DataProtectionPolicy",
|
|
56
|
+
Description: `Data protection policy for ${logGroupName}`,
|
|
57
|
+
Version: "2021-06-01",
|
|
58
|
+
Statement: statements
|
|
59
|
+
};
|
|
60
|
+
if (logGroupName.includes('compliance') || logGroupName.includes('audit')) {
|
|
61
|
+
}
|
|
62
|
+
return policy;
|
|
63
|
+
}
|
|
64
|
+
exports.DEFAULT_DATA_IDENTIFIERS = {
|
|
65
|
+
GENERAL: [
|
|
66
|
+
"arn:aws:dataprotection::aws:data-identifier/EmailAddress",
|
|
67
|
+
"arn:aws:dataprotection::aws:data-identifier/CreditCardNumber",
|
|
68
|
+
"arn:aws:dataprotection::aws:data-identifier/PhoneNumber-US"
|
|
69
|
+
],
|
|
70
|
+
VPC_FLOW_LOGS: [
|
|
71
|
+
"arn:aws:dataprotection::aws:data-identifier/IpAddress",
|
|
72
|
+
"arn:aws:dataprotection::aws:data-identifier/EmailAddress"
|
|
73
|
+
],
|
|
74
|
+
DATABASE_LOGS: [
|
|
75
|
+
"arn:aws:dataprotection::aws:data-identifier/EmailAddress",
|
|
76
|
+
"arn:aws:dataprotection::aws:data-identifier/CreditCardNumber",
|
|
77
|
+
"arn:aws:dataprotection::aws:data-identifier/PhoneNumber-US"
|
|
78
|
+
],
|
|
79
|
+
APPLICATION_LOGS: [
|
|
80
|
+
"arn:aws:dataprotection::aws:data-identifier/EmailAddress",
|
|
81
|
+
"arn:aws:dataprotection::aws:data-identifier/AwsSecretKey",
|
|
82
|
+
"arn:aws:dataprotection::aws:data-identifier/CreditCardNumber",
|
|
83
|
+
"arn:aws:dataprotection::aws:data-identifier/PhoneNumber-US"
|
|
84
|
+
],
|
|
85
|
+
ECS_LOGS: [
|
|
86
|
+
"arn:aws:dataprotection::aws:data-identifier/EmailAddress",
|
|
87
|
+
"arn:aws:dataprotection::aws:data-identifier/AwsSecretKey",
|
|
88
|
+
"arn:aws:dataprotection::aws:data-identifier/CreditCardNumber",
|
|
89
|
+
"arn:aws:dataprotection::aws:data-identifier/PhoneNumber-US",
|
|
90
|
+
"arn:aws:dataprotection::aws:data-identifier/IpAddress"
|
|
91
|
+
],
|
|
92
|
+
CODEPIPELINE_LOGS: [
|
|
93
|
+
"arn:aws:dataprotection::aws:data-identifier/EmailAddress",
|
|
94
|
+
"arn:aws:dataprotection::aws:data-identifier/AwsSecretKey",
|
|
95
|
+
"arn:aws:dataprotection::aws:data-identifier/IpAddress"
|
|
96
|
+
],
|
|
97
|
+
API_GATEWAY_LOGS: [
|
|
98
|
+
"arn:aws:dataprotection::aws:data-identifier/EmailAddress",
|
|
99
|
+
"arn:aws:dataprotection::aws:data-identifier/IpAddress",
|
|
100
|
+
"arn:aws:dataprotection::aws:data-identifier/CreditCardNumber",
|
|
101
|
+
"arn:aws:dataprotection::aws:data-identifier/PhoneNumber-US"
|
|
102
|
+
]
|
|
103
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Ec2Factory = void 0;
|
|
4
|
+
const resourceFactory_1 = require("./resourceFactory");
|
|
5
|
+
const createAwsEc2Instance_1 = require("./createAwsEc2Instance");
|
|
6
|
+
class Ec2Factory extends resourceFactory_1.ResourceFactory {
|
|
7
|
+
async createResource(config, provider) {
|
|
8
|
+
let vpcSecurityGroupIds = config.configuration.vpcSecurityGroupIds;
|
|
9
|
+
if (config.inputs) {
|
|
10
|
+
if (config.inputs.sgId) {
|
|
11
|
+
vpcSecurityGroupIds = [config.inputs.sgId];
|
|
12
|
+
}
|
|
13
|
+
else if (config.inputs.securityGroupIds) {
|
|
14
|
+
vpcSecurityGroupIds = config.inputs.securityGroupIds;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
let ebsBlockDevices = undefined;
|
|
18
|
+
if (config.configuration.blockDeviceMappings) {
|
|
19
|
+
ebsBlockDevices = config.configuration.blockDeviceMappings.map((bd) => ({
|
|
20
|
+
deviceName: bd.deviceName,
|
|
21
|
+
...bd.ebs,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
const args = {
|
|
25
|
+
ami: config.configuration.ami,
|
|
26
|
+
instanceType: config.configuration.instanceType,
|
|
27
|
+
subnetId: config.configuration.subnetId || config.inputs?.subnetId,
|
|
28
|
+
vpcSecurityGroupIds,
|
|
29
|
+
keyName: config.configuration.keyName,
|
|
30
|
+
iamInstanceProfile: config.configuration.iamInstanceProfile,
|
|
31
|
+
userData: config.configuration.userData,
|
|
32
|
+
ebsBlockDevices,
|
|
33
|
+
monitoring: config.configuration.monitoring,
|
|
34
|
+
ebsOptimized: config.configuration.ebsOptimized,
|
|
35
|
+
instanceInitiatedShutdownBehavior: config.configuration.instanceInitiatedShutdownBehavior,
|
|
36
|
+
associatePublicIpAddress: config.configuration.associatePublicIpAddress,
|
|
37
|
+
privateIp: config.configuration.privateIp,
|
|
38
|
+
creditSpecification: config.configuration.creditSpecification,
|
|
39
|
+
placementGroup: config.configuration.placementGroup,
|
|
40
|
+
tenancy: config.configuration.tenancy,
|
|
41
|
+
hibernation: config.configuration.hibernation,
|
|
42
|
+
enclaveOptions: config.configuration.enclaveOptions,
|
|
43
|
+
capacityReservationSpecification: config.configuration.capacityReservationSpecification,
|
|
44
|
+
launchTemplate: config.configuration.launchTemplate,
|
|
45
|
+
metadataOptions: config.configuration.metadataOptions,
|
|
46
|
+
cpuOptions: config.configuration.cpuOptions,
|
|
47
|
+
disableApiTermination: config.configuration.disableApiTermination,
|
|
48
|
+
sourceDestCheck: config.configuration.sourceDestCheck,
|
|
49
|
+
secondaryPrivateIps: config.configuration.secondaryPrivateIps,
|
|
50
|
+
ipv6Addresses: config.configuration.ipv6Addresses,
|
|
51
|
+
tags: config.configuration.tags,
|
|
52
|
+
};
|
|
53
|
+
return (0, createAwsEc2Instance_1.createAwsEc2Instance)(`${config.meta.environment}-${config.id}`, args, provider);
|
|
54
|
+
}
|
|
55
|
+
getOutputs(resource) {
|
|
56
|
+
return {
|
|
57
|
+
id: resource.id,
|
|
58
|
+
publicIp: resource.publicIp,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
validateConfig(config) {
|
|
62
|
+
if (!config.configuration || !config.configuration.ami || !config.configuration.instanceType) {
|
|
63
|
+
throw new Error("EC2 config must include configuration with ami and instanceType");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.Ec2Factory = Ec2Factory;
|
|
@@ -0,0 +1,90 @@
|
|
|
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.ClusterFactory = void 0;
|
|
37
|
+
const aws = __importStar(require("@pulumi/aws"));
|
|
38
|
+
const resourceFactory_1 = require("./resourceFactory");
|
|
39
|
+
const buildEcsClusterArgs_1 = require("./buildEcsClusterArgs");
|
|
40
|
+
const dataProtectionPolicyBuilder_1 = require("./dataProtectionPolicyBuilder");
|
|
41
|
+
class ClusterFactory extends resourceFactory_1.ResourceFactory {
|
|
42
|
+
buildDataProtectionPolicyDocument(config) {
|
|
43
|
+
if (!config?.enabled) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return (0, dataProtectionPolicyBuilder_1.buildDataProtectionPolicy)(config, "/ecs/cluster-logs", dataProtectionPolicyBuilder_1.DEFAULT_DATA_IDENTIFIERS.ECS_LOGS, "ECS Cluster");
|
|
47
|
+
}
|
|
48
|
+
buildDataProtectionPolicy(config, logGroup, meta) {
|
|
49
|
+
if (!config?.enabled) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const policyDocument = this.buildDataProtectionPolicyDocument(config);
|
|
53
|
+
if (!policyDocument) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
return new aws.cloudwatch.LogDataProtectionPolicy(`${meta.environment}-ecs-cluster-data-protection-policy`, {
|
|
57
|
+
logGroupName: logGroup.name,
|
|
58
|
+
policyDocument: JSON.stringify(policyDocument)
|
|
59
|
+
}, {
|
|
60
|
+
dependsOn: [logGroup]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
createResource(config, provider) {
|
|
64
|
+
const args = (0, buildEcsClusterArgs_1.buildEcsClusterArgs)(config.configuration, config.meta);
|
|
65
|
+
const cluster = new aws.ecs.Cluster(`${config.meta.environment}-${config.id}`, args, provider ? { provider } : undefined);
|
|
66
|
+
if (config.configuration.cloudwatchLogsDataProtection?.enabled) {
|
|
67
|
+
const logGroupName = `/ecs/${config.configuration.name}`;
|
|
68
|
+
const logGroup = new aws.cloudwatch.LogGroup(`${config.meta.environment}-${config.id}-log-group`, {
|
|
69
|
+
name: logGroupName,
|
|
70
|
+
retentionInDays: 365,
|
|
71
|
+
tags: config.configuration.tags
|
|
72
|
+
}, provider ? { provider } : undefined);
|
|
73
|
+
this.buildDataProtectionPolicy(config.configuration.cloudwatchLogsDataProtection, logGroup, config.meta);
|
|
74
|
+
}
|
|
75
|
+
return cluster;
|
|
76
|
+
}
|
|
77
|
+
getOutputs(resource) {
|
|
78
|
+
return {
|
|
79
|
+
id: resource.id,
|
|
80
|
+
name: resource.name,
|
|
81
|
+
arn: resource.arn,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
validateConfig(config) {
|
|
85
|
+
if (!config.configuration || !config.configuration.name) {
|
|
86
|
+
throw new Error("Cluster config must include configuration with name");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.ClusterFactory = ClusterFactory;
|