@studion/infra-code-blocks
Version:
Studion common infra components
99 lines (98 loc) • 3.36 kB
TypeScript
import * as aws from '@pulumi/aws';
import * as pulumi from '@pulumi/pulumi';
import { Password } from './password';
export type DatabaseArgs = {
/**
* The name of the database to create when the DB instance is created.
*/
dbName: pulumi.Input<string>;
/**
* Username for the master DB user.
*/
username: pulumi.Input<string>;
vpcId: pulumi.Input<string>;
isolatedSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
/**
* The IPv4 CIDR block for the VPC.
*/
vpcCidrBlock: pulumi.Input<string>;
/**
* Specifies if the RDS instance is multi-AZ. Defaults to false.
*/
multiAz?: pulumi.Input<boolean>;
/**
* Password for the master DB user. If not specified it will be autogenerated.
* The value will be stored as a secret in AWS Secret Manager.
*/
password?: pulumi.Input<string>;
/**
* Specifies whether any database modifications are applied immediately,
* or during the next maintenance window. Default is false.
*/
applyImmediately?: pulumi.Input<boolean>;
/**
* Determines whether a final DB snapshot is created before the DB
* instance is deleted. Defaults to false.
*/
skipFinalSnapshot?: pulumi.Input<boolean>;
/**
* The allocated storage in gibibytes. Defaults to 20GB.
*/
allocatedStorage?: pulumi.Input<number>;
/**
* The upper limit to which Amazon RDS can automatically scale
* the storage of the DB instance. Defaults to 100GB.
*/
maxAllocatedStorage?: pulumi.Input<number>;
/**
* The instance type of the RDS instance. Defaults to 'db.t4g.micro'.
*/
instanceClass?: pulumi.Input<string>;
/**
* Set this to true to enable database monitoring. Defaults to false.
*/
enableMonitoring?: pulumi.Input<boolean>;
/**
* Set this to true to allow major version upgrades, for example when creating
* db from the snapshot. Defaults to false.
*/
allowMajorVersionUpgrade?: pulumi.Input<boolean>;
/**
* The name of custom aws.rds.ParameterGroup. Setting this param will apply custom
* DB parameters to this instance.
*/
parameterGroupName?: pulumi.Input<string>;
/**
* Specifies whether to create this database from a snapshot.
* This correlates to the snapshot ID you'd find in the RDS console,
* e.g: rds:production-2015-06-26-06-05.
*/
snapshotIdentifier?: pulumi.Input<string>;
/**
* The DB engine version. Defaults to '17.2'.
*/
engineVersion?: pulumi.Input<string>;
/**
* A map of tags to assign to the resource.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
};
export declare class Database extends pulumi.ComponentResource {
name: string;
instance: aws.rds.Instance;
kms: aws.kms.Key;
dbSubnetGroup: aws.rds.SubnetGroup;
dbSecurityGroup: aws.ec2.SecurityGroup;
password: Password;
encryptedSnapshotCopy?: aws.rds.SnapshotCopy;
monitoringRole?: aws.iam.Role;
constructor(name: string, args: DatabaseArgs, opts?: pulumi.ComponentResourceOptions);
private createSubnetGroup;
private createSecurityGroup;
private createEncryptionKey;
private createMonitoringRole;
private createEncryptedSnapshotCopy;
private createDatabaseInstance;
}