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
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"
resource "google_bigquery_connection" "connection" {
provider = google
friendly_name = ""
description = ""
cloud_sql {
instance_id = google_sql_database_instance.instance.connection_name
Parameters
The following arguments are supported:
cloud_sql
- (Required) Cloud SQL properties. Structure is documented below.
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 areDATABASE_TYPE_UNSPECIFIED
,POSTGRES
, andMYSQL
.
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 connectiondescription
- (Optional) A descriptive description for the connectionproject
- (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 formatprojects/[[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:
- API documentation
- How-to Guides
- Cloud SQL federated queries
Warning: All arguments including
cloud_sql.credential.password
will be stored in the raw state as plain-text. Read more about sensitive data in state.
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.