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,56 @@
|
|
|
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.terruvimDeploy = terruvimDeploy;
|
|
37
|
+
const generateFinalConfig_1 = require("./generateFinalConfig");
|
|
38
|
+
const configUtils_1 = require("./configUtils");
|
|
39
|
+
const deployUtils_1 = require("./deployUtils");
|
|
40
|
+
const pulumi = __importStar(require("@pulumi/pulumi"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
async function terruvimDeploy(configDir = process.cwd()) {
|
|
43
|
+
const stack = pulumi.getStack();
|
|
44
|
+
const env = stack.replace(/^.*-/, "");
|
|
45
|
+
const { baseConfig, overlayConfig } = (0, configUtils_1.loadInfraConfigs)(env, configDir);
|
|
46
|
+
const { nested: mergedConfig, flat: flatConfigWithCustomGroup } = (0, generateFinalConfig_1.generateFinalConfig)(baseConfig, overlayConfig, env);
|
|
47
|
+
const mergedConfigPath = path.join(configDir, "generated.merged.nested.json");
|
|
48
|
+
const flatMergedConfigPath = path.join(configDir, "generated.merged.flat.json");
|
|
49
|
+
(0, configUtils_1.saveGeneratedConfigs)(mergedConfig, flatConfigWithCustomGroup, mergedConfigPath, flatMergedConfigPath);
|
|
50
|
+
const outputs = await (0, deployUtils_1.deployFromConfig)(flatMergedConfigPath);
|
|
51
|
+
const globalModule = require.main;
|
|
52
|
+
if (globalModule) {
|
|
53
|
+
Object.assign(globalModule.exports, outputs);
|
|
54
|
+
}
|
|
55
|
+
return outputs;
|
|
56
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateFinalConfig = generateFinalConfig;
|
|
4
|
+
const configMerge_1 = require("./configMerge");
|
|
5
|
+
function generateFinalConfig(baseConfig, overlayConfig, env) {
|
|
6
|
+
const mergedConfig = (0, configMerge_1.deepMergeById)(baseConfig, overlayConfig);
|
|
7
|
+
const baseProviders = baseConfig.providers || {};
|
|
8
|
+
const overlayProviders = overlayConfig.providers || {};
|
|
9
|
+
mergedConfig.providers = (0, configMerge_1.deepMergeById)(baseProviders, overlayProviders);
|
|
10
|
+
const knownResourceTypes = (0, configMerge_1.getKnownResourceTypes)();
|
|
11
|
+
const groupedBase = (0, configMerge_1.flattenAndGroupResourcesByCategoryAndType)(baseConfig, knownResourceTypes);
|
|
12
|
+
const overlayByType = (0, configMerge_1.flattenOverlayResourcesByType)(overlayConfig, knownResourceTypes);
|
|
13
|
+
let flatConfigForDeployment = (0, configMerge_1.mergeOverlayIntoBaseByType)(groupedBase, overlayByType);
|
|
14
|
+
const baseMeta = baseConfig.meta || {};
|
|
15
|
+
const overlayMeta = overlayConfig.meta || {};
|
|
16
|
+
flatConfigForDeployment.meta = (0, configMerge_1.deepMergeById)(baseMeta, overlayMeta);
|
|
17
|
+
if (env) {
|
|
18
|
+
if (typeof flatConfigForDeployment.meta !== "object" || flatConfigForDeployment.meta === null || Array.isArray(flatConfigForDeployment.meta)) {
|
|
19
|
+
flatConfigForDeployment.meta = {};
|
|
20
|
+
}
|
|
21
|
+
flatConfigForDeployment.meta.environment = env;
|
|
22
|
+
}
|
|
23
|
+
const flatBaseProviders = baseConfig.providers || {};
|
|
24
|
+
const flatOverlayProviders = overlayConfig.providers || {};
|
|
25
|
+
flatConfigForDeployment.providers = (0, configMerge_1.deepMergeById)(flatBaseProviders, flatOverlayProviders);
|
|
26
|
+
const resourcesByFactory = {};
|
|
27
|
+
for (const category of Object.keys(flatConfigForDeployment)) {
|
|
28
|
+
if (category === "meta" || category === "providers")
|
|
29
|
+
continue;
|
|
30
|
+
for (const factory of Object.keys(flatConfigForDeployment[category])) {
|
|
31
|
+
if (!resourcesByFactory[factory])
|
|
32
|
+
resourcesByFactory[factory] = [];
|
|
33
|
+
resourcesByFactory[factory].push(...flatConfigForDeployment[category][factory]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const flatConfigWithCustomGroup = {
|
|
37
|
+
RESOURCES: resourcesByFactory,
|
|
38
|
+
meta: flatConfigForDeployment.meta,
|
|
39
|
+
providers: flatConfigForDeployment.providers,
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
nested: mergedConfig,
|
|
43
|
+
flat: flatConfigWithCustomGroup
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./configMerge"), exports);
|
|
18
|
+
__exportStar(require("./configUtils"), exports);
|
|
19
|
+
__exportStar(require("./generateFinalConfig"), exports);
|
|
20
|
+
__exportStar(require("./deployUtils"), exports);
|
|
21
|
+
__exportStar(require("./entrypoint"), exports);
|
|
22
|
+
__exportStar(require("./dependencyResolver"), exports);
|
|
23
|
+
__exportStar(require("./resourceMap"), exports);
|
|
24
|
+
__exportStar(require("./dynamicResourceManager"), exports);
|
|
@@ -0,0 +1,99 @@
|
|
|
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.resourceRegistry = void 0;
|
|
37
|
+
exports.registerResource = registerResource;
|
|
38
|
+
exports.getResourceOutput = getResourceOutput;
|
|
39
|
+
exports.resolveOutputsInObject = resolveOutputsInObject;
|
|
40
|
+
const pulumi = __importStar(require("@pulumi/pulumi"));
|
|
41
|
+
exports.resourceRegistry = {};
|
|
42
|
+
function registerResource(id, resource, outputs) {
|
|
43
|
+
if (!resource) {
|
|
44
|
+
console.warn(`[DEBUG] Resource ${id} is undefined and cannot be registered.`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
exports.resourceRegistry[id] = outputs.reduce((acc, output) => {
|
|
48
|
+
if (resource[output] !== undefined) {
|
|
49
|
+
acc[output] = resource[output];
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
}
|
|
53
|
+
return acc;
|
|
54
|
+
}, {});
|
|
55
|
+
}
|
|
56
|
+
function getResourceOutput(resourceId, outputKey) {
|
|
57
|
+
const resource = exports.resourceRegistry[resourceId];
|
|
58
|
+
if (!resource) {
|
|
59
|
+
throw new Error(`Resource ${resourceId} not found in the registry. Ensure it is registered before accessing outputs.`);
|
|
60
|
+
}
|
|
61
|
+
if (!resource[outputKey]) {
|
|
62
|
+
throw new Error(`Output ${outputKey} not found for resource ${resourceId}. Available outputs: ${Object.keys(resource).join(", ")}`);
|
|
63
|
+
}
|
|
64
|
+
return resource[outputKey];
|
|
65
|
+
}
|
|
66
|
+
function resolveOutputsInObject(obj, inputs) {
|
|
67
|
+
if (typeof obj === "string") {
|
|
68
|
+
const regex = /\$\{output:([\w-]+)\.([\w-]+)\}/g;
|
|
69
|
+
const matches = [...obj.matchAll(regex)];
|
|
70
|
+
if (matches.length === 0)
|
|
71
|
+
return pulumi.output(obj);
|
|
72
|
+
const outputs = matches.map(m => {
|
|
73
|
+
const val = inputs[m[1]]?.[m[2]];
|
|
74
|
+
return pulumi.Output.isInstance(val) ? val : pulumi.output(val);
|
|
75
|
+
});
|
|
76
|
+
return pulumi.all(outputs).apply(values => {
|
|
77
|
+
let result = obj;
|
|
78
|
+
matches.forEach((m, i) => {
|
|
79
|
+
result = result.replace(m[0], values[i]);
|
|
80
|
+
});
|
|
81
|
+
return result;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else if (Array.isArray(obj)) {
|
|
85
|
+
const resolvedArr = obj.map(item => resolveOutputsInObject(item, inputs));
|
|
86
|
+
return pulumi.all(resolvedArr);
|
|
87
|
+
}
|
|
88
|
+
else if (typeof obj === "object" && obj !== null) {
|
|
89
|
+
const keys = Object.keys(obj);
|
|
90
|
+
const resolved = {};
|
|
91
|
+
keys.forEach(key => {
|
|
92
|
+
resolved[key] = resolveOutputsInObject(obj[key], inputs);
|
|
93
|
+
});
|
|
94
|
+
return pulumi.all(resolved);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return pulumi.output(obj);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
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.AccountPermissions = void 0;
|
|
37
|
+
const aws = __importStar(require("@pulumi/aws"));
|
|
38
|
+
const pulumi = __importStar(require("@pulumi/pulumi"));
|
|
39
|
+
class AccountPermissions extends pulumi.ComponentResource {
|
|
40
|
+
static nonAutomationUserAssumeRoleName = "DeveloperRole";
|
|
41
|
+
static automationUserAssumeRoleName = "AutomationRole";
|
|
42
|
+
prefix;
|
|
43
|
+
automationUser;
|
|
44
|
+
managementAccountId;
|
|
45
|
+
constructor(name, args, opts) {
|
|
46
|
+
if (!opts.provider) {
|
|
47
|
+
throw new Error("Provider resource option is required");
|
|
48
|
+
}
|
|
49
|
+
super("acme:permissions:AccountPermissions", name, undefined, opts);
|
|
50
|
+
this.prefix = args.resourceNamesPrefix;
|
|
51
|
+
this.automationUser = args.automationUser;
|
|
52
|
+
this.managementAccountId = args.managementAccountId;
|
|
53
|
+
this.createRole();
|
|
54
|
+
this.createAutomationRole();
|
|
55
|
+
super.registerOutputs();
|
|
56
|
+
}
|
|
57
|
+
createRole() {
|
|
58
|
+
const devActions = ["s3:*", "cloudwatch:*", "dynamodb:*", "ec2:*"];
|
|
59
|
+
const permissionsBoundary = new aws.iam.Policy(`${this.prefix}DevBoundary`, {
|
|
60
|
+
policy: {
|
|
61
|
+
Version: "2012-10-17",
|
|
62
|
+
Statement: [
|
|
63
|
+
{
|
|
64
|
+
Effect: "Allow",
|
|
65
|
+
Action: devActions,
|
|
66
|
+
Resource: "*",
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
}, { parent: this });
|
|
71
|
+
const role = new aws.iam.Role(`${this.prefix}DevRole`, {
|
|
72
|
+
name: AccountPermissions.nonAutomationUserAssumeRoleName,
|
|
73
|
+
assumeRolePolicy: {
|
|
74
|
+
Version: "2012-10-17",
|
|
75
|
+
Statement: [
|
|
76
|
+
{
|
|
77
|
+
Effect: "Allow",
|
|
78
|
+
Principal: {
|
|
79
|
+
AWS: pulumi.interpolate `arn:aws:iam::${this.managementAccountId}:root`,
|
|
80
|
+
},
|
|
81
|
+
Action: "sts:AssumeRole",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
permissionsBoundary: permissionsBoundary.arn,
|
|
86
|
+
}, { parent: this });
|
|
87
|
+
const attachment = new aws.iam.RolePolicyAttachment(`${this.prefix}RPAttach`, {
|
|
88
|
+
policyArn: permissionsBoundary.arn,
|
|
89
|
+
role: role,
|
|
90
|
+
}, { parent: this });
|
|
91
|
+
}
|
|
92
|
+
createAutomationRole() {
|
|
93
|
+
const actions = [
|
|
94
|
+
"s3:*",
|
|
95
|
+
"cloudwatch:*",
|
|
96
|
+
"ec2:*",
|
|
97
|
+
"dynamodb:*",
|
|
98
|
+
"iam:*",
|
|
99
|
+
];
|
|
100
|
+
const permissionsBoundary = new aws.iam.Policy(`${this.prefix}AutomationUserBoundary`, {
|
|
101
|
+
policy: {
|
|
102
|
+
Version: "2012-10-17",
|
|
103
|
+
Statement: [
|
|
104
|
+
{
|
|
105
|
+
Effect: "Allow",
|
|
106
|
+
Action: actions,
|
|
107
|
+
Resource: "*",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
}, { parent: this });
|
|
112
|
+
const automationRole = new aws.iam.Role(`${this.prefix}AutomationUserRole`, {
|
|
113
|
+
name: AccountPermissions.automationUserAssumeRoleName,
|
|
114
|
+
assumeRolePolicy: {
|
|
115
|
+
Version: "2012-10-17",
|
|
116
|
+
Statement: [
|
|
117
|
+
{
|
|
118
|
+
Effect: "Allow",
|
|
119
|
+
Principal: {
|
|
120
|
+
AWS: this.automationUser.arn,
|
|
121
|
+
},
|
|
122
|
+
Action: "sts:AssumeRole",
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
permissionsBoundary: permissionsBoundary.arn,
|
|
127
|
+
}, { parent: this });
|
|
128
|
+
const attachment = new aws.iam.RolePolicyAttachment(`${this.prefix}UserPolicyAttach`, {
|
|
129
|
+
policyArn: permissionsBoundary.arn,
|
|
130
|
+
role: automationRole,
|
|
131
|
+
}, { parent: this });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.AccountPermissions = AccountPermissions;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AcmFactory = void 0;
|
|
4
|
+
const resourceFactory_1 = require("./resourceFactory");
|
|
5
|
+
const validateAcmConfig_1 = require("./validateAcmConfig");
|
|
6
|
+
const createAwsAcmCertificate_1 = require("./createAwsAcmCertificate");
|
|
7
|
+
class AcmFactory extends resourceFactory_1.ResourceFactory {
|
|
8
|
+
async createResource(config) {
|
|
9
|
+
(0, validateAcmConfig_1.validateAcmConfig)(config);
|
|
10
|
+
return (0, createAwsAcmCertificate_1.createAwsAcmCertificate)(config.configuration.domainName, {
|
|
11
|
+
domainName: config.configuration.domainName,
|
|
12
|
+
validationMethod: config.configuration.validationMethod || "DNS",
|
|
13
|
+
subjectAlternativeNames: config.configuration.subjectAlternativeNames,
|
|
14
|
+
tags: config.configuration.tags,
|
|
15
|
+
options: config.configuration.options,
|
|
16
|
+
validationOptions: config.configuration.domainValidationOptions,
|
|
17
|
+
keyAlgorithm: config.configuration.keyAlgorithm,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
getOutputs(resource) {
|
|
21
|
+
return {
|
|
22
|
+
arn: resource.arn,
|
|
23
|
+
domainName: resource.domainName,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
validateConfig(config) {
|
|
27
|
+
(0, validateAcmConfig_1.validateAcmConfig)(config);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.AcmFactory = AcmFactory;
|