Google BigQuery Table

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

code-icon

Fix issues in your cloud & app configurations

Test for misconfigurations of this resource in your cloud.

get-started-button

Terraform Example (google_bigquery_table)

Creates a table resource in a dataset for Google BigQuery. For more information see the official documentation and API. -> Note: On newer versions of the provider, you must explicitly set deletion_protection=false (and run terraform apply to write the field to state) in order to destroy an instance. It is recommended to not set this field (or set it to true) until you're ready to destroy.

Parameters

  • clustering optional - list / string
    • Specifies column names to use for data clustering. Up to four top-level columns are allowed, and should be specified in descending priority order.

  • creation_time requiredcomputed - number
    • The time when this table was created, in milliseconds since the epoch.

  • dataset_id required - string
    • The dataset ID to create the table in. Changing this forces a new resource to be created.

  • deletion_protection optional - bool
    • Whether or not to allow Terraform to destroy the instance. Unless this field is set to false in Terraform state, a terraform destroy or terraform apply that would delete the instance will fail.

  • description optional - string
    • The field description.

  • etag requiredcomputed - string
    • A hash of the resource.

  • expiration_time optionalcomputed - number
    • The time when this table expires, in milliseconds since the epoch. If not present, the table will persist indefinitely. Expired tables will be deleted and their storage reclaimed.

  • friendly_name optional - string
    • A descriptive name for the table.

  • id optionalcomputed - string
  • labels optional - map / string
    • A mapping of labels to assign to the resource.

  • last_modified_time requiredcomputed - number
    • The time when this table was last modified, in milliseconds since the epoch.

  • location requiredcomputed - string
    • The geographic location where the table resides. This value is inherited from the dataset.

  • num_bytes requiredcomputed - number
    • The geographic location where the table resides. This value is inherited from the dataset.

  • num_long_term_bytes requiredcomputed - number
    • The number of bytes in the table that are considered "long-term storage".

  • num_rows requiredcomputed - number
    • The number of rows of data in this table, excluding any data in the streaming buffer.

  • project optionalcomputed - string
    • The ID of the project in which the resource belongs.

  • schema optionalcomputed - string
    • A JSON schema for the table.

  • self_link requiredcomputed - string
    • The URI of the created resource.

  • table_id required - string
    • A unique ID for the resource. Changing this forces a new resource to be created.

  • type requiredcomputed - string
    • Describes the table type.

Example Usage (from GitHub)

github-iconShriyut/samestate-terraform
resource "google_bigquery_table" "table" {
  for_each = local.tables
  dataset_id = google_bigquery_dataset.dataset.dataset_id
  friendly_name = each.key
  table_id = each.key
  labels = each.value["labels"]
github-iconyurikrupnik/mussia8
resource "google_bigquery_table" "default2" {
  dataset_id          = google_bigquery_dataset.dataset.dataset_id
  table_id            = "agents_logs"
  deletion_protection = false
  labels = {
    env = "agents"
github-iconyurikrupnik/mussia8
resource "google_bigquery_table" "be_logs_table" {
  dataset_id          = google_bigquery_dataset.dataset.dataset_id
  table_id            = "bar"
  deletion_protection = false
  time_partitioning {
    type = "MONTH"

Frequently asked questions

What is Google BigQuery Table?

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

Where can I find the example code for the Google BigQuery Table?

For Terraform, the Shriyut/samestate-terraform, yurikrupnik/mussia8 and yurikrupnik/mussia8 source code examples are useful. See the Terraform Example section for further details.