@studion/infra-code-blocks 0.6.7 → 0.6.8
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.
|
@@ -52,6 +52,11 @@ export type DatabaseArgs = {
|
|
|
52
52
|
* Set this to true to enable database monitoring. Defaults to false.
|
|
53
53
|
*/
|
|
54
54
|
enableMonitoring?: pulumi.Input<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Set this to true to allow major version upgrades, for example when creating
|
|
57
|
+
* db from the snapshot. Defaults to false.
|
|
58
|
+
*/
|
|
59
|
+
allowMajorVersionUpgrade?: pulumi.Input<boolean>;
|
|
55
60
|
/**
|
|
56
61
|
* The name of custom aws.rds.ParameterGroup. Setting this param will apply custom
|
|
57
62
|
* DB parameters to this instance.
|
|
@@ -3,7 +3,6 @@ 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");
|
|
7
6
|
const password_1 = require("./password");
|
|
8
7
|
const constants_1 = require("../constants");
|
|
9
8
|
const defaults = {
|
|
@@ -14,6 +13,7 @@ const defaults = {
|
|
|
14
13
|
maxAllocatedStorage: 100,
|
|
15
14
|
instanceClass: 'db.t4g.micro',
|
|
16
15
|
enableMonitoring: false,
|
|
16
|
+
allowMajorVersionUpgrade: false,
|
|
17
17
|
};
|
|
18
18
|
class Database extends pulumi.ComponentResource {
|
|
19
19
|
constructor(name, args, opts = {}) {
|
|
@@ -91,13 +91,9 @@ class Database extends pulumi.ComponentResource {
|
|
|
91
91
|
return monitoringRole;
|
|
92
92
|
}
|
|
93
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}`);
|
|
98
94
|
const encryptedSnapshotCopy = new aws.rds.SnapshotCopy(`${this.name}-encrypted-snapshot-copy`, {
|
|
99
95
|
sourceDbSnapshotIdentifier: snapshotIdentifier,
|
|
100
|
-
targetDbSnapshotIdentifier
|
|
96
|
+
targetDbSnapshotIdentifier: `${snapshotIdentifier}-encrypted-copy`,
|
|
101
97
|
kmsKeyId: this.kms.arn,
|
|
102
98
|
}, { parent: this });
|
|
103
99
|
return encryptedSnapshotCopy;
|
|
@@ -114,7 +110,7 @@ class Database extends pulumi.ComponentResource {
|
|
|
114
110
|
performanceInsightsRetentionPeriod: 7,
|
|
115
111
|
}
|
|
116
112
|
: {};
|
|
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:
|
|
113
|
+
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: argsWithDefaults.allowMajorVersionUpgrade, 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] });
|
|
118
114
|
return instance;
|
|
119
115
|
}
|
|
120
116
|
}
|