Skip to content

googleBigqueryConnection

A connection allows BigQuery connections to external data sources..

To get more information about Connection, see:

\~> Warning: All arguments including cloudSqlCredentialPassword will be stored in the raw state as plain-text. Read more about sensitive data in state.

Example Usage - Bigquery Connection Cloud Resource

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.bigqueryConnection.BigqueryConnection(this, "connection", {
  cloud_resource: [{}],
  connection_id: "my-connection",
  description: "a riveting description",
  friendly_name: "\uD83D\uDC4B",
  location: "US",
});

Example Usage - Bigquery Connection Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
import * as random from "./.gen/providers/random";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google, random.
For a more precise conversion please use the --provider flag in convert.*/
const googleSqlDatabaseInstanceInstance =
  new google.sqlDatabaseInstance.SqlDatabaseInstance(this, "instance", {
    database_version: "POSTGRES_11",
    deletion_protection: "true",
    name: "my-database-instance",
    region: "us-central1",
    settings: [
      {
        tier: "db-f1-micro",
      },
    ],
  });
const randomPasswordPwd = new random.password.Password(this, "pwd", {
  length: 16,
  special: false,
});
const googleSqlDatabaseDb = new google.sqlDatabase.SqlDatabase(this, "db", {
  instance: googleSqlDatabaseInstanceInstance.name,
  name: "db",
});
const googleSqlUserUser = new google.sqlUser.SqlUser(this, "user", {
  instance: googleSqlDatabaseInstanceInstance.name,
  name: "user",
  password: randomPasswordPwd.result,
});
new google.bigqueryConnection.BigqueryConnection(this, "connection", {
  cloud_sql: [
    {
      credential: [
        {
          password: googleSqlUserUser.password,
          username: googleSqlUserUser.name,
        },
      ],
      database: googleSqlDatabaseDb.name,
      instance_id: googleSqlDatabaseInstanceInstance.connectionName,
      type: "POSTGRES",
    },
  ],
  description: "a riveting description",
  friendly_name: "\uD83D\uDC4B",
  location: "US",
});

Example Usage - Bigquery Connection Full

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
import * as random from "./.gen/providers/random";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google, random.
For a more precise conversion please use the --provider flag in convert.*/
const googleSqlDatabaseInstanceInstance =
  new google.sqlDatabaseInstance.SqlDatabaseInstance(this, "instance", {
    database_version: "POSTGRES_11",
    deletion_protection: "true",
    name: "my-database-instance",
    region: "us-central1",
    settings: [
      {
        tier: "db-f1-micro",
      },
    ],
  });
const randomPasswordPwd = new random.password.Password(this, "pwd", {
  length: 16,
  special: false,
});
const googleSqlDatabaseDb = new google.sqlDatabase.SqlDatabase(this, "db", {
  instance: googleSqlDatabaseInstanceInstance.name,
  name: "db",
});
const googleSqlUserUser = new google.sqlUser.SqlUser(this, "user", {
  instance: googleSqlDatabaseInstanceInstance.name,
  name: "user",
  password: randomPasswordPwd.result,
});
new google.bigqueryConnection.BigqueryConnection(this, "connection", {
  cloud_sql: [
    {
      credential: [
        {
          password: googleSqlUserUser.password,
          username: googleSqlUserUser.name,
        },
      ],
      database: googleSqlDatabaseDb.name,
      instance_id: googleSqlDatabaseInstanceInstance.connectionName,
      type: "POSTGRES",
    },
  ],
  connection_id: "my-connection",
  description: "a riveting description",
  friendly_name: "\uD83D\uDC4B",
  location: "US",
});

Example Usage - Bigquery Connection Aws

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.bigqueryConnection.BigqueryConnection(this, "connection", {
  aws: [
    {
      access_role: [
        {
          iam_role_id: "arn:aws:iam::999999999999:role/omnirole",
        },
      ],
    },
  ],
  connection_id: "my-connection",
  description: "a riveting description",
  friendly_name: "\uD83D\uDC4B",
  location: "aws-us-east-1",
});

Example Usage - Bigquery Connection Azure

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.bigqueryConnection.BigqueryConnection(this, "connection", {
  azure: [
    {
      customer_tenant_id: "customer-tenant-id",
      federated_application_client_id: "b43eeeee-eeee-eeee-eeee-a480155501ce",
    },
  ],
  connection_id: "my-connection",
  description: "a riveting description",
  friendly_name: "\uD83D\uDC4B",
  location: "azure-eastus2",
});

Example Usage - Bigquery Connection Cloudspanner

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.bigqueryConnection.BigqueryConnection(this, "connection", {
  cloud_spanner: [
    {
      database: "projects/project/instances/instance/databases/database",
    },
  ],
  connection_id: "my-connection",
  description: "a riveting description",
  friendly_name: "\uD83D\uDC4B",
  location: "US",
});

Argument Reference

The following arguments are supported:


  • connectionId - (Optional) Optional connection id that should be assigned to the created connection.

  • location - (Optional) 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

  • friendlyName - (Optional) A descriptive name for the connection

  • description - (Optional) A descriptive description for the connection

  • cloudSql - (Optional) Connection properties specific to the Cloud SQL. Structure is documented below.

  • aws - (Optional) Connection properties specific to Amazon Web Services. Structure is documented below.

  • azure - (Optional) Container for connection properties specific to Azure. Structure is documented below.

  • cloudSpanner - (Optional) Connection properties specific to Cloud Spanner Structure is documented below.

  • cloudResource - (Optional) Container for connection properties for delegation of access to GCP resources. Structure is documented below.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The cloudSql block supports:

  • instanceId - (Required) Cloud SQL instance ID in the form project:location:instance.

  • database - (Required) Database name.

  • credential - (Required) Cloud SQL properties. Structure is documented below.

  • type - (Required) Type of the Cloud SQL database. Possible values are databaseTypeUnspecified, postgres, and mysql.

  • serviceAccountId - (Output) When the connection is used in the context of an operation in BigQuery, this service account will serve as the identity being used for connecting to the CloudSQL instance specified in this connection.

The credential block supports:

  • username - (Required) Username for database.

  • password - (Required) Password for database. Note: This property is sensitive and will not be displayed in the plan.

The aws block supports:

  • accessRole - (Required) Authentication using Google owned service account to assume into customer's AWS IAM Role. Structure is documented below.

The accessRole block supports:

  • iamRoleId - (Required) The user’s AWS IAM Role that trusts the Google-owned AWS IAM user Connection.

  • identity - (Output) A unique Google-owned and Google-generated identity for the Connection. This identity will be used to access the user's AWS IAM Role.

The azure block supports:

  • application - (Output) The name of the Azure Active Directory Application.

  • clientId - (Output) The client id of the Azure Active Directory Application.

  • objectId - (Output) The object id of the Azure Active Directory Application.

  • customerTenantId - (Required) The id of customer's directory that host the data.

  • federatedApplicationClientId - (Optional) The Azure Application (client) ID where the federated credentials will be hosted.

  • redirectUri - (Output) The URL user will be redirected to after granting consent during connection setup.

  • identity - (Output) A unique Google-owned and Google-generated identity for the Connection. This identity will be used to access the user's Azure Active Directory Application.

The cloudSpanner block supports:

  • database - (Required) Cloud Spanner database in the form `project/instance/database'

  • useParallelism - (Optional) If parallelism should be used when reading from Cloud Spanner

  • useServerlessAnalytics - (Optional) If the serverless analytics service should be used to read data from Cloud Spanner. useParallelism must be set when using serverless analytics

The cloudResource block supports:

  • serviceAccountId - (Output) The account ID of the service created for the purpose of this connection.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/locations/{{location}}/connections/{{connectionId}}

  • name - The resource name of the connection in the form of: "projects/{project_id}/locations/{location_id}/connections/{connectionId}"

  • hasCredential - True if the connection has credential assigned.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Connection can be imported using any of these accepted formats:

$ terraform import google_bigquery_connection.default projects/{{project}}/locations/{{location}}/connections/{{connection_id}}
$ terraform import google_bigquery_connection.default {{project}}/{{location}}/{{connection_id}}
$ terraform import google_bigquery_connection.default {{location}}/{{connection_id}}

User Project Overrides

This resource supports User Project Overrides.