import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "./types"; /** * Manages a MySQL cluster within the Yandex.Cloud. For more information, see * [the official documentation](https://cloud.yandex.com/docs/managed-mysql/). * * ## Example Usage * * Example of creating a Single Node MySQL. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("fooVpcNetwork", {}); * const fooVpcSubnet = new yandex.VpcSubnet("fooVpcSubnet", { * zone: "ru-central1-a", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.5.0.0/24"], * }); * const fooMdbMysqlCluster = new yandex.MdbMysqlCluster("fooMdbMysqlCluster", { * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * version: "8.0", * resources: { * resourcePresetId: "s2.micro", * diskTypeId: "network-ssd", * diskSize: 16, * }, * mysqlConfig: { * sql_mode: "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION", * max_connections: 100, * default_authentication_plugin: "MYSQL_NATIVE_PASSWORD", * innodb_print_all_deadlocks: true, * }, * access: { * webSql: true, * }, * databases: [{ * name: "db_name", * }], * users: [{ * name: "user_name", * password: "your_password", * permissions: [{ * databaseName: "db_name", * roles: ["ALL"], * }], * }], * hosts: [{ * zone: "ru-central1-a", * subnetId: fooVpcSubnet.id, * }], * }); * ``` * * Example of creating a High-Availability(HA) MySQL Cluster. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("fooVpcNetwork", {}); * const fooVpcSubnet = new yandex.VpcSubnet("fooVpcSubnet", { * zone: "ru-central1-a", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.1.0.0/24"], * }); * const bar = new yandex.VpcSubnet("bar", { * zone: "ru-central1-b", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.2.0.0/24"], * }); * const fooMdbMysqlCluster = new yandex.MdbMysqlCluster("fooMdbMysqlCluster", { * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * version: "8.0", * resources: { * resourcePresetId: "s2.micro", * diskTypeId: "network-ssd", * diskSize: 16, * }, * databases: [{ * name: "db_name", * }], * maintenanceWindow: { * type: "WEEKLY", * day: "SAT", * hour: 12, * }, * users: [{ * name: "user_name", * password: "your_password", * permissions: [{ * databaseName: "db_name", * roles: ["ALL"], * }], * }], * hosts: [ * { * zone: "ru-central1-a", * subnetId: fooVpcSubnet.id, * }, * { * zone: "ru-central1-b", * subnetId: bar.id, * }, * ], * }); * ``` * * Example of creating a MySQL Cluster with cascade replicas: HA-group consist of 'na-1' and 'na-2', cascade replicas form a chain 'na-1' > 'nb-1' > 'nb-2' * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("fooVpcNetwork", {}); * const fooVpcSubnet = new yandex.VpcSubnet("fooVpcSubnet", { * zone: "ru-central1-a", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.1.0.0/24"], * }); * const bar = new yandex.VpcSubnet("bar", { * zone: "ru-central1-b", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.2.0.0/24"], * }); * const fooMdbMysqlCluster = new yandex.MdbMysqlCluster("fooMdbMysqlCluster", { * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * version: "8.0", * resources: { * resourcePresetId: "s2.micro", * diskTypeId: "network-ssd", * diskSize: 16, * }, * databases: [{ * name: "db_name", * }], * maintenanceWindow: { * type: "WEEKLY", * day: "SAT", * hour: 12, * }, * users: [{ * name: "user_name", * password: "your_password", * permissions: [{ * databaseName: "db_name", * roles: ["ALL"], * }], * }], * hosts: [ * { * zone: "ru-central1-a", * name: "na-1", * subnetId: fooVpcSubnet.id, * }, * { * zone: "ru-central1-a", * name: "na-2", * subnetId: fooVpcSubnet.id, * }, * { * zone: "ru-central1-b", * name: "nb-1", * replicationSourceName: "na-1", * subnetId: bar.id, * }, * { * zone: "ru-central1-b", * name: "nb-2", * replicationSourceName: "nb-1", * subnetId: bar.id, * }, * ], * }); * ``` * * Example of creating a Single Node MySQL with user params. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("fooVpcNetwork", {}); * const fooVpcSubnet = new yandex.VpcSubnet("fooVpcSubnet", { * zone: "ru-central1-a", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.5.0.0/24"], * }); * const fooMdbMysqlCluster = new yandex.MdbMysqlCluster("fooMdbMysqlCluster", { * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * version: "8.0", * resources: { * resourcePresetId: "s2.micro", * diskTypeId: "network-ssd", * diskSize: 16, * }, * databases: [{ * name: "db_name", * }], * maintenanceWindow: { * type: "ANYTIME", * }, * users: [{ * name: "user_name", * password: "your_password", * permissions: [{ * databaseName: "db_name", * roles: ["ALL"], * }], * connectionLimits: { * maxQuestionsPerHour: 10, * }, * globalPermissions: [ * "REPLICATION_SLAVE", * "PROCESS", * ], * authenticationPlugin: "CACHING_SHA2_PASSWORD", * }], * hosts: [{ * zone: "ru-central1-a", * subnetId: fooVpcSubnet.id, * }], * }); * ``` * * Example of restoring MySQL cluster. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("fooVpcNetwork", {}); * const fooVpcSubnet = new yandex.VpcSubnet("fooVpcSubnet", { * zone: "ru-central1-a", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.5.0.0/24"], * }); * const fooMdbMysqlCluster = new yandex.MdbMysqlCluster("fooMdbMysqlCluster", { * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * version: "8.0", * restore: { * backupId: "c9qj2tns23432471d9qha:stream_20210122T141717Z", * time: "2021-01-23T15:04:05", * }, * resources: { * resourcePresetId: "s2.micro", * diskTypeId: "network-ssd", * diskSize: 16, * }, * databases: [{ * name: "db_name", * }], * users: [{ * name: "user_name", * password: "your_password", * permissions: [{ * databaseName: "db_name", * roles: ["ALL"], * }], * }], * hosts: [{ * zone: "ru-central1-a", * subnetId: fooVpcSubnet.id, * }], * }); * ``` * ## MySQL config * * If not specified `mysqlConfig` then does not make any changes. * * * `sqlMode` default value: `ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION` * * some of:\ * - 1: "ALLOW_INVALID_DATES" * - 2: "ANSI_QUOTES" * - 3: "ERROR_FOR_DIVISION_BY_ZERO" * - 4: "HIGH_NOT_PRECEDENCE" * - 5: "IGNORE_SPACE" * - 6: "NO_AUTO_VALUE_ON_ZERO" * - 7: "NO_BACKSLASH_ESCAPES" * - 8: "NO_ENGINE_SUBSTITUTION" * - 9: "NO_UNSIGNED_SUBTRACTION" * - 10: "NO_ZERO_DATE" * - 11: "NO_ZERO_IN_DATE" * - 15: "ONLY_FULL_GROUP_BY" * - 16: "PAD_CHAR_TO_FULL_LENGTH" * - 17: "PIPES_AS_CONCAT" * - 18: "REAL_AS_FLOAT" * - 19: "STRICT_ALL_TABLES" * - 20: "STRICT_TRANS_TABLES" * - 21: "TIME_TRUNCATE_FRACTIONAL" * - 22: "ANSI" * - 23: "TRADITIONAL" * - 24: "NO_DIR_IN_CREATE" * or: * - 0: "SQLMODE_UNSPECIFIED" * * ### MysqlConfig 8.0 * * `auditLog` boolean * * * `autoIncrementIncrement` integer * * * `autoIncrementOffset` integer * * * `binlogCacheSize` integer * * * `binlogGroupCommitSyncDelay` integer * * * `binlogRowImage` one of: * - 0: "BINLOG_ROW_IMAGE_UNSPECIFIED" * - 1: "FULL" * - 2: "MINIMAL" * - 3: "NOBLOB" * * * `binlogRowsQueryLogEvents` boolean * * * `characterSetServer` text * * * `collationServer` text * * * `defaultAuthenticationPlugin` one of: * - 0: "AUTH_PLUGIN_UNSPECIFIED" * - 1: "MYSQL_NATIVE_PASSWORD" * - 2: "CACHING_SHA2_PASSWORD" * - 3: "SHA256_PASSWORD" * * * `defaultTimeZone` text * * * `explicitDefaultsForTimestamp` boolean * * * `generalLog` boolean * * * `groupConcatMaxLen` integer * * * `innodbAdaptiveHashIndex` boolean * * * `innodbBufferPoolSize` integer * * * `innodbFlushLogAtTrxCommit` integer * * * `innodbIoCapacity` integer * * * `innodbIoCapacityMax` integer * * * `innodbLockWaitTimeout` integer * * * `innodbLogBufferSize` integer * * * `innodbLogFileSize` integer * * * `innodbNumaInterleave` boolean * * * `innodbPrintAllDeadlocks` boolean * * * `innodbPurgeThreads` integer * * * `innodbReadIoThreads` integer * * * `innodbTempDataFileMaxSize` integer * * * `innodbThreadConcurrency` integer * * * `innodbWriteIoThreads` integer * * * `joinBufferSize` integer * * * `longQueryTime` float * * * `maxAllowedPacket` integer * * * `maxConnections` integer * * * `maxHeapTableSize` integer * * * `netReadTimeout` integer * * * `netWriteTimeout` integer * * * `regexpTimeLimit` integer * * * `rplSemiSyncMasterWaitForSlaveCount` integer * * * `slaveParallelType` one of: * - 0: "SLAVE_PARALLEL_TYPE_UNSPECIFIED" * - 1: "DATABASE" * - 2: "LOGICAL_CLOCK" * * * `slaveParallelWorkers` integer * * * `sortBufferSize` integer * * * `syncBinlog` integer * * * `tableDefinitionCache` integer * * * `tableOpenCache` integer * * * `tableOpenCacheInstances` integer * * * `threadCacheSize` integer * * * `threadStack` integer * * * `tmpTableSize` integer * * * `transactionIsolation` one of: * - 0: "TRANSACTION_ISOLATION_UNSPECIFIED" * - 1: "READ_COMMITTED" * - 2: "REPEATABLE_READ" * - 3: "SERIALIZABLE" * * ### MysqlConfig 5.7 * * `auditLog` boolean * * * `autoIncrementIncrement` integer * * * `autoIncrementOffset` integer * * * `binlogCacheSize` integer * * * `binlogGroupCommitSyncDelay` integer * * * `binlogRowImage` one of: * - 0: "BINLOG_ROW_IMAGE_UNSPECIFIED" * - 1: "FULL" * - 2: "MINIMAL" * - 3: "NOBLOB" * * * `binlogRowsQueryLogEvents` boolean * * * `characterSetServer` text * * * `collationServer` text * * * `defaultAuthenticationPlugin` one of: * - 0: "AUTH_PLUGIN_UNSPECIFIED" * - 1: "MYSQL_NATIVE_PASSWORD" * - 2: "CACHING_SHA2_PASSWORD" * - 3: "SHA256_PASSWORD" * * * `defaultTimeZone` text * * * `explicitDefaultsForTimestamp` boolean * * * `generalLog` boolean * * * `groupConcatMaxLen` integer * * * `innodbAdaptiveHashIndex` boolean * * * `innodbBufferPoolSize` integer * * * `innodbFlushLogAtTrxCommit` integer * * * `innodbIoCapacity` integer * * * `innodbIoCapacityMax` integer * * * `innodbLockWaitTimeout` integer * * * `innodbLogBufferSize` integer * * * `innodbLogFileSize` integer * * * `innodbNumaInterleave` boolean * * * `innodbPrintAllDeadlocks` boolean * * * `innodbPurgeThreads` integer * * * `innodbReadIoThreads` integer * * * `innodbTempDataFileMaxSize` integer * * * `innodbThreadConcurrency` integer * * * `innodbWriteIoThreads` integer * * * `joinBufferSize` integer * * * `longQueryTime` float * * * `maxAllowedPacket` integer * * * `maxConnections` integer * * * `maxHeapTableSize` integer * * * `netReadTimeout` integer * * * `netWriteTimeout` integer * * * `rplSemiSyncMasterWaitForSlaveCount` integer * * * `slaveParallelType` one of: * - 0: "SLAVE_PARALLEL_TYPE_UNSPECIFIED" * - 1: "DATABASE" * - 2: "LOGICAL_CLOCK" * * * `slaveParallelWorkers` integer * * * `sortBufferSize` integer * * * `syncBinlog` integer * * * `tableDefinitionCache` integer * * * `tableOpenCache` integer * * * `tableOpenCacheInstances` integer * * * `threadCacheSize` integer * * * `threadStack` integer * * * `tmpTableSize` integer * * * `transactionIsolation` one of: * - 0: "TRANSACTION_ISOLATION_UNSPECIFIED" * - 1: "READ_COMMITTED" * - 2: "REPEATABLE_READ" * - 3: "SERIALIZABLE" * * ## Import * * A cluster can be imported using the `id` of the resource, e.g. * * ```sh * $ pulumi import yandex:index/mdbMysqlCluster:MdbMysqlCluster foo cluster_id * ``` */ export declare class MdbMysqlCluster extends pulumi.CustomResource { /** * Get an existing MdbMysqlCluster 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, state?: MdbMysqlClusterState, opts?: pulumi.CustomResourceOptions): MdbMysqlCluster; /** * Returns true if the given object is an instance of MdbMysqlCluster. 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 MdbMysqlCluster; /** * Access policy to the MySQL cluster. The structure is documented below. */ readonly access: pulumi.Output; /** * @deprecated You can safely remove this option. There is no need to recreate host if assign_public_ip is changed. */ readonly allowRegenerationHost: pulumi.Output; /** * Time to start the daily backup, in the UTC. The structure is documented below. */ readonly backupWindowStart: pulumi.Output; /** * Creation timestamp of the cluster. */ readonly createdAt: pulumi.Output; /** * A database of the MySQL cluster. The structure is documented below. */ readonly databases: pulumi.Output; /** * Inhibits deletion of the cluster. Can be either `true` or `false`. */ readonly deletionProtection: pulumi.Output; /** * Description of the MySQL cluster. */ readonly description: pulumi.Output; /** * Deployment environment of the MySQL cluster. */ readonly environment: pulumi.Output; /** * The ID of the folder that the resource belongs to. If it * is not provided, the default provider folder is used. */ readonly folderId: pulumi.Output; /** * Aggregated health of the cluster. */ readonly health: pulumi.Output; /** * A host of the MySQL cluster. The structure is documented below. */ readonly hosts: pulumi.Output; /** * A set of key/value label pairs to assign to the MySQL cluster. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Maintenance policy of the MySQL cluster. The structure is documented below. */ readonly maintenanceWindow: pulumi.Output; /** * MySQL cluster config. Detail info in "MySQL config" section (documented below). */ readonly mysqlConfig: pulumi.Output<{ [key: string]: string; }>; /** * Host state name. It should be set for all hosts or unset for all hosts. This field can be used by another host, to select which host will be its replication source. Please refer to `replicationSourceName` parameter. */ readonly name: pulumi.Output; /** * ID of the network, to which the MySQL cluster uses. */ readonly networkId: pulumi.Output; /** * Resources allocated to hosts of the MySQL cluster. The structure is documented below. */ readonly resources: pulumi.Output; /** * The cluster will be created from the specified backup. The structure is documented below. */ readonly restore: pulumi.Output; /** * A set of ids of security groups assigned to hosts of the cluster. */ readonly securityGroupIds: pulumi.Output; /** * Status of the cluster. */ readonly status: pulumi.Output; /** * A user of the MySQL cluster. The structure is documented below. */ readonly users: pulumi.Output; /** * Version of the MySQL cluster. (allowed versions are: 5.7, 8.0) */ readonly version: pulumi.Output; /** * Create a MdbMysqlCluster 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. */ constructor(name: string, args: MdbMysqlClusterArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering MdbMysqlCluster resources. */ export interface MdbMysqlClusterState { /** * Access policy to the MySQL cluster. The structure is documented below. */ access?: pulumi.Input; /** * @deprecated You can safely remove this option. There is no need to recreate host if assign_public_ip is changed. */ allowRegenerationHost?: pulumi.Input; /** * Time to start the daily backup, in the UTC. The structure is documented below. */ backupWindowStart?: pulumi.Input; /** * Creation timestamp of the cluster. */ createdAt?: pulumi.Input; /** * A database of the MySQL cluster. The structure is documented below. */ databases?: pulumi.Input[]>; /** * Inhibits deletion of the cluster. Can be either `true` or `false`. */ deletionProtection?: pulumi.Input; /** * Description of the MySQL cluster. */ description?: pulumi.Input; /** * Deployment environment of the MySQL cluster. */ environment?: pulumi.Input; /** * The ID of the folder that the resource belongs to. If it * is not provided, the default provider folder is used. */ folderId?: pulumi.Input; /** * Aggregated health of the cluster. */ health?: pulumi.Input; /** * A host of the MySQL cluster. The structure is documented below. */ hosts?: pulumi.Input[]>; /** * A set of key/value label pairs to assign to the MySQL cluster. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Maintenance policy of the MySQL cluster. The structure is documented below. */ maintenanceWindow?: pulumi.Input; /** * MySQL cluster config. Detail info in "MySQL config" section (documented below). */ mysqlConfig?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Host state name. It should be set for all hosts or unset for all hosts. This field can be used by another host, to select which host will be its replication source. Please refer to `replicationSourceName` parameter. */ name?: pulumi.Input; /** * ID of the network, to which the MySQL cluster uses. */ networkId?: pulumi.Input; /** * Resources allocated to hosts of the MySQL cluster. The structure is documented below. */ resources?: pulumi.Input; /** * The cluster will be created from the specified backup. The structure is documented below. */ restore?: pulumi.Input; /** * A set of ids of security groups assigned to hosts of the cluster. */ securityGroupIds?: pulumi.Input[]>; /** * Status of the cluster. */ status?: pulumi.Input; /** * A user of the MySQL cluster. The structure is documented below. */ users?: pulumi.Input[]>; /** * Version of the MySQL cluster. (allowed versions are: 5.7, 8.0) */ version?: pulumi.Input; } /** * The set of arguments for constructing a MdbMysqlCluster resource. */ export interface MdbMysqlClusterArgs { /** * Access policy to the MySQL cluster. The structure is documented below. */ access?: pulumi.Input; /** * @deprecated You can safely remove this option. There is no need to recreate host if assign_public_ip is changed. */ allowRegenerationHost?: pulumi.Input; /** * Time to start the daily backup, in the UTC. The structure is documented below. */ backupWindowStart?: pulumi.Input; /** * A database of the MySQL cluster. The structure is documented below. */ databases: pulumi.Input[]>; /** * Inhibits deletion of the cluster. Can be either `true` or `false`. */ deletionProtection?: pulumi.Input; /** * Description of the MySQL cluster. */ description?: pulumi.Input; /** * Deployment environment of the MySQL cluster. */ environment: pulumi.Input; /** * The ID of the folder that the resource belongs to. If it * is not provided, the default provider folder is used. */ folderId?: pulumi.Input; /** * A host of the MySQL cluster. The structure is documented below. */ hosts: pulumi.Input[]>; /** * A set of key/value label pairs to assign to the MySQL cluster. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Maintenance policy of the MySQL cluster. The structure is documented below. */ maintenanceWindow?: pulumi.Input; /** * MySQL cluster config. Detail info in "MySQL config" section (documented below). */ mysqlConfig?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Host state name. It should be set for all hosts or unset for all hosts. This field can be used by another host, to select which host will be its replication source. Please refer to `replicationSourceName` parameter. */ name?: pulumi.Input; /** * ID of the network, to which the MySQL cluster uses. */ networkId: pulumi.Input; /** * Resources allocated to hosts of the MySQL cluster. The structure is documented below. */ resources: pulumi.Input; /** * The cluster will be created from the specified backup. The structure is documented below. */ restore?: pulumi.Input; /** * A set of ids of security groups assigned to hosts of the cluster. */ securityGroupIds?: pulumi.Input[]>; /** * A user of the MySQL cluster. The structure is documented below. */ users: pulumi.Input[]>; /** * Version of the MySQL cluster. (allowed versions are: 5.7, 8.0) */ version: pulumi.Input; }