UNPKG

@pulumi/gcp

Version:

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

529 lines (528 loc) • 18.1 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * A connection allows BigQuery connections to external data sources.. * * To get more information about Connection, see: * * * [API documentation](https://cloud.google.com/bigquery/docs/reference/bigqueryconnection/rest/v1/projects.locations.connections/create) * * How-to Guides * * [Cloud SQL federated queries](https://cloud.google.com/bigquery/docs/cloud-sql-federated-queries) * * ## Example Usage * * ### Bigquery Connection Cloud Resource * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const connection = new gcp.bigquery.Connection("connection", { * connectionId: "my-connection", * location: "US", * friendlyName: "👋", * description: "a riveting description", * cloudResource: {}, * }); * ``` * ### Bigquery Connection Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as random from "@pulumi/random"; * * const instance = new gcp.sql.DatabaseInstance("instance", { * name: "my-database-instance", * databaseVersion: "POSTGRES_11", * region: "us-central1", * settings: { * tier: "db-f1-micro", * }, * deletionProtection: true, * }); * const db = new gcp.sql.Database("db", { * instance: instance.name, * name: "db", * }); * const pwd = new random.RandomPassword("pwd", { * length: 16, * special: false, * }); * const user = new gcp.sql.User("user", { * name: "user", * instance: instance.name, * password: pwd.result, * }); * const connection = new gcp.bigquery.Connection("connection", { * friendlyName: "👋", * description: "a riveting description", * location: "US", * cloudSql: { * instanceId: instance.connectionName, * database: db.name, * type: "POSTGRES", * credential: { * username: user.name, * password: user.password, * }, * }, * }); * ``` * ### Bigquery Connection Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as random from "@pulumi/random"; * * const instance = new gcp.sql.DatabaseInstance("instance", { * name: "my-database-instance", * databaseVersion: "POSTGRES_11", * region: "us-central1", * settings: { * tier: "db-f1-micro", * }, * deletionProtection: true, * }); * const db = new gcp.sql.Database("db", { * instance: instance.name, * name: "db", * }); * const pwd = new random.RandomPassword("pwd", { * length: 16, * special: false, * }); * const user = new gcp.sql.User("user", { * name: "user", * instance: instance.name, * password: pwd.result, * }); * const connection = new gcp.bigquery.Connection("connection", { * connectionId: "my-connection", * location: "US", * friendlyName: "👋", * description: "a riveting description", * cloudSql: { * instanceId: instance.connectionName, * database: db.name, * type: "POSTGRES", * credential: { * username: user.name, * password: user.password, * }, * }, * }); * ``` * ### Bigquery Connection Aws * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const connection = new gcp.bigquery.Connection("connection", { * connectionId: "my-connection", * location: "aws-us-east-1", * friendlyName: "👋", * description: "a riveting description", * aws: { * accessRole: { * iamRoleId: "arn:aws:iam::999999999999:role/omnirole", * }, * }, * }); * ``` * ### Bigquery Connection Azure * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const connection = new gcp.bigquery.Connection("connection", { * connectionId: "my-connection", * location: "azure-eastus2", * friendlyName: "👋", * description: "a riveting description", * azure: { * customerTenantId: "customer-tenant-id", * federatedApplicationClientId: "b43eeeee-eeee-eeee-eeee-a480155501ce", * }, * }); * ``` * ### Bigquery Connection Cloudspanner * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const connection = new gcp.bigquery.Connection("connection", { * connectionId: "my-connection", * location: "US", * friendlyName: "👋", * description: "a riveting description", * cloudSpanner: { * database: "projects/project/instances/instance/databases/database", * databaseRole: "database_role", * }, * }); * ``` * ### Bigquery Connection Cloudspanner Databoost * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const connection = new gcp.bigquery.Connection("connection", { * connectionId: "my-connection", * location: "US", * friendlyName: "👋", * description: "a riveting description", * cloudSpanner: { * database: "projects/project/instances/instance/databases/database", * useParallelism: true, * useDataBoost: true, * maxParallelism: 100, * }, * }); * ``` * ### Bigquery Connection Spark * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const basic = new gcp.dataproc.Cluster("basic", { * name: "my-connection", * region: "us-central1", * clusterConfig: { * softwareConfig: { * overrideProperties: { * "dataproc:dataproc.allow.zero.workers": "true", * }, * }, * masterConfig: { * numInstances: 1, * machineType: "e2-standard-2", * diskConfig: { * bootDiskSizeGb: 35, * }, * }, * }, * }); * const connection = new gcp.bigquery.Connection("connection", { * connectionId: "my-connection", * location: "US", * friendlyName: "👋", * description: "a riveting description", * spark: { * sparkHistoryServerConfig: { * dataprocCluster: basic.id, * }, * }, * }); * ``` * ### Bigquery Connection Sql With Cmek * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.sql.DatabaseInstance("instance", { * name: "my-database-instance", * region: "us-central1", * databaseVersion: "POSTGRES_11", * settings: { * tier: "db-f1-micro", * }, * deletionProtection: true, * }); * const db = new gcp.sql.Database("db", { * instance: instance.name, * name: "db", * }); * const user = new gcp.sql.User("user", { * name: "user", * instance: instance.name, * password: "tf-test-my-password_15222", * }); * const bq_connection_cmek = new gcp.bigquery.Connection("bq-connection-cmek", { * friendlyName: "👋", * description: "a riveting description", * location: "US", * kmsKeyName: "projects/project/locations/us-central1/keyRings/us-central1/cryptoKeys/bq-key", * cloudSql: { * instanceId: instance.connectionName, * database: db.name, * type: "POSTGRES", * credential: { * username: user.name, * password: user.password, * }, * }, * }); * ``` * * ## Import * * Connection can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/connections/{{connection_id}}` * * * `{{project}}/{{location}}/{{connection_id}}` * * * `{{location}}/{{connection_id}}` * * When using the `pulumi import` command, Connection can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:bigquery/connection:Connection default projects/{{project}}/locations/{{location}}/connections/{{connection_id}} * ``` * * ```sh * $ pulumi import gcp:bigquery/connection:Connection default {{project}}/{{location}}/{{connection_id}} * ``` * * ```sh * $ pulumi import gcp:bigquery/connection:Connection default {{location}}/{{connection_id}} * ``` */ export declare class Connection extends pulumi.CustomResource { /** * Get an existing Connection 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?: ConnectionState, opts?: pulumi.CustomResourceOptions): Connection; /** * Returns true if the given object is an instance of Connection. 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 Connection; /** * Connection properties specific to Amazon Web Services. * Structure is documented below. */ readonly aws: pulumi.Output<outputs.bigquery.ConnectionAws | undefined>; /** * Container for connection properties specific to Azure. * Structure is documented below. */ readonly azure: pulumi.Output<outputs.bigquery.ConnectionAzure | undefined>; /** * Container for connection properties for delegation of access to GCP resources. * Structure is documented below. */ readonly cloudResource: pulumi.Output<outputs.bigquery.ConnectionCloudResource | undefined>; /** * Connection properties specific to Cloud Spanner * Structure is documented below. */ readonly cloudSpanner: pulumi.Output<outputs.bigquery.ConnectionCloudSpanner | undefined>; /** * Connection properties specific to the Cloud SQL. * Structure is documented below. */ readonly cloudSql: pulumi.Output<outputs.bigquery.ConnectionCloudSql | undefined>; /** * Optional connection id that should be assigned to the created connection. */ readonly connectionId: pulumi.Output<string>; /** * A descriptive description for the connection */ readonly description: pulumi.Output<string | undefined>; /** * A descriptive name for the connection */ readonly friendlyName: pulumi.Output<string | undefined>; /** * True if the connection has credential assigned. */ readonly hasCredential: pulumi.Output<boolean>; /** * Optional. The Cloud KMS key that is used for encryption. * Example: projects/[kmsProjectId]/locations/[region]/keyRings/[keyRegion]/cryptoKeys/[key] */ readonly kmsKeyName: pulumi.Output<string | undefined>; /** * The geographic location where the connection should reside. * Cloud SQL instance must be in the same location as the connection * with following exceptions: Cloud SQL us-central1 maps to BigQuery US, Cloud SQL europe-west1 maps to BigQuery EU. * Examples: US, EU, asia-northeast1, us-central1, europe-west1. * Spanner Connections same as spanner region * AWS allowed regions are aws-us-east-1 * Azure allowed regions are azure-eastus2 */ readonly location: pulumi.Output<string | undefined>; /** * The resource name of the connection in the form of: * "projects/{project_id}/locations/{location_id}/connections/{connectionId}" */ readonly name: pulumi.Output<string>; /** * 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>; /** * Container for connection properties to execute stored procedures for Apache Spark. resources. * Structure is documented below. */ readonly spark: pulumi.Output<outputs.bigquery.ConnectionSpark | undefined>; /** * Create a Connection 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?: ConnectionArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Connection resources. */ export interface ConnectionState { /** * Connection properties specific to Amazon Web Services. * Structure is documented below. */ aws?: pulumi.Input<inputs.bigquery.ConnectionAws>; /** * Container for connection properties specific to Azure. * Structure is documented below. */ azure?: pulumi.Input<inputs.bigquery.ConnectionAzure>; /** * Container for connection properties for delegation of access to GCP resources. * Structure is documented below. */ cloudResource?: pulumi.Input<inputs.bigquery.ConnectionCloudResource>; /** * Connection properties specific to Cloud Spanner * Structure is documented below. */ cloudSpanner?: pulumi.Input<inputs.bigquery.ConnectionCloudSpanner>; /** * Connection properties specific to the Cloud SQL. * Structure is documented below. */ cloudSql?: pulumi.Input<inputs.bigquery.ConnectionCloudSql>; /** * Optional connection id that should be assigned to the created connection. */ connectionId?: pulumi.Input<string>; /** * A descriptive description for the connection */ description?: pulumi.Input<string>; /** * A descriptive name for the connection */ friendlyName?: pulumi.Input<string>; /** * True if the connection has credential assigned. */ hasCredential?: pulumi.Input<boolean>; /** * Optional. The Cloud KMS key that is used for encryption. * Example: projects/[kmsProjectId]/locations/[region]/keyRings/[keyRegion]/cryptoKeys/[key] */ kmsKeyName?: pulumi.Input<string>; /** * The geographic location where the connection should reside. * Cloud SQL instance must be in the same location as the connection * with following exceptions: Cloud SQL us-central1 maps to BigQuery US, Cloud SQL europe-west1 maps to BigQuery EU. * Examples: US, EU, asia-northeast1, us-central1, europe-west1. * Spanner Connections same as spanner region * AWS allowed regions are aws-us-east-1 * Azure allowed regions are azure-eastus2 */ location?: pulumi.Input<string>; /** * The resource name of the connection in the form of: * "projects/{project_id}/locations/{location_id}/connections/{connectionId}" */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * Container for connection properties to execute stored procedures for Apache Spark. resources. * Structure is documented below. */ spark?: pulumi.Input<inputs.bigquery.ConnectionSpark>; } /** * The set of arguments for constructing a Connection resource. */ export interface ConnectionArgs { /** * Connection properties specific to Amazon Web Services. * Structure is documented below. */ aws?: pulumi.Input<inputs.bigquery.ConnectionAws>; /** * Container for connection properties specific to Azure. * Structure is documented below. */ azure?: pulumi.Input<inputs.bigquery.ConnectionAzure>; /** * Container for connection properties for delegation of access to GCP resources. * Structure is documented below. */ cloudResource?: pulumi.Input<inputs.bigquery.ConnectionCloudResource>; /** * Connection properties specific to Cloud Spanner * Structure is documented below. */ cloudSpanner?: pulumi.Input<inputs.bigquery.ConnectionCloudSpanner>; /** * Connection properties specific to the Cloud SQL. * Structure is documented below. */ cloudSql?: pulumi.Input<inputs.bigquery.ConnectionCloudSql>; /** * Optional connection id that should be assigned to the created connection. */ connectionId?: pulumi.Input<string>; /** * A descriptive description for the connection */ description?: pulumi.Input<string>; /** * A descriptive name for the connection */ friendlyName?: pulumi.Input<string>; /** * Optional. The Cloud KMS key that is used for encryption. * Example: projects/[kmsProjectId]/locations/[region]/keyRings/[keyRegion]/cryptoKeys/[key] */ kmsKeyName?: pulumi.Input<string>; /** * The geographic location where the connection should reside. * Cloud SQL instance must be in the same location as the connection * with following exceptions: Cloud SQL us-central1 maps to BigQuery US, Cloud SQL europe-west1 maps to BigQuery EU. * Examples: US, EU, asia-northeast1, us-central1, europe-west1. * Spanner Connections same as spanner region * AWS allowed regions are aws-us-east-1 * Azure allowed regions are azure-eastus2 */ location?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * Container for connection properties to execute stored procedures for Apache Spark. resources. * Structure is documented below. */ spark?: pulumi.Input<inputs.bigquery.ConnectionSpark>; }