...

Text file src/github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/BigQuery-BigQueryJob-bigquery_job_extract/main.tf

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/generated/samples/BigQuery-BigQueryJob-bigquery_job_extract

     1/**
     2 * Copyright 2022 Google LLC
     3 *
     4 * Licensed under the Apache License, Version 2.0 (the "License");
     5 * you may not use this file except in compliance with the License.
     6 * You may obtain a copy of the License at
     7 *
     8 *      http://www.apache.org/licenses/LICENSE-2.0
     9 *
    10 * Unless required by applicable law or agreed to in writing, software
    11 * distributed under the License is distributed on an "AS IS" BASIS,
    12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13 * See the License for the specific language governing permissions and
    14 * limitations under the License.
    15 */
    16
    17```hcl
    18resource "google_bigquery_table" "source-one" {
    19  deletion_protection = false
    20  dataset_id = google_bigquery_dataset.source-one.dataset_id
    21  table_id   = "job_extract_table"
    22
    23  schema = <<EOF
    24[
    25  {
    26    "name": "name",
    27    "type": "STRING",
    28    "mode": "NULLABLE"
    29  },
    30  {
    31    "name": "post_abbr",
    32    "type": "STRING",
    33    "mode": "NULLABLE"
    34  },
    35  {
    36    "name": "date",
    37    "type": "DATE",
    38    "mode": "NULLABLE"
    39  }
    40]
    41EOF
    42}
    43
    44resource "google_bigquery_dataset" "source-one" {
    45  dataset_id    = "job_extract_dataset"
    46  friendly_name = "test"
    47  description   = "This is a test description"
    48  location      = "US"
    49}
    50
    51resource "google_storage_bucket" "dest" {
    52  name          = "job_extract_bucket"
    53  location      = "US"
    54  force_destroy = true
    55}
    56
    57resource "google_bigquery_job" "job" {
    58  job_id     = "job_extract"
    59
    60  extract {
    61    destination_uris = ["${google_storage_bucket.dest.url}/extract"]
    62
    63    source_table {
    64      project_id = google_bigquery_table.source-one.project
    65      dataset_id = google_bigquery_table.source-one.dataset_id
    66      table_id   = google_bigquery_table.source-one.table_id
    67    }
    68
    69    destination_format = "NEWLINE_DELIMITED_JSON"
    70    compression = "GZIP"
    71  }
    72}
    73```

View as plain text