UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

578 lines (577 loc) 20.5 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Creates and manages Scaleway Database Instances. * For more information, see refer to the [API documentation](https://www.scaleway.com/en/developers/api/managed-database-postgre-mysql/). * * ## Example Usage * * ### Example Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.databases.Instance("main", { * name: "test-rdb", * nodeType: "DB-DEV-S", * engine: "PostgreSQL-15", * isHaCluster: true, * disableBackup: true, * userName: "my_initial_user", * password: "thiZ_is_v&ry_s3cret", * encryptionAtRest: true, * }); * ``` * * ### Example Block Storage Low Latency * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.databases.Instance("main", { * name: "test-rdb-sbs", * nodeType: "db-play2-pico", * engine: "PostgreSQL-15", * isHaCluster: true, * disableBackup: true, * userName: "my_initial_user", * password: "thiZ_is_v&ry_s3cret", * volumeType: "sbs_15k", * volumeSizeInGb: 10, * }); * ``` * * ### Example with Settings * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.databases.Instance("main", { * name: "test-rdb", * nodeType: "db-dev-s", * disableBackup: true, * engine: "MySQL-8", * userName: "my_initial_user", * password: "thiZ_is_v&ry_s3cret", * initSettings: { * lower_case_table_names: "1", * }, * settings: { * max_connections: "350", * }, * }); * ``` * * ### Example with backup schedule * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.databases.Instance("main", { * name: "test-rdb", * nodeType: "DB-DEV-S", * engine: "PostgreSQL-15", * isHaCluster: true, * userName: "my_initial_user", * password: "thiZ_is_v&ry_s3cret", * disableBackup: false, * backupScheduleFrequency: 24, * backupScheduleRetention: 7, * }); * ``` * * ### Examples of endpoint configuration * * Database Instances can have a maximum of 1 public endpoint and 1 private endpoint. They can have both, or none. * * ### 1 static Private Network endpoint * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const pn = new scaleway.network.PrivateNetwork("pn", {ipv4Subnet: { * subnet: "172.16.20.0/22", * }}); * const main = new scaleway.databases.Instance("main", { * nodeType: "db-dev-s", * engine: "PostgreSQL-15", * privateNetwork: { * pnId: pn.id, * ipNet: "172.16.20.4/22", * }, * }); * ``` * * ### 1 IPAM Private Network endpoint + 1 public endpoint * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const pn = new scaleway.network.PrivateNetwork("pn", {}); * const main = new scaleway.databases.Instance("main", { * loadBalancers: [{}], * nodeType: "DB-DEV-S", * engine: "PostgreSQL-15", * privateNetwork: { * pnId: pn.id, * enableIpam: true, * }, * }); * ``` * * ### Default: 1 public endpoint * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.databases.Instance("main", { * nodeType: "db-dev-s", * engine: "PostgreSQL-15", * }); * ``` * * > **Note** If nothing is defined, your Database Instance will have a default public load-balancer endpoint. * * ## Limitations * * The Managed Database product is only compliant with the Private Network in the default availability zone (AZ). * i.e. `fr-par-1`, `nl-ams-1`, `pl-waw-1`. To learn more, read our * section [How to connect a PostgreSQL and MySQL Database Instance to a Private Network](https://www.scaleway.com/en/docs/managed-databases/postgresql-and-mysql/how-to/connect-database-private-network/) * * ## Import * * Database Instance can be imported using the `{region}/{id}`, e.g. * * bash * * ```sh * $ pulumi import scaleway:index/databaseInstance:DatabaseInstance rdb01 fr-par/11111111-1111-1111-1111-111111111111 * ``` * * @deprecated scaleway.index/databaseinstance.DatabaseInstance has been deprecated in favor of scaleway.databases/instance.Instance */ export declare class DatabaseInstance extends pulumi.CustomResource { /** * Get an existing DatabaseInstance resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: DatabaseInstanceState, opts?: pulumi.CustomResourceOptions): DatabaseInstance; /** * Returns true if the given object is an instance of DatabaseInstance. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is DatabaseInstance; /** * Boolean to store logical backups in the same region as the database instance */ readonly backupSameRegion: pulumi.Output<boolean>; /** * Backup schedule frequency in hours */ readonly backupScheduleFrequency: pulumi.Output<number>; /** * Backup schedule retention in days */ readonly backupScheduleRetention: pulumi.Output<number>; /** * Certificate of the Database Instance. */ readonly certificate: pulumi.Output<string>; /** * Disable automated backup for the database instance */ readonly disableBackup: pulumi.Output<boolean | undefined>; /** * Enable or disable encryption at rest for the Database Instance. */ readonly encryptionAtRest: pulumi.Output<boolean | undefined>; /** * (Deprecated) The IP of the Database Instance. Please use the privateNetwork or the loadBalancer attribute. * * @deprecated Please use the privateNetwork or the loadBalancer attribute */ readonly endpointIp: pulumi.Output<string>; /** * (Deprecated) The port of the Database Instance. Please use the privateNetwork or the loadBalancer attribute. * * @deprecated Please use the privateNetwork or the loadBalancer attribute */ readonly endpointPort: pulumi.Output<number>; /** * Database Instance's engine version (e.g. `PostgreSQL-11`). * * > **Important** Updates to `engine` will recreate the Database Instance. */ readonly engine: pulumi.Output<string>; /** * Map of engine settings to be set at database initialisation. */ readonly initSettings: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Enable or disable high availability for the Database Instance. * * > **Important** Updates to `isHaCluster` will recreate the Database Instance. */ readonly isHaCluster: pulumi.Output<boolean | undefined>; /** * List of Load Balancer endpoints of the Database Instance. */ readonly loadBalancers: pulumi.Output<outputs.DatabaseInstanceLoadBalancer[]>; /** * Logs policy configuration */ readonly logsPolicy: pulumi.Output<outputs.DatabaseInstanceLogsPolicy>; /** * The name of the Database Instance. */ readonly name: pulumi.Output<string>; /** * The type of Database Instance you want to create (e.g. `db-dev-s`). * * > **Important** Updates to `nodeType` will upgrade the Database Instance to the desired `nodeType` without any * interruption. * * > **Important** Once your Database Instance reaches `diskFull` status, if you are using `lssd` storage, you should upgrade the `nodeType`, and if you are using `bssd` storage, you should increase the volume size before making any other changes to your Database Instance. */ readonly nodeType: pulumi.Output<string>; /** * The organization ID the Database Instance is associated with. */ readonly organizationId: pulumi.Output<string>; /** * Password for the first user of the Database Instance. */ readonly password: pulumi.Output<string | undefined>; /** * The private IPv4 address associated with the resource. */ readonly privateIps: pulumi.Output<outputs.DatabaseInstancePrivateIp[]>; /** * List of Private Networks endpoints of the Database Instance. */ readonly privateNetwork: pulumi.Output<outputs.DatabaseInstancePrivateNetwork | undefined>; /** * `projectId`) The ID of the project the Database * Instance is associated with. */ readonly projectId: pulumi.Output<string>; /** * List of read replicas of the Database Instance. */ readonly readReplicas: pulumi.Output<outputs.DatabaseInstanceReadReplica[]>; /** * `region`) The region * in which the Database Instance should be created. */ readonly region: pulumi.Output<string>; /** * Map of engine settings to be set on a running instance. */ readonly settings: pulumi.Output<{ [key: string]: string; }>; /** * The ID of an existing snapshot to restore or create the Database Instance from. Conflicts with the `engine` parameter and backup settings. */ readonly snapshotId: pulumi.Output<string | undefined>; /** * The tags associated with the Database Instance. */ readonly tags: pulumi.Output<string[] | undefined>; /** * Identifier for the first user of the Database Instance. * * > **Important** Updates to `userName` will recreate the Database Instance. */ readonly userName: pulumi.Output<string>; /** * Volume size (in GB). Cannot be used when `volumeType` is set to `lssd`. * * > **Important** Once your Database Instance reaches `diskFull` status, you should increase the volume size before making any other change to your Database Instance. */ readonly volumeSizeInGb: pulumi.Output<number>; /** * Type of volume where data are stored (`lssd`, `sbs5k` or `sbs15k`). */ readonly volumeType: pulumi.Output<string | undefined>; /** * Create a DatabaseInstance resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ /** @deprecated scaleway.index/databaseinstance.DatabaseInstance has been deprecated in favor of scaleway.databases/instance.Instance */ constructor(name: string, args: DatabaseInstanceArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering DatabaseInstance resources. */ export interface DatabaseInstanceState { /** * Boolean to store logical backups in the same region as the database instance */ backupSameRegion?: pulumi.Input<boolean>; /** * Backup schedule frequency in hours */ backupScheduleFrequency?: pulumi.Input<number>; /** * Backup schedule retention in days */ backupScheduleRetention?: pulumi.Input<number>; /** * Certificate of the Database Instance. */ certificate?: pulumi.Input<string>; /** * Disable automated backup for the database instance */ disableBackup?: pulumi.Input<boolean>; /** * Enable or disable encryption at rest for the Database Instance. */ encryptionAtRest?: pulumi.Input<boolean>; /** * (Deprecated) The IP of the Database Instance. Please use the privateNetwork or the loadBalancer attribute. * * @deprecated Please use the privateNetwork or the loadBalancer attribute */ endpointIp?: pulumi.Input<string>; /** * (Deprecated) The port of the Database Instance. Please use the privateNetwork or the loadBalancer attribute. * * @deprecated Please use the privateNetwork or the loadBalancer attribute */ endpointPort?: pulumi.Input<number>; /** * Database Instance's engine version (e.g. `PostgreSQL-11`). * * > **Important** Updates to `engine` will recreate the Database Instance. */ engine?: pulumi.Input<string>; /** * Map of engine settings to be set at database initialisation. */ initSettings?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Enable or disable high availability for the Database Instance. * * > **Important** Updates to `isHaCluster` will recreate the Database Instance. */ isHaCluster?: pulumi.Input<boolean>; /** * List of Load Balancer endpoints of the Database Instance. */ loadBalancers?: pulumi.Input<pulumi.Input<inputs.DatabaseInstanceLoadBalancer>[]>; /** * Logs policy configuration */ logsPolicy?: pulumi.Input<inputs.DatabaseInstanceLogsPolicy>; /** * The name of the Database Instance. */ name?: pulumi.Input<string>; /** * The type of Database Instance you want to create (e.g. `db-dev-s`). * * > **Important** Updates to `nodeType` will upgrade the Database Instance to the desired `nodeType` without any * interruption. * * > **Important** Once your Database Instance reaches `diskFull` status, if you are using `lssd` storage, you should upgrade the `nodeType`, and if you are using `bssd` storage, you should increase the volume size before making any other changes to your Database Instance. */ nodeType?: pulumi.Input<string>; /** * The organization ID the Database Instance is associated with. */ organizationId?: pulumi.Input<string>; /** * Password for the first user of the Database Instance. */ password?: pulumi.Input<string>; /** * The private IPv4 address associated with the resource. */ privateIps?: pulumi.Input<pulumi.Input<inputs.DatabaseInstancePrivateIp>[]>; /** * List of Private Networks endpoints of the Database Instance. */ privateNetwork?: pulumi.Input<inputs.DatabaseInstancePrivateNetwork>; /** * `projectId`) The ID of the project the Database * Instance is associated with. */ projectId?: pulumi.Input<string>; /** * List of read replicas of the Database Instance. */ readReplicas?: pulumi.Input<pulumi.Input<inputs.DatabaseInstanceReadReplica>[]>; /** * `region`) The region * in which the Database Instance should be created. */ region?: pulumi.Input<string>; /** * Map of engine settings to be set on a running instance. */ settings?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The ID of an existing snapshot to restore or create the Database Instance from. Conflicts with the `engine` parameter and backup settings. */ snapshotId?: pulumi.Input<string>; /** * The tags associated with the Database Instance. */ tags?: pulumi.Input<pulumi.Input<string>[]>; /** * Identifier for the first user of the Database Instance. * * > **Important** Updates to `userName` will recreate the Database Instance. */ userName?: pulumi.Input<string>; /** * Volume size (in GB). Cannot be used when `volumeType` is set to `lssd`. * * > **Important** Once your Database Instance reaches `diskFull` status, you should increase the volume size before making any other change to your Database Instance. */ volumeSizeInGb?: pulumi.Input<number>; /** * Type of volume where data are stored (`lssd`, `sbs5k` or `sbs15k`). */ volumeType?: pulumi.Input<string>; } /** * The set of arguments for constructing a DatabaseInstance resource. */ export interface DatabaseInstanceArgs { /** * Boolean to store logical backups in the same region as the database instance */ backupSameRegion?: pulumi.Input<boolean>; /** * Backup schedule frequency in hours */ backupScheduleFrequency?: pulumi.Input<number>; /** * Backup schedule retention in days */ backupScheduleRetention?: pulumi.Input<number>; /** * Disable automated backup for the database instance */ disableBackup?: pulumi.Input<boolean>; /** * Enable or disable encryption at rest for the Database Instance. */ encryptionAtRest?: pulumi.Input<boolean>; /** * Database Instance's engine version (e.g. `PostgreSQL-11`). * * > **Important** Updates to `engine` will recreate the Database Instance. */ engine?: pulumi.Input<string>; /** * Map of engine settings to be set at database initialisation. */ initSettings?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Enable or disable high availability for the Database Instance. * * > **Important** Updates to `isHaCluster` will recreate the Database Instance. */ isHaCluster?: pulumi.Input<boolean>; /** * List of Load Balancer endpoints of the Database Instance. */ loadBalancers?: pulumi.Input<pulumi.Input<inputs.DatabaseInstanceLoadBalancer>[]>; /** * Logs policy configuration */ logsPolicy?: pulumi.Input<inputs.DatabaseInstanceLogsPolicy>; /** * The name of the Database Instance. */ name?: pulumi.Input<string>; /** * The type of Database Instance you want to create (e.g. `db-dev-s`). * * > **Important** Updates to `nodeType` will upgrade the Database Instance to the desired `nodeType` without any * interruption. * * > **Important** Once your Database Instance reaches `diskFull` status, if you are using `lssd` storage, you should upgrade the `nodeType`, and if you are using `bssd` storage, you should increase the volume size before making any other changes to your Database Instance. */ nodeType: pulumi.Input<string>; /** * Password for the first user of the Database Instance. */ password?: pulumi.Input<string>; /** * The private IPv4 address associated with the resource. */ privateIps?: pulumi.Input<pulumi.Input<inputs.DatabaseInstancePrivateIp>[]>; /** * List of Private Networks endpoints of the Database Instance. */ privateNetwork?: pulumi.Input<inputs.DatabaseInstancePrivateNetwork>; /** * `projectId`) The ID of the project the Database * Instance is associated with. */ projectId?: pulumi.Input<string>; /** * `region`) The region * in which the Database Instance should be created. */ region?: pulumi.Input<string>; /** * Map of engine settings to be set on a running instance. */ settings?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The ID of an existing snapshot to restore or create the Database Instance from. Conflicts with the `engine` parameter and backup settings. */ snapshotId?: pulumi.Input<string>; /** * The tags associated with the Database Instance. */ tags?: pulumi.Input<pulumi.Input<string>[]>; /** * Identifier for the first user of the Database Instance. * * > **Important** Updates to `userName` will recreate the Database Instance. */ userName?: pulumi.Input<string>; /** * Volume size (in GB). Cannot be used when `volumeType` is set to `lssd`. * * > **Important** Once your Database Instance reaches `diskFull` status, you should increase the volume size before making any other change to your Database Instance. */ volumeSizeInGb?: pulumi.Input<number>; /** * Type of volume where data are stored (`lssd`, `sbs5k` or `sbs15k`). */ volumeType?: pulumi.Input<string>; }