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,109 @@
|
|
|
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.OpenSearchCollectionFactory = void 0;
|
|
37
|
+
const aws = __importStar(require("@pulumi/aws"));
|
|
38
|
+
const pulumi = __importStar(require("@pulumi/pulumi"));
|
|
39
|
+
const resourceFactory_1 = require("./resourceFactory");
|
|
40
|
+
class OpenSearchCollectionFactory extends resourceFactory_1.ResourceFactory {
|
|
41
|
+
async createResource(config, provider) {
|
|
42
|
+
const resourceName = `${config.meta.environment}-${config.id}`;
|
|
43
|
+
const collectionName = config.configuration.name;
|
|
44
|
+
let encryptionPolicy;
|
|
45
|
+
if (config.configuration.encryptionPolicy) {
|
|
46
|
+
encryptionPolicy = new aws.opensearch.ServerlessSecurityPolicy(`${resourceName}-encryption-policy`, {
|
|
47
|
+
name: config.configuration.encryptionPolicy.name,
|
|
48
|
+
type: config.configuration.encryptionPolicy.type,
|
|
49
|
+
description: config.configuration.encryptionPolicy.description,
|
|
50
|
+
policy: pulumi.output(config.configuration.encryptionPolicy.policy).apply(p => JSON.stringify(p)),
|
|
51
|
+
}, { provider });
|
|
52
|
+
}
|
|
53
|
+
let networkPolicy;
|
|
54
|
+
if (config.configuration.networkPolicy) {
|
|
55
|
+
networkPolicy = new aws.opensearch.ServerlessSecurityPolicy(`${resourceName}-network-policy`, {
|
|
56
|
+
name: config.configuration.networkPolicy.name,
|
|
57
|
+
type: config.configuration.networkPolicy.type,
|
|
58
|
+
description: config.configuration.networkPolicy.description,
|
|
59
|
+
policy: pulumi.output(config.configuration.networkPolicy.policy).apply(p => JSON.stringify(p)),
|
|
60
|
+
}, { provider, dependsOn: encryptionPolicy ? [encryptionPolicy] : [] });
|
|
61
|
+
}
|
|
62
|
+
const collection = new aws.opensearch.ServerlessCollection(resourceName, {
|
|
63
|
+
name: collectionName,
|
|
64
|
+
description: config.configuration.description,
|
|
65
|
+
type: config.configuration.type || "VECTORSEARCH",
|
|
66
|
+
standbyReplicas: config.configuration.standbyReplicas || "ENABLED",
|
|
67
|
+
tags: {
|
|
68
|
+
...config.configuration.tags,
|
|
69
|
+
Name: collectionName,
|
|
70
|
+
Environment: config.meta.environment,
|
|
71
|
+
},
|
|
72
|
+
}, {
|
|
73
|
+
provider,
|
|
74
|
+
dependsOn: [
|
|
75
|
+
...(encryptionPolicy ? [encryptionPolicy] : []),
|
|
76
|
+
...(networkPolicy ? [networkPolicy] : []),
|
|
77
|
+
],
|
|
78
|
+
});
|
|
79
|
+
if (config.configuration.accessPolicy) {
|
|
80
|
+
new aws.opensearch.ServerlessAccessPolicy(`${resourceName}-access-policy`, {
|
|
81
|
+
name: config.configuration.accessPolicy.name,
|
|
82
|
+
type: config.configuration.accessPolicy.type,
|
|
83
|
+
description: config.configuration.accessPolicy.description,
|
|
84
|
+
policy: pulumi.output(config.configuration.accessPolicy.policy).apply(p => JSON.stringify(p)),
|
|
85
|
+
}, { provider, dependsOn: [collection] });
|
|
86
|
+
}
|
|
87
|
+
return collection;
|
|
88
|
+
}
|
|
89
|
+
generateOutputs(resource) {
|
|
90
|
+
return {
|
|
91
|
+
arn: resource.arn,
|
|
92
|
+
id: resource.id,
|
|
93
|
+
collectionEndpoint: resource.collectionEndpoint,
|
|
94
|
+
dashboardEndpoint: resource.dashboardEndpoint,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
validateConfig(config) {
|
|
98
|
+
if (!config.id) {
|
|
99
|
+
throw new Error("OpenSearch Collection configuration must have an 'id' field");
|
|
100
|
+
}
|
|
101
|
+
if (!config.configuration?.name) {
|
|
102
|
+
throw new Error("OpenSearch Collection configuration must have a 'name' field");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
getOutputs(resource) {
|
|
106
|
+
return this.generateOutputs(resource);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.OpenSearchCollectionFactory = OpenSearchCollectionFactory;
|
|
@@ -0,0 +1,221 @@
|
|
|
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.OrganizationFactory = void 0;
|
|
37
|
+
const aws = __importStar(require("@pulumi/aws"));
|
|
38
|
+
const pulumi = __importStar(require("@pulumi/pulumi"));
|
|
39
|
+
const resourceFactory_1 = require("./resourceFactory");
|
|
40
|
+
const accountPermissions_1 = require("./accountPermissions");
|
|
41
|
+
const backupPolicy_1 = require("./backupPolicy");
|
|
42
|
+
const tagPolicies_1 = require("./tagPolicies");
|
|
43
|
+
class OrganizationFactory extends resourceFactory_1.ResourceFactory {
|
|
44
|
+
organization;
|
|
45
|
+
orgUnits = {};
|
|
46
|
+
accounts = {};
|
|
47
|
+
iamGroups = {};
|
|
48
|
+
iamGroupPolicies = {};
|
|
49
|
+
iamUsers = {};
|
|
50
|
+
iamUserPolicies = {};
|
|
51
|
+
providers = {};
|
|
52
|
+
accountPermissions = {};
|
|
53
|
+
tagPolicies = {};
|
|
54
|
+
backupPolicies = {};
|
|
55
|
+
validateConfig(config) {
|
|
56
|
+
if (!config || typeof config !== "object")
|
|
57
|
+
throw new Error("Config must be an object");
|
|
58
|
+
const cfg = config.configuration ? config.configuration : config;
|
|
59
|
+
if (!cfg || typeof cfg !== "object")
|
|
60
|
+
throw new Error("Config.configuration must be an object");
|
|
61
|
+
if (!cfg.name || typeof cfg.name !== "string")
|
|
62
|
+
throw new Error("Config.name is required");
|
|
63
|
+
if (cfg.featureSet && cfg.featureSet !== "ALL" && cfg.featureSet !== "CONSOLIDATED_BILLING")
|
|
64
|
+
throw new Error("featureSet must be 'ALL' or 'CONSOLIDATED_BILLING'");
|
|
65
|
+
if (cfg.orgUnits && !Array.isArray(cfg.orgUnits))
|
|
66
|
+
throw new Error("orgUnits must be an array");
|
|
67
|
+
}
|
|
68
|
+
createResource(config) {
|
|
69
|
+
this.validateConfig(config);
|
|
70
|
+
const cfg = config.configuration ? config.configuration : config;
|
|
71
|
+
this.organization = this.createOrganization(cfg);
|
|
72
|
+
this.createStructure(cfg);
|
|
73
|
+
this.createIamGroups(cfg);
|
|
74
|
+
this.createIamUsers(cfg);
|
|
75
|
+
this.createProviders(cfg);
|
|
76
|
+
this.createAccountPermissions(cfg);
|
|
77
|
+
this.createTagPolicies(cfg);
|
|
78
|
+
this.createBackupPolicies(cfg);
|
|
79
|
+
return this.organization;
|
|
80
|
+
}
|
|
81
|
+
getOutputs(resource) {
|
|
82
|
+
return {
|
|
83
|
+
arn: resource.arn,
|
|
84
|
+
masterAccountArn: resource.masterAccountArn,
|
|
85
|
+
organization: resource,
|
|
86
|
+
orgUnits: this.orgUnits,
|
|
87
|
+
accounts: Object.values(this.accounts).map(acc => ({ id: acc.id, name: acc.name })),
|
|
88
|
+
iamGroups: this.iamGroups,
|
|
89
|
+
iamGroupPolicies: this.iamGroupPolicies,
|
|
90
|
+
iamUsers: this.iamUsers,
|
|
91
|
+
iamUserPolicies: this.iamUserPolicies,
|
|
92
|
+
providers: this.providers,
|
|
93
|
+
accountPermissions: this.accountPermissions,
|
|
94
|
+
tagPolicies: this.tagPolicies,
|
|
95
|
+
backupPolicies: this.backupPolicies,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
createOrganization(cfg) {
|
|
99
|
+
return new aws.organizations.Organization(cfg.name, {
|
|
100
|
+
featureSet: cfg.featureSet || "ALL",
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
createStructure(cfg) {
|
|
104
|
+
if (cfg.orgUnits) {
|
|
105
|
+
for (const ouConfig of cfg.orgUnits) {
|
|
106
|
+
const ou = new aws.organizations.OrganizationalUnit(ouConfig.name, {
|
|
107
|
+
parentId: this.organization.roots.apply(rs => rs[0].id),
|
|
108
|
+
name: ouConfig.name,
|
|
109
|
+
});
|
|
110
|
+
this.orgUnits[ouConfig.name] = ou;
|
|
111
|
+
if (ouConfig.accounts) {
|
|
112
|
+
for (const accConfig of ouConfig.accounts) {
|
|
113
|
+
const acc = new aws.organizations.Account(accConfig.name, {
|
|
114
|
+
name: accConfig.name,
|
|
115
|
+
parentId: ou.id,
|
|
116
|
+
email: accConfig.email,
|
|
117
|
+
roleName: accConfig.roleName || "OrganizationalAccountAccessRole",
|
|
118
|
+
closeOnDeletion: accConfig.closeOnDeletion ?? true,
|
|
119
|
+
}, accConfig.protect ? { protect: true } : undefined);
|
|
120
|
+
this.accounts[accConfig.name] = acc;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
createIamGroups(cfg) {
|
|
127
|
+
if (cfg.iamGroups) {
|
|
128
|
+
for (const group of cfg.iamGroups) {
|
|
129
|
+
const g = new aws.iam.Group(group.name, { name: group.name });
|
|
130
|
+
this.iamGroups[group.name] = g;
|
|
131
|
+
if (group.policyStatements) {
|
|
132
|
+
const policy = new aws.iam.GroupPolicy(`${group.name}Policy`, {
|
|
133
|
+
group: g.name,
|
|
134
|
+
policy: JSON.stringify({
|
|
135
|
+
Version: "2012-10-17",
|
|
136
|
+
Statement: group.policyStatements,
|
|
137
|
+
}),
|
|
138
|
+
});
|
|
139
|
+
this.iamGroupPolicies[group.name] = policy;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
createIamUsers(cfg) {
|
|
145
|
+
if (cfg.iamUsers) {
|
|
146
|
+
for (const user of cfg.iamUsers) {
|
|
147
|
+
const u = new aws.iam.User(user.name, { name: user.name });
|
|
148
|
+
this.iamUsers[user.name] = u;
|
|
149
|
+
if (user.policyStatements) {
|
|
150
|
+
const policy = new aws.iam.UserPolicy(`${user.name}Policy`, {
|
|
151
|
+
user: u.name,
|
|
152
|
+
policy: JSON.stringify({
|
|
153
|
+
Version: "2012-10-17",
|
|
154
|
+
Statement: user.policyStatements,
|
|
155
|
+
}),
|
|
156
|
+
});
|
|
157
|
+
this.iamUserPolicies[user.name] = policy;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
createProviders(cfg) {
|
|
163
|
+
if (cfg.providers) {
|
|
164
|
+
for (const providerConfig of cfg.providers) {
|
|
165
|
+
const accountId = providerConfig.accountId;
|
|
166
|
+
const roleName = providerConfig.roleName;
|
|
167
|
+
this.providers[providerConfig.name] = new aws.Provider(providerConfig.name, {
|
|
168
|
+
allowedAccountIds: [accountId],
|
|
169
|
+
assumeRole: {
|
|
170
|
+
roleArn: pulumi.interpolate `arn:aws:iam::${accountId}:role/${roleName}`,
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
createAccountPermissions(cfg) {
|
|
177
|
+
if (cfg.accountPermissions) {
|
|
178
|
+
for (const perm of cfg.accountPermissions) {
|
|
179
|
+
const automationUser = this.iamUsers[perm.automationUserName];
|
|
180
|
+
const provider = this.providers[perm.providerName];
|
|
181
|
+
const managementAccountId = pulumi.output(perm.managementAccountId);
|
|
182
|
+
this.accountPermissions[perm.name] = new accountPermissions_1.AccountPermissions(perm.name, {
|
|
183
|
+
automationUser,
|
|
184
|
+
managementAccountId,
|
|
185
|
+
resourceNamesPrefix: perm.resourceNamesPrefix,
|
|
186
|
+
}, { provider });
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
createTagPolicies(cfg) {
|
|
191
|
+
if (cfg.tagPolicies) {
|
|
192
|
+
for (const tagPolicy of cfg.tagPolicies) {
|
|
193
|
+
const orgId = this.organization.id;
|
|
194
|
+
const costCenters = tagPolicy.costCenters.map(cc => ({
|
|
195
|
+
allowedCostCenters: cc.allowedCostCenters,
|
|
196
|
+
ou: this.orgUnits[cc.ouName],
|
|
197
|
+
}));
|
|
198
|
+
this.tagPolicies[tagPolicy.name] = new tagPolicies_1.TagPolicies(tagPolicy.name, {
|
|
199
|
+
orgId,
|
|
200
|
+
costCenters,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
createBackupPolicies(cfg) {
|
|
206
|
+
if (cfg.backupPolicies) {
|
|
207
|
+
for (const backup of cfg.backupPolicies) {
|
|
208
|
+
const backupRegion = backup.backupRegion;
|
|
209
|
+
const primaryRegions = backup.primaryRegions.map(r => r);
|
|
210
|
+
this.backupPolicies[backup.name] = new backupPolicy_1.BackupPolicy(backup.name, {
|
|
211
|
+
assumeRoleName: backup.assumeRoleName,
|
|
212
|
+
accounts: Object.fromEntries(backup.accountNames.map(name => [name, this.accounts[name]])),
|
|
213
|
+
backupRegion,
|
|
214
|
+
primaryRegions,
|
|
215
|
+
orgUnitId: this.orgUnits[backup.orgUnitName].id,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.OrganizationFactory = OrganizationFactory;
|
|
@@ -0,0 +1,43 @@
|
|
|
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.processSavingsPlans = processSavingsPlans;
|
|
37
|
+
const pulumi = __importStar(require("@pulumi/pulumi"));
|
|
38
|
+
function processSavingsPlans(savingsPlans = []) {
|
|
39
|
+
if (!savingsPlans)
|
|
40
|
+
return [];
|
|
41
|
+
pulumi.log.warn("Pulumi AWS provider does not support creating SavingsPlan resources directly. No resources will be created.");
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RdsFactory = void 0;
|
|
4
|
+
const resourceFactory_1 = require("./resourceFactory");
|
|
5
|
+
const validateRdsConfig_1 = require("./validateRdsConfig");
|
|
6
|
+
const createAwsRdsSubnetGroup_1 = require("./createAwsRdsSubnetGroup");
|
|
7
|
+
const createAwsRdsInstance_1 = require("./createAwsRdsInstance");
|
|
8
|
+
class RdsFactory extends resourceFactory_1.ResourceFactory {
|
|
9
|
+
async createResource(config, provider) {
|
|
10
|
+
(0, validateRdsConfig_1.validateRdsConfig)(config);
|
|
11
|
+
const opts = provider ? { provider } : undefined;
|
|
12
|
+
const subnetGroup = (0, createAwsRdsSubnetGroup_1.createAwsRdsSubnetGroup)(`${config.meta.environment}-${config.id}-subnet-group`, {
|
|
13
|
+
subnetIds: config.inputs.subnetIds || [],
|
|
14
|
+
description: `Subnet group for ${config.meta.environment}-${config.id}`,
|
|
15
|
+
}, opts);
|
|
16
|
+
const instance = (0, createAwsRdsInstance_1.createAwsRdsInstance)(`${config.meta.environment}-${config.id}`, {
|
|
17
|
+
...config.configuration,
|
|
18
|
+
dbSubnetGroupName: config.configuration.dbSubnetGroupName || subnetGroup.name,
|
|
19
|
+
vpcSecurityGroupIds: config.configuration.vpcSecurityGroupIds || (config.inputs.sgId ? [config.inputs.sgId] : []),
|
|
20
|
+
skipFinalSnapshot: typeof config.configuration.skipFinalSnapshot === 'boolean' ? config.configuration.skipFinalSnapshot : false,
|
|
21
|
+
finalSnapshotIdentifier: config.configuration.finalSnapshotIdentifier,
|
|
22
|
+
tags: config.configuration.tags,
|
|
23
|
+
}, opts);
|
|
24
|
+
return { instance };
|
|
25
|
+
}
|
|
26
|
+
getOutputs(resource) {
|
|
27
|
+
return {
|
|
28
|
+
id: resource.instance.id,
|
|
29
|
+
endpoint: resource.instance.endpoint,
|
|
30
|
+
username: resource.instance.username,
|
|
31
|
+
arn: resource.instance.arn,
|
|
32
|
+
subnetGroupName: resource.instance.dbSubnetGroupName,
|
|
33
|
+
sgId: Array.isArray(resource.instance.vpcSecurityGroupIds) ? resource.instance.vpcSecurityGroupIds[0] : resource.instance.vpcSecurityGroupIds,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
validateConfig(config) {
|
|
37
|
+
(0, validateRdsConfig_1.validateRdsConfig)(config);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.RdsFactory = RdsFactory;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecordFactory = void 0;
|
|
4
|
+
const resourceFactory_1 = require("./resourceFactory");
|
|
5
|
+
const validateRoute53RecordConfig_1 = require("./validateRoute53RecordConfig");
|
|
6
|
+
const createAwsRoute53Record_1 = require("./createAwsRoute53Record");
|
|
7
|
+
class RecordFactory extends resourceFactory_1.ResourceFactory {
|
|
8
|
+
async createResource(config, provider) {
|
|
9
|
+
(0, validateRoute53RecordConfig_1.validateRoute53RecordConfig)(config);
|
|
10
|
+
return (0, createAwsRoute53Record_1.createAwsRoute53Record)(config.configuration.name, {
|
|
11
|
+
zoneId: config.configuration.zoneId,
|
|
12
|
+
name: config.configuration.name,
|
|
13
|
+
type: config.configuration.type,
|
|
14
|
+
ttl: config.configuration.ttl,
|
|
15
|
+
records: config.configuration.records,
|
|
16
|
+
aliases: config.configuration.alias ? [config.configuration.alias] : undefined,
|
|
17
|
+
setIdentifier: config.configuration.setIdentifier,
|
|
18
|
+
failover: config.configuration.failover,
|
|
19
|
+
healthCheckId: config.configuration.healthCheckId,
|
|
20
|
+
multivalueAnswer: config.configuration.multivalueAnswer,
|
|
21
|
+
geoLocation: config.configuration.geoLocation,
|
|
22
|
+
latencyRoutingRegion: config.configuration.latencyRoutingRegion,
|
|
23
|
+
cidrRoutingPolicy: config.configuration.cidrRoutingPolicy,
|
|
24
|
+
comment: config.configuration.comment,
|
|
25
|
+
}, provider);
|
|
26
|
+
}
|
|
27
|
+
getOutputs(resource) {
|
|
28
|
+
return {
|
|
29
|
+
fqdn: resource.fqdn,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
validateConfig(config) {
|
|
33
|
+
(0, validateRoute53RecordConfig_1.validateRoute53RecordConfig)(config);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.RecordFactory = RecordFactory;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveEnvSecrets = resolveEnvSecrets;
|
|
4
|
+
function resolveEnvSecrets(env, allSecrets) {
|
|
5
|
+
return env.map(envVar => {
|
|
6
|
+
if (typeof envVar.value === "string" && envVar.value.startsWith("${secret:")) {
|
|
7
|
+
const match = envVar.value.match(/^\$\{secret:([^:}]+):([^}]+)\}$/);
|
|
8
|
+
if (match && allSecrets[match[1]] && allSecrets[match[1]][match[2]]) {
|
|
9
|
+
return { name: envVar.name, value: allSecrets[match[1]][match[2]] };
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return envVar;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutputsOnlyFactory = exports.ResourceFactory = void 0;
|
|
4
|
+
class ResourceFactory {
|
|
5
|
+
}
|
|
6
|
+
exports.ResourceFactory = ResourceFactory;
|
|
7
|
+
class OutputsOnlyFactory {
|
|
8
|
+
getOutputs(outputs) {
|
|
9
|
+
return outputs;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.OutputsOnlyFactory = OutputsOnlyFactory;
|