@studion/infra-code-blocks 0.6.5 → 0.6.7
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.
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Database = void 0;
|
|
4
4
|
const aws = require("@pulumi/aws");
|
|
5
5
|
const pulumi = require("@pulumi/pulumi");
|
|
6
|
+
const random = require("@pulumi/random");
|
|
6
7
|
const password_1 = require("./password");
|
|
7
8
|
const constants_1 = require("../constants");
|
|
8
9
|
const defaults = {
|
|
@@ -90,9 +91,13 @@ class Database extends pulumi.ComponentResource {
|
|
|
90
91
|
return monitoringRole;
|
|
91
92
|
}
|
|
92
93
|
createEncryptedSnapshotCopy(snapshotIdentifier) {
|
|
94
|
+
const targetDbSnapshotIdentifier = new random.RandomString(`${this.name}-snapshot-copy-identifier-sufix`, {
|
|
95
|
+
length: 10,
|
|
96
|
+
special: false,
|
|
97
|
+
}, { parent: this }).result.apply(sufix => `${snapshotIdentifier}-${sufix}`);
|
|
93
98
|
const encryptedSnapshotCopy = new aws.rds.SnapshotCopy(`${this.name}-encrypted-snapshot-copy`, {
|
|
94
99
|
sourceDbSnapshotIdentifier: snapshotIdentifier,
|
|
95
|
-
targetDbSnapshotIdentifier
|
|
100
|
+
targetDbSnapshotIdentifier,
|
|
96
101
|
kmsKeyId: this.kms.arn,
|
|
97
102
|
}, { parent: this });
|
|
98
103
|
return encryptedSnapshotCopy;
|
|
@@ -109,7 +114,7 @@ class Database extends pulumi.ComponentResource {
|
|
|
109
114
|
performanceInsightsRetentionPeriod: 7,
|
|
110
115
|
}
|
|
111
116
|
: {};
|
|
112
|
-
const instance = new aws.rds.Instance(`${this.name}-rds`, Object.assign(Object.assign({ identifierPrefix: `${this.name}-`, engine: 'postgres', engineVersion: '15.5', allocatedStorage: argsWithDefaults.allocatedStorage, maxAllocatedStorage: argsWithDefaults.maxAllocatedStorage, instanceClass: argsWithDefaults.instanceClass, dbName: argsWithDefaults.dbName, username: argsWithDefaults.username, password: this.password.value, dbSubnetGroupName: this.dbSubnetGroup.name, vpcSecurityGroupIds: [this.dbSecurityGroup.id], storageEncrypted: true, kmsKeyId: this.kms.arn, multiAz: argsWithDefaults.multiAz, publiclyAccessible: false, skipFinalSnapshot: argsWithDefaults.skipFinalSnapshot, applyImmediately: argsWithDefaults.applyImmediately, autoMinorVersionUpgrade: true, maintenanceWindow: 'Mon:07:00-Mon:07:30', finalSnapshotIdentifier: `${this.name}-final-snapshot-${stack}`, backupWindow: '06:00-06:30', backupRetentionPeriod: 14, caCertIdentifier: 'rds-ca-rsa2048-g1', parameterGroupName: argsWithDefaults.parameterGroupName
|
|
117
|
+
const instance = new aws.rds.Instance(`${this.name}-rds`, Object.assign(Object.assign({ identifierPrefix: `${this.name}-`, engine: 'postgres', engineVersion: '15.5', allocatedStorage: argsWithDefaults.allocatedStorage, maxAllocatedStorage: argsWithDefaults.maxAllocatedStorage, instanceClass: argsWithDefaults.instanceClass, dbName: argsWithDefaults.dbName, username: argsWithDefaults.username, password: this.password.value, dbSubnetGroupName: this.dbSubnetGroup.name, vpcSecurityGroupIds: [this.dbSecurityGroup.id], storageEncrypted: true, kmsKeyId: this.kms.arn, multiAz: argsWithDefaults.multiAz, publiclyAccessible: false, skipFinalSnapshot: argsWithDefaults.skipFinalSnapshot, applyImmediately: argsWithDefaults.applyImmediately, autoMinorVersionUpgrade: true, maintenanceWindow: 'Mon:07:00-Mon:07:30', finalSnapshotIdentifier: `${this.name}-final-snapshot-${stack}`, backupWindow: '06:00-06:30', backupRetentionPeriod: 14, caCertIdentifier: 'rds-ca-rsa2048-g1', parameterGroupName: argsWithDefaults.parameterGroupName, allowMajorVersionUpgrade: Boolean(argsWithDefaults.snapshotIdentifier), snapshotIdentifier: (_a = this.encryptedSnapshotCopy) === null || _a === void 0 ? void 0 : _a.targetDbSnapshotIdentifier }, monitoringOptions), { tags: Object.assign(Object.assign({}, constants_1.commonTags), argsWithDefaults.tags) }), { parent: this, dependsOn: [this.password] });
|
|
113
118
|
return instance;
|
|
114
119
|
}
|
|
115
120
|
}
|