UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

567 lines • 20.6 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConnectionProfile = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * A connection profile definition. * * To get more information about ConnectionProfile, see: * * * [API documentation](https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles/create) * * How-to Guides * * [Database Migration](https://cloud.google.com/database-migration/docs/) * * ## Example Usage * * ### Database Migration Service Connection Profile Cloudsql * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const cloudsqldb = new gcp.sql.DatabaseInstance("cloudsqldb", { * name: "my-database", * databaseVersion: "MYSQL_5_7", * settings: { * tier: "db-n1-standard-1", * deletionProtectionEnabled: false, * }, * deletionProtection: false, * }); * const sqlClientCert = new gcp.sql.SslCert("sql_client_cert", { * commonName: "my-cert", * instance: cloudsqldb.name, * }, { * dependsOn: [cloudsqldb], * }); * const sqldbUser = new gcp.sql.User("sqldb_user", { * name: "my-username", * instance: cloudsqldb.name, * password: "my-password", * }, { * dependsOn: [sqlClientCert], * }); * const cloudsqlprofile = new gcp.databasemigrationservice.ConnectionProfile("cloudsqlprofile", { * location: "us-central1", * connectionProfileId: "my-fromprofileid", * displayName: "my-fromprofileid_display", * labels: { * foo: "bar", * }, * mysql: { * host: cloudsqldb.ipAddresses.apply(ipAddresses => ipAddresses[0].ipAddress), * port: 3306, * username: sqldbUser.name, * password: sqldbUser.password, * ssl: { * clientKey: sqlClientCert.privateKey, * clientCertificate: sqlClientCert.cert, * caCertificate: sqlClientCert.serverCaCert, * type: "SERVER_CLIENT", * }, * cloudSqlId: "my-database", * }, * }, { * dependsOn: [sqldbUser], * }); * const cloudsqlprofileDestination = new gcp.databasemigrationservice.ConnectionProfile("cloudsqlprofile_destination", { * location: "us-central1", * connectionProfileId: "my-toprofileid", * displayName: "my-toprofileid_displayname", * labels: { * foo: "bar", * }, * cloudsql: { * settings: { * databaseVersion: "MYSQL_5_7", * userLabels: { * cloudfoo: "cloudbar", * }, * tier: "db-n1-standard-1", * edition: "ENTERPRISE", * storageAutoResizeLimit: "0", * activationPolicy: "ALWAYS", * ipConfig: { * enableIpv4: true, * requireSsl: true, * }, * autoStorageIncrease: true, * dataDiskType: "PD_HDD", * dataDiskSizeGb: "11", * zone: "us-central1-b", * sourceId: project.then(project => `projects/${project.projectId}/locations/us-central1/connectionProfiles/my-fromprofileid`), * rootPassword: "testpasscloudsql", * }, * }, * }, { * dependsOn: [cloudsqlprofile], * }); * ``` * ### Database Migration Service Connection Profile Postgres * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const postgresqldb = new gcp.sql.DatabaseInstance("postgresqldb", { * name: "my-database", * databaseVersion: "POSTGRES_12", * settings: { * tier: "db-custom-2-13312", * }, * deletionProtection: false, * }); * const sqlClientCert = new gcp.sql.SslCert("sql_client_cert", { * commonName: "my-cert", * instance: postgresqldb.name, * }, { * dependsOn: [postgresqldb], * }); * const sqldbUser = new gcp.sql.User("sqldb_user", { * name: "my-username", * instance: postgresqldb.name, * password: "my-password", * }, { * dependsOn: [sqlClientCert], * }); * const postgresprofile = new gcp.databasemigrationservice.ConnectionProfile("postgresprofile", { * location: "us-central1", * connectionProfileId: "my-profileid", * displayName: "my-profileid_display", * labels: { * foo: "bar", * }, * postgresql: { * host: postgresqldb.ipAddresses.apply(ipAddresses => ipAddresses[0].ipAddress), * port: 5432, * username: sqldbUser.name, * password: sqldbUser.password, * ssl: { * clientKey: sqlClientCert.privateKey, * clientCertificate: sqlClientCert.cert, * caCertificate: sqlClientCert.serverCaCert, * type: "SERVER_CLIENT", * }, * cloudSqlId: "my-database", * }, * }, { * dependsOn: [sqldbUser], * }); * ``` * ### Database Migration Service Connection Profile Postgres No Ssl * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const postgresqldb = new gcp.sql.DatabaseInstance("postgresqldb", { * name: "my-database", * databaseVersion: "POSTGRES_12", * settings: { * tier: "db-custom-2-13312", * }, * deletionProtection: false, * }); * const sqlClientCert = new gcp.sql.SslCert("sql_client_cert", { * commonName: "my-cert", * instance: postgresqldb.name, * }, { * dependsOn: [postgresqldb], * }); * const sqldbUser = new gcp.sql.User("sqldb_user", { * name: "my-username", * instance: postgresqldb.name, * password: "my-password", * }, { * dependsOn: [sqlClientCert], * }); * const postgresprofile = new gcp.databasemigrationservice.ConnectionProfile("postgresprofile", { * location: "us-central1", * connectionProfileId: "my-profileid", * displayName: "my-profileid_display", * labels: { * foo: "bar", * }, * postgresql: { * host: postgresqldb.ipAddresses.apply(ipAddresses => ipAddresses[0].ipAddress), * port: 5432, * username: sqldbUser.name, * password: sqldbUser.password, * ssl: { * type: "NONE", * }, * cloudSqlId: "my-database", * }, * }, { * dependsOn: [sqldbUser], * }); * ``` * ### Database Migration Service Connection Profile Postgres Required Ssl * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const postgresqldb = new gcp.sql.DatabaseInstance("postgresqldb", { * name: "my-database", * databaseVersion: "POSTGRES_12", * settings: { * tier: "db-custom-2-13312", * }, * deletionProtection: false, * }); * const sqlClientCert = new gcp.sql.SslCert("sql_client_cert", { * commonName: "my-cert", * instance: postgresqldb.name, * }, { * dependsOn: [postgresqldb], * }); * const sqldbUser = new gcp.sql.User("sqldb_user", { * name: "my-username", * instance: postgresqldb.name, * password: "my-password", * }, { * dependsOn: [sqlClientCert], * }); * const postgresprofile = new gcp.databasemigrationservice.ConnectionProfile("postgresprofile", { * location: "us-central1", * connectionProfileId: "my-profileid", * displayName: "my-profileid_display", * labels: { * foo: "bar", * }, * postgresql: { * host: postgresqldb.ipAddresses.apply(ipAddresses => ipAddresses[0].ipAddress), * port: 5432, * username: sqldbUser.name, * password: sqldbUser.password, * ssl: { * type: "REQUIRED", * }, * cloudSqlId: "my-database", * }, * }, { * dependsOn: [sqldbUser], * }); * ``` * ### Database Migration Service Connection Profile Oracle * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const oracleprofile = new gcp.databasemigrationservice.ConnectionProfile("oracleprofile", { * location: "us-central1", * connectionProfileId: "my-profileid", * displayName: "my-profileid_display", * labels: { * foo: "bar", * }, * oracle: { * host: "host", * port: 1521, * username: "username", * password: "password", * databaseService: "dbprovider", * staticServiceIpConnectivity: {}, * }, * }); * ``` * ### Database Migration Service Connection Profile Alloydb * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const _default = new gcp.compute.Network("default", {name: "vpc-network"}); * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", { * name: "private-ip-alloc", * addressType: "INTERNAL", * purpose: "VPC_PEERING", * prefixLength: 16, * network: _default.id, * }); * const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", { * network: _default.id, * service: "servicenetworking.googleapis.com", * reservedPeeringRanges: [privateIpAlloc.name], * }); * const alloydbprofile = new gcp.databasemigrationservice.ConnectionProfile("alloydbprofile", { * location: "us-central1", * connectionProfileId: "my-profileid", * displayName: "my-profileid_display", * labels: { * foo: "bar", * }, * alloydb: { * clusterId: "tf-test-dbmsalloycluster_9106", * settings: { * initialUser: { * user: "alloyuser_27169", * password: "alloypass_75223", * }, * vpcNetwork: _default.id, * labels: { * alloyfoo: "alloybar", * }, * primaryInstanceSettings: { * id: "priminstid", * machineConfig: { * cpuCount: 2, * }, * databaseFlags: {}, * labels: { * alloysinstfoo: "allowinstbar", * }, * }, * }, * }, * }, { * dependsOn: [vpcConnection], * }); * ``` * ### Database Migration Service Connection Profile Existing Mysql * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const destinationCsql = new gcp.sql.DatabaseInstance("destination_csql", { * name: "destination-csql", * databaseVersion: "MYSQL_5_7", * settings: { * tier: "db-n1-standard-1", * deletionProtectionEnabled: false, * }, * deletionProtection: false, * }); * const existing_mysql = new gcp.databasemigrationservice.ConnectionProfile("existing-mysql", { * location: "us-central1", * connectionProfileId: "destination-cp", * displayName: "destination-cp_display", * labels: { * foo: "bar", * }, * mysql: { * cloudSqlId: "destination-csql", * }, * }, { * dependsOn: [destinationCsql], * }); * ``` * ### Database Migration Service Connection Profile Existing Postgres * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const destinationCsql = new gcp.sql.DatabaseInstance("destination_csql", { * name: "destination-csql", * databaseVersion: "POSTGRES_15", * settings: { * tier: "db-custom-2-13312", * deletionProtectionEnabled: false, * }, * deletionProtection: false, * }); * const existing_psql = new gcp.databasemigrationservice.ConnectionProfile("existing-psql", { * location: "us-central1", * connectionProfileId: "destination-cp", * displayName: "destination-cp_display", * labels: { * foo: "bar", * }, * postgresql: { * cloudSqlId: "destination-csql", * }, * }, { * dependsOn: [destinationCsql], * }); * ``` * ### Database Migration Service Connection Profile Existing Alloydb * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const _default = new gcp.compute.Network("default", {name: "destination-alloydb"}); * const destinationAlloydb = new gcp.alloydb.Cluster("destination_alloydb", { * clusterId: "destination-alloydb", * location: "us-central1", * networkConfig: { * network: _default.id, * }, * databaseVersion: "POSTGRES_15", * initialUser: { * user: "destination-alloydb", * password: "destination-alloydb", * }, * deletionProtection: false, * }); * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", { * name: "destination-alloydb", * addressType: "INTERNAL", * purpose: "VPC_PEERING", * prefixLength: 16, * network: _default.id, * }); * const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", { * network: _default.id, * service: "servicenetworking.googleapis.com", * reservedPeeringRanges: [privateIpAlloc.name], * }); * const destinationAlloydbPrimary = new gcp.alloydb.Instance("destination_alloydb_primary", { * cluster: destinationAlloydb.name, * instanceId: "destination-alloydb-primary", * instanceType: "PRIMARY", * }, { * dependsOn: [vpcConnection], * }); * const existing_alloydb = new gcp.databasemigrationservice.ConnectionProfile("existing-alloydb", { * location: "us-central1", * connectionProfileId: "destination-cp", * displayName: "destination-cp_display", * labels: { * foo: "bar", * }, * postgresql: { * alloydbClusterId: "destination-alloydb", * }, * }, { * dependsOn: [ * destinationAlloydb, * destinationAlloydbPrimary, * ], * }); * ``` * * ## Import * * ConnectionProfile can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}` * * `{{project}}/{{location}}/{{connection_profile_id}}` * * `{{location}}/{{connection_profile_id}}` * * When using the `pulumi import` command, ConnectionProfile can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:databasemigrationservice/connectionProfile:ConnectionProfile default projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}} * $ pulumi import gcp:databasemigrationservice/connectionProfile:ConnectionProfile default {{project}}/{{location}}/{{connection_profile_id}} * $ pulumi import gcp:databasemigrationservice/connectionProfile:ConnectionProfile default {{location}}/{{connection_profile_id}} * ``` */ class ConnectionProfile extends pulumi.CustomResource { /** * Get an existing ConnectionProfile 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) { return new ConnectionProfile(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:databasemigrationservice/connectionProfile:ConnectionProfile'; /** * Returns true if the given object is an instance of ConnectionProfile. 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'] === ConnectionProfile.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["alloydb"] = state?.alloydb; resourceInputs["cloudsql"] = state?.cloudsql; resourceInputs["connectionProfileId"] = state?.connectionProfileId; resourceInputs["createTime"] = state?.createTime; resourceInputs["dbprovider"] = state?.dbprovider; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["displayName"] = state?.displayName; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["errors"] = state?.errors; resourceInputs["labels"] = state?.labels; resourceInputs["location"] = state?.location; resourceInputs["mysql"] = state?.mysql; resourceInputs["name"] = state?.name; resourceInputs["oracle"] = state?.oracle; resourceInputs["postgresql"] = state?.postgresql; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["role"] = state?.role; resourceInputs["state"] = state?.state; } else { const args = argsOrState; if (args?.connectionProfileId === undefined && !opts.urn) { throw new Error("Missing required property 'connectionProfileId'"); } resourceInputs["alloydb"] = args?.alloydb; resourceInputs["cloudsql"] = args?.cloudsql; resourceInputs["connectionProfileId"] = args?.connectionProfileId; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["displayName"] = args?.displayName; resourceInputs["labels"] = args?.labels; resourceInputs["location"] = args?.location; resourceInputs["mysql"] = args?.mysql; resourceInputs["oracle"] = args?.oracle; resourceInputs["postgresql"] = args?.postgresql; resourceInputs["project"] = args?.project; resourceInputs["role"] = args?.role; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["dbprovider"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["errors"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(ConnectionProfile.__pulumiType, name, resourceInputs, opts); } } exports.ConnectionProfile = ConnectionProfile; //# sourceMappingURL=connectionProfile.js.map