diff --git a/API.md b/API.md index c39c0d7..1910cb9 100644 --- a/API.md +++ b/API.md @@ -840,6 +840,8 @@ const postgresProps: PostgresProps = { ... } | postgresVersion | aws-cdk-lib.aws_rds.IInstanceEngine | *No description.* | | alertSubcriptionWebhooks | string[] | *No description.* | | allocatedStorage | number | *No description.* | +| allowMajorVersionUpgrade | boolean | *No description.* | +| autoMinorVersionUpgrade | boolean | *No description.* | | backupRetention | number | *No description.* | | deletionProtection | boolean | *No description.* | | enableAlerts | boolean | *No description.* | @@ -854,6 +856,8 @@ const postgresProps: PostgresProps = { ... } | publiclyAccessible | boolean | *No description.* | | readReplicas | ReadReplica | *No description.* | | replicaAlertThresholds | AlertThresholds | *No description.* | +| replicaAllocatedStorage | number | *No description.* | +| replicaMaxAllocatedStorage | number | *No description.* | | snapshotIdentifier | string | *No description.* | | snsTopicCreate | boolean | *No description.* | | storageEncrypted | boolean | *No description.* | @@ -942,6 +946,26 @@ public readonly allocatedStorage: number; --- +##### `allowMajorVersionUpgrade`Optional + +```typescript +public readonly allowMajorVersionUpgrade: boolean; +``` + +- *Type:* boolean + +--- + +##### `autoMinorVersionUpgrade`Optional + +```typescript +public readonly autoMinorVersionUpgrade: boolean; +``` + +- *Type:* boolean + +--- + ##### `backupRetention`Optional ```typescript @@ -1082,6 +1106,26 @@ public readonly replicaAlertThresholds: AlertThresholds; --- +##### `replicaAllocatedStorage`Optional + +```typescript +public readonly replicaAllocatedStorage: number; +``` + +- *Type:* number + +--- + +##### `replicaMaxAllocatedStorage`Optional + +```typescript +public readonly replicaMaxAllocatedStorage: number; +``` + +- *Type:* number + +--- + ##### `snapshotIdentifier`Optional ```typescript @@ -1257,30 +1301,30 @@ const slackChatbotProps: SlackChatbotProps = { ... } | **Name** | **Type** | **Description** | | --- | --- | --- | -| environmentName | string | *No description.* | | notificationTopics | aws-cdk-lib.aws_sns.ITopic[] | *No description.* | +| slackChannelConfigurationName | string | *No description.* | | slackChannelId | string | *No description.* | | slackWorkspaceId | string | *No description.* | --- -##### `environmentName`Required +##### `notificationTopics`Required ```typescript -public readonly environmentName: string; +public readonly notificationTopics: ITopic[]; ``` -- *Type:* string +- *Type:* aws-cdk-lib.aws_sns.ITopic[] --- -##### `notificationTopics`Required +##### `slackChannelConfigurationName`Required ```typescript -public readonly notificationTopics: ITopic[]; +public readonly slackChannelConfigurationName: string; ``` -- *Type:* aws-cdk-lib.aws_sns.ITopic[] +- *Type:* string --- diff --git a/src/rds.ts b/src/rds.ts index 6b3f6d8..932e12c 100644 --- a/src/rds.ts +++ b/src/rds.ts @@ -49,6 +49,8 @@ export interface PostgresProps { readonly multiAz?: boolean; readonly allocatedStorage?: number; readonly maxAllocatedStorage?: number; + readonly replicaAllocatedStorage?: number; + readonly replicaMaxAllocatedStorage?: number; readonly storageType?: rds.StorageType; readonly backupRetention?: number; readonly deletionProtection?: boolean; @@ -61,6 +63,8 @@ export interface PostgresProps { readonly metricTopicName?: string; readonly snsTopicCreate?: boolean; readonly storageEncrypted?: boolean; + readonly allowMajorVersionUpgrade?: boolean; + readonly autoMinorVersionUpgrade?: boolean; readonly tags?: Record; readonly enableAlerts?: boolean; // Flag to enable/disable all alerts (default: true) // Custom alert thresholds @@ -139,11 +143,14 @@ export class PostgresRDSCluster extends Construct { performanceInsightRetention: props.performanceInsightRetention, deleteAutomatedBackups: true, removalPolicy: RemovalPolicy.SNAPSHOT, - deletionProtection: props.deletionProtection, + deletionProtection: props.deletionProtection ?? true, cloudwatchLogsExports: ['postgresql'], copyTagsToSnapshot: true, allocatedStorage: props.allocatedStorage, maxAllocatedStorage: props.maxAllocatedStorage, + StorageType: props.storageType, + allowMajorVersionUpgrade: props.allowMajorVersionUpgrade ?? false, + autoMinorVersionUpgrade: props.autoMinorVersionUpgrade ?? false, }; const rdsInstance = props.snapshotIdentifier ? new rds.DatabaseInstanceFromSnapshot(this, `${props.clusterName}Cluster`, { ...commonInstanceProps, @@ -154,10 +161,8 @@ export class PostgresRDSCluster extends Construct { ...commonInstanceProps, engine: props.postgresVersion, credentials: rds.Credentials.fromGeneratedSecret(props.databaseMasterUserName), - allowMajorVersionUpgrade: false, - autoMinorVersionUpgrade: true, backupRetention: props.backupRetention ? Duration.days(props.backupRetention) : Duration.days(0), - storageEncrypted: props.storageEncrypted ?? false, + storageEncrypted: props.storageEncrypted ?? true, databaseName: props.databaseName, }); tags.forEach((v, k) => { @@ -196,6 +201,13 @@ export class PostgresRDSCluster extends Construct { for (let index = 0; index < props.readReplicas.replicas; index++) { let readReplics = new rds.DatabaseInstanceReadReplica(this, `${props.clusterName}-rreplicas-${index}`, { sourceDatabaseInstance: rdsInstance, + subnetGroup: dbSubnetGroup, + deletionProtection: props.deletionProtection ?? true, + storageEncrypted: props.storageEncrypted ?? true, + storageType: props.storageType, + autoMinorVersionUpgrade: props.allowMajorVersionUpgrade ?? false, + allocatedStorage: props.replicaAllocatedStorage ?? props.allocatedStorage, + maxAllocatedStorage: props.replicaMaxAllocatedStorage ?? props.maxAllocatedStorage, instanceIdentifier: `${props.clusterName}-rreplicas-${index}`, instanceType: props.readReplicas.instanceType, enablePerformanceInsights: props.enablePerformanceInsights, diff --git a/src/slackchatbot.ts b/src/slackchatbot.ts index 9c7ae05..e4403cd 100644 --- a/src/slackchatbot.ts +++ b/src/slackchatbot.ts @@ -7,7 +7,7 @@ import { import { Construct } from 'constructs'; export interface SlackChatbotProps { - readonly environmentName: string; + readonly slackChannelConfigurationName: string; readonly slackWorkspaceId: string; readonly slackChannelId: string; readonly notificationTopics: sns.ITopic[]; @@ -50,7 +50,7 @@ export class SlackChatbotIntegration extends Construct { this.slackChannel = new chatbot.SlackChannelConfiguration(this, `${this.node.id}-SlackChannelConfig`, { slackWorkspaceId: props.slackWorkspaceId, slackChannelId: props.slackChannelId, - slackChannelConfigurationName: `${props.environmentName}-tracking-rds-alerts`, + slackChannelConfigurationName: props.slackChannelConfigurationName, role: this.chatbotRole, notificationTopics: props.notificationTopics, });