UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

268 lines 12 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.DatabaseInstance = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * 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 */ 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, id, state, opts) { pulumi.log.warn("DatabaseInstance is deprecated: scaleway.index/databaseinstance.DatabaseInstance has been deprecated in favor of scaleway.databases/instance.Instance"); return new DatabaseInstance(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === DatabaseInstance.__pulumiType; } /** @deprecated scaleway.index/databaseinstance.DatabaseInstance has been deprecated in favor of scaleway.databases/instance.Instance */ constructor(name, argsOrState, opts) { pulumi.log.warn("DatabaseInstance is deprecated: scaleway.index/databaseinstance.DatabaseInstance has been deprecated in favor of scaleway.databases/instance.Instance"); let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["backupSameRegion"] = state ? state.backupSameRegion : undefined; resourceInputs["backupScheduleFrequency"] = state ? state.backupScheduleFrequency : undefined; resourceInputs["backupScheduleRetention"] = state ? state.backupScheduleRetention : undefined; resourceInputs["certificate"] = state ? state.certificate : undefined; resourceInputs["disableBackup"] = state ? state.disableBackup : undefined; resourceInputs["encryptionAtRest"] = state ? state.encryptionAtRest : undefined; resourceInputs["endpointIp"] = state ? state.endpointIp : undefined; resourceInputs["endpointPort"] = state ? state.endpointPort : undefined; resourceInputs["engine"] = state ? state.engine : undefined; resourceInputs["initSettings"] = state ? state.initSettings : undefined; resourceInputs["isHaCluster"] = state ? state.isHaCluster : undefined; resourceInputs["loadBalancers"] = state ? state.loadBalancers : undefined; resourceInputs["logsPolicy"] = state ? state.logsPolicy : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["nodeType"] = state ? state.nodeType : undefined; resourceInputs["organizationId"] = state ? state.organizationId : undefined; resourceInputs["password"] = state ? state.password : undefined; resourceInputs["privateIps"] = state ? state.privateIps : undefined; resourceInputs["privateNetwork"] = state ? state.privateNetwork : undefined; resourceInputs["projectId"] = state ? state.projectId : undefined; resourceInputs["readReplicas"] = state ? state.readReplicas : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["settings"] = state ? state.settings : undefined; resourceInputs["snapshotId"] = state ? state.snapshotId : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["userName"] = state ? state.userName : undefined; resourceInputs["volumeSizeInGb"] = state ? state.volumeSizeInGb : undefined; resourceInputs["volumeType"] = state ? state.volumeType : undefined; } else { const args = argsOrState; if ((!args || args.nodeType === undefined) && !opts.urn) { throw new Error("Missing required property 'nodeType'"); } resourceInputs["backupSameRegion"] = args ? args.backupSameRegion : undefined; resourceInputs["backupScheduleFrequency"] = args ? args.backupScheduleFrequency : undefined; resourceInputs["backupScheduleRetention"] = args ? args.backupScheduleRetention : undefined; resourceInputs["disableBackup"] = args ? args.disableBackup : undefined; resourceInputs["encryptionAtRest"] = args ? args.encryptionAtRest : undefined; resourceInputs["engine"] = args ? args.engine : undefined; resourceInputs["initSettings"] = args ? args.initSettings : undefined; resourceInputs["isHaCluster"] = args ? args.isHaCluster : undefined; resourceInputs["loadBalancers"] = args ? args.loadBalancers : undefined; resourceInputs["logsPolicy"] = args ? args.logsPolicy : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["nodeType"] = args ? args.nodeType : undefined; resourceInputs["password"] = (args === null || args === void 0 ? void 0 : args.password) ? pulumi.secret(args.password) : undefined; resourceInputs["privateIps"] = args ? args.privateIps : undefined; resourceInputs["privateNetwork"] = args ? args.privateNetwork : undefined; resourceInputs["projectId"] = args ? args.projectId : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["settings"] = args ? args.settings : undefined; resourceInputs["snapshotId"] = args ? args.snapshotId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["userName"] = args ? args.userName : undefined; resourceInputs["volumeSizeInGb"] = args ? args.volumeSizeInGb : undefined; resourceInputs["volumeType"] = args ? args.volumeType : undefined; resourceInputs["certificate"] = undefined /*out*/; resourceInputs["endpointIp"] = undefined /*out*/; resourceInputs["endpointPort"] = undefined /*out*/; resourceInputs["organizationId"] = undefined /*out*/; resourceInputs["readReplicas"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["password"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(DatabaseInstance.__pulumiType, name, resourceInputs, opts); } } exports.DatabaseInstance = DatabaseInstance; /** @internal */ DatabaseInstance.__pulumiType = 'scaleway:index/databaseInstance:DatabaseInstance'; //# sourceMappingURL=databaseInstance.js.map