Google BigQuery Connection Bigquery Connection

This page shows how to write Terraform for BigQuery Connection Bigquery Connection and write them securely.

google_bigquery_connection (Terraform)

The Bigquery Connection in BigQuery Connection can be configured in Terraform with the resource name google_bigquery_connection. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub

bigquery.tf#L8
resource "google_bigquery_connection" "connection" {
  provider      = google-beta
  connection_id = "bq_cloud_sql_connection"
  friendly_name = "cloud-sql-connection"
  description   = "A Cloud SQL database connection"

bqconnection.tf#L31
resource "google_bigquery_connection" "connection" {
    provider      = google
    friendly_name = ""
    description   = ""
    cloud_sql {
        instance_id = google_sql_database_instance.instance.connection_name

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The following arguments are supported:

The cloud_sql block supports:

  • instance_id - (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 DATABASE_TYPE_UNSPECIFIED, POSTGRES, and MYSQL.

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.


  • connection_id - (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. The default value is US.

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

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

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

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/[[connection_id]]

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

  • has_credential - True if the connection has credential assigned.

Explanation in Terraform Registry

A connection allows BigQuery connections to external data sources..

Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources. To get more information about Connection, see:

Frequently asked questions

What is Google BigQuery Connection Bigquery Connection?

Google BigQuery Connection Bigquery Connection is a resource for BigQuery Connection of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google BigQuery Connection Bigquery Connection?

For Terraform, the jeremyyeo/dbt-sandcastles and Aniki-lee/GCP source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.