google_bigquery_connection

A connection allows BigQuery connections to external data sources..

To get more information about Connection, see:

Open in Cloud Shell

Example Usage - Bigquery Connection Cloud Resource

resource "google_bigquery_connection" "connection" {
   connection_id = "my-connection"
   location      = "US"
   friendly_name = "πŸ‘‹"
   description   = "a riveting description"
   cloud_resource {}
}
Open in Cloud Shell

Example Usage - Bigquery Connection Basic

resource "google_sql_database_instance" "instance" {
    name             = "my-database-instance"
    database_version = "POSTGRES_11"
    region           = "us-central1"
    settings {
        tier = "db-f1-micro"
    }

    deletion_protection  = "true"
}

resource "google_sql_database" "db" {
    instance = google_sql_database_instance.instance.name
    name     = "db"
}

resource "random_password" "pwd" {
    length = 16
    special = false
}

resource "google_sql_user" "user" {
    name = "user"
    instance = google_sql_database_instance.instance.name
    password = random_password.pwd.result
}

resource "google_bigquery_connection" "connection" {
    friendly_name = "πŸ‘‹"
    description   = "a riveting description"
    location      = "US"
    cloud_sql {
        instance_id = google_sql_database_instance.instance.connection_name
        database    = google_sql_database.db.name
        type        = "POSTGRES"
        credential {
          username = google_sql_user.user.name
          password = google_sql_user.user.password
        }
    }
}
Open in Cloud Shell

Example Usage - Bigquery Connection Full

resource "google_sql_database_instance" "instance" {
    name             = "my-database-instance"
    database_version = "POSTGRES_11"
    region           = "us-central1"
    settings {
        tier = "db-f1-micro"
    }

    deletion_protection  = "true"
}

resource "google_sql_database" "db" {
    instance = google_sql_database_instance.instance.name
    name     = "db"
}

resource "random_password" "pwd" {
    length = 16
    special = false
}

resource "google_sql_user" "user" {
    name = "user"
    instance = google_sql_database_instance.instance.name
    password = random_password.pwd.result
}

resource "google_bigquery_connection" "connection" {
    connection_id = "my-connection"
    location      = "US"
    friendly_name = "πŸ‘‹"
    description   = "a riveting description"
    cloud_sql {
        instance_id = google_sql_database_instance.instance.connection_name
        database    = google_sql_database.db.name
        type        = "POSTGRES"
        credential {
          username = google_sql_user.user.name
          password = google_sql_user.user.password
        }
    }
}
Open in Cloud Shell

Example Usage - Bigquery Connection Aws

resource "google_bigquery_connection" "connection" {
   connection_id = "my-connection"
   location      = "aws-us-east-1"
   friendly_name = "πŸ‘‹"
   description   = "a riveting description"
   aws { 
      access_role {
         iam_role_id =  "arn:aws:iam::999999999999:role/omnirole"
      }
   }
}
Open in Cloud Shell

Example Usage - Bigquery Connection Azure

resource "google_bigquery_connection" "connection" {
   connection_id = "my-connection"
   location      = "azure-eastus2"
   friendly_name = "πŸ‘‹"
   description   = "a riveting description"
   azure {
      customer_tenant_id = "customer-tenant-id"
      federated_application_client_id = "b43eeeee-eeee-eeee-eeee-a480155501ce"
   }
}
Open in Cloud Shell

Example Usage - Bigquery Connection Cloudspanner

resource "google_bigquery_connection" "connection" {
   connection_id = "my-connection"
   location      = "US"
   friendly_name = "πŸ‘‹"
   description   = "a riveting description"
   cloud_spanner { 
      database = "projects/project/instances/instance/databases/database"
      database_role = "database_role"
   }
}
Open in Cloud Shell

Example Usage - Bigquery Connection Cloudspanner Databoost

resource "google_bigquery_connection" "connection" {
   connection_id = "my-connection"
   location      = "US"
   friendly_name = "πŸ‘‹"
   description   = "a riveting description"
   cloud_spanner { 
      database        = "projects/project/instances/instance/databases/database"
      use_parallelism = true
      use_data_boost  = true
      max_parallelism = 100
   }
}
Open in Cloud Shell

Example Usage - Bigquery Connection Spark

resource "google_bigquery_connection" "connection" {
   connection_id = "my-connection"
   location      = "US"
   friendly_name = "πŸ‘‹"
   description   = "a riveting description"
   spark {
      spark_history_server_config {
         dataproc_cluster = google_dataproc_cluster.basic.id
      }
   }
}

resource "google_dataproc_cluster" "basic" {
   name   = "my-connection"
   region = "us-central1"

   cluster_config {
     # Keep the costs down with smallest config we can get away with
     software_config {
       override_properties = {
         "dataproc:dataproc.allow.zero.workers" = "true"
       }
     }

     master_config {
       num_instances = 1
       machine_type  = "e2-standard-2"
       disk_config {
         boot_disk_size_gb = 35
       }
     }
   }   
 }

Argument Reference

The following arguments are supported:


The cloud_sql block supports:

The credential block supports:

The aws block supports:

The access_role block supports:

The azure block supports:

The cloud_spanner block supports:

The cloud_resource block supports:

The spark block supports:

The metastore_service_config block supports:

The spark_history_server_config block supports:

Attributes Reference

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

Timeouts

This resource provides the following Timeouts configuration options:

Import

Connection can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import Connection using one of the formats above. For example:

import {
  id = "projects/{{project}}/locations/{{location}}/connections/{{connection_id}}"
  to = google_bigquery_connection.default
}

When using the terraform import command, Connection can be imported using one of the formats above. For example:

$ 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.