UNPKG

@pulumi/gcp

Version:

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

756 lines • 28.4 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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}} * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: ConnectionProfileState, opts?: pulumi.CustomResourceOptions): 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: any): obj is ConnectionProfile; /** * Specifies required connection parameters, and the parameters required to create an AlloyDB destination cluster. * Structure is documented below. */ readonly alloydb: pulumi.Output<outputs.databasemigrationservice.ConnectionProfileAlloydb | undefined>; /** * Specifies required connection parameters, and, optionally, the parameters required to create a Cloud SQL destination database instance. * Structure is documented below. */ readonly cloudsql: pulumi.Output<outputs.databasemigrationservice.ConnectionProfileCloudsql | undefined>; /** * The ID of the connection profile. */ readonly connectionProfileId: pulumi.Output<string>; /** * Output only. The timestamp when the resource was created. A timestamp in RFC3339 UTC 'Zulu' format, accurate to nanoseconds. Example: '2014-10-02T15:01:23.045123456Z'. */ readonly createTime: pulumi.Output<string>; /** * The database provider. */ readonly dbprovider: pulumi.Output<string>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ readonly deletionPolicy: pulumi.Output<string>; /** * The connection profile display name. */ readonly displayName: pulumi.Output<string | undefined>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * Output only. The error details in case of state FAILED. * Structure is documented below. */ readonly errors: pulumi.Output<outputs.databasemigrationservice.ConnectionProfileError[]>; /** * The resource labels for connection profile to use to annotate any related underlying resources such as Compute Engine VMs. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The location where the connection profile should reside. */ readonly location: pulumi.Output<string | undefined>; /** * Specifies connection parameters required specifically for MySQL databases. * Structure is documented below. */ readonly mysql: pulumi.Output<outputs.databasemigrationservice.ConnectionProfileMysql | undefined>; /** * The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}. */ readonly name: pulumi.Output<string>; /** * Specifies connection parameters required specifically for Oracle databases. * Structure is documented below. */ readonly oracle: pulumi.Output<outputs.databasemigrationservice.ConnectionProfileOracle | undefined>; /** * Specifies connection parameters required specifically for PostgreSQL databases. * Structure is documented below. */ readonly postgresql: pulumi.Output<outputs.databasemigrationservice.ConnectionProfilePostgresql | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * The connection profile role. * Possible values are: `SOURCE`, `DESTINATION`. */ readonly role: pulumi.Output<string>; /** * The current connection profile state. */ readonly state: pulumi.Output<string>; /** * Create a ConnectionProfile 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: ConnectionProfileArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ConnectionProfile resources. */ export interface ConnectionProfileState { /** * Specifies required connection parameters, and the parameters required to create an AlloyDB destination cluster. * Structure is documented below. */ alloydb?: pulumi.Input<inputs.databasemigrationservice.ConnectionProfileAlloydb | undefined>; /** * Specifies required connection parameters, and, optionally, the parameters required to create a Cloud SQL destination database instance. * Structure is documented below. */ cloudsql?: pulumi.Input<inputs.databasemigrationservice.ConnectionProfileCloudsql | undefined>; /** * The ID of the connection profile. */ connectionProfileId?: pulumi.Input<string | undefined>; /** * Output only. The timestamp when the resource was created. A timestamp in RFC3339 UTC 'Zulu' format, accurate to nanoseconds. Example: '2014-10-02T15:01:23.045123456Z'. */ createTime?: pulumi.Input<string | undefined>; /** * The database provider. */ dbprovider?: pulumi.Input<string | undefined>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ deletionPolicy?: pulumi.Input<string | undefined>; /** * The connection profile display name. */ displayName?: pulumi.Input<string | undefined>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; } | undefined>; /** * Output only. The error details in case of state FAILED. * Structure is documented below. */ errors?: pulumi.Input<pulumi.Input<inputs.databasemigrationservice.ConnectionProfileError>[] | undefined>; /** * The resource labels for connection profile to use to annotate any related underlying resources such as Compute Engine VMs. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; } | undefined>; /** * The location where the connection profile should reside. */ location?: pulumi.Input<string | undefined>; /** * Specifies connection parameters required specifically for MySQL databases. * Structure is documented below. */ mysql?: pulumi.Input<inputs.databasemigrationservice.ConnectionProfileMysql | undefined>; /** * The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}. */ name?: pulumi.Input<string | undefined>; /** * Specifies connection parameters required specifically for Oracle databases. * Structure is documented below. */ oracle?: pulumi.Input<inputs.databasemigrationservice.ConnectionProfileOracle | undefined>; /** * Specifies connection parameters required specifically for PostgreSQL databases. * Structure is documented below. */ postgresql?: pulumi.Input<inputs.databasemigrationservice.ConnectionProfilePostgresql | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string | undefined>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; } | undefined>; /** * The connection profile role. * Possible values are: `SOURCE`, `DESTINATION`. */ role?: pulumi.Input<string | undefined>; /** * The current connection profile state. */ state?: pulumi.Input<string | undefined>; } /** * The set of arguments for constructing a ConnectionProfile resource. */ export interface ConnectionProfileArgs { /** * Specifies required connection parameters, and the parameters required to create an AlloyDB destination cluster. * Structure is documented below. */ alloydb?: pulumi.Input<inputs.databasemigrationservice.ConnectionProfileAlloydb | undefined>; /** * Specifies required connection parameters, and, optionally, the parameters required to create a Cloud SQL destination database instance. * Structure is documented below. */ cloudsql?: pulumi.Input<inputs.databasemigrationservice.ConnectionProfileCloudsql | undefined>; /** * The ID of the connection profile. */ connectionProfileId: pulumi.Input<string>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ deletionPolicy?: pulumi.Input<string | undefined>; /** * The connection profile display name. */ displayName?: pulumi.Input<string | undefined>; /** * The resource labels for connection profile to use to annotate any related underlying resources such as Compute Engine VMs. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; } | undefined>; /** * The location where the connection profile should reside. */ location?: pulumi.Input<string | undefined>; /** * Specifies connection parameters required specifically for MySQL databases. * Structure is documented below. */ mysql?: pulumi.Input<inputs.databasemigrationservice.ConnectionProfileMysql | undefined>; /** * Specifies connection parameters required specifically for Oracle databases. * Structure is documented below. */ oracle?: pulumi.Input<inputs.databasemigrationservice.ConnectionProfileOracle | undefined>; /** * Specifies connection parameters required specifically for PostgreSQL databases. * Structure is documented below. */ postgresql?: pulumi.Input<inputs.databasemigrationservice.ConnectionProfilePostgresql | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string | undefined>; /** * The connection profile role. * Possible values are: `SOURCE`, `DESTINATION`. */ role?: pulumi.Input<string | undefined>; } //# sourceMappingURL=connectionProfile.d.ts.map