Skip to content

googleBigqueryDataTransferConfig

Represents a data transfer configuration. A transfer configuration contains all metadata needed to perform a data transfer.

To get more information about Config, see:

\~> Warning: All arguments including sensitiveParamsSecretAccessKey will be stored in the raw state as plain-text. Read more about sensitive data in state.

Example Usage - Bigquerydatatransfer Config Scheduled Query

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const dataGoogleProjectProject = new google.dataGoogleProject.DataGoogleProject(
  this,
  "project",
  {}
);
const googleProjectIamMemberPermissions =
  new google.projectIamMember.ProjectIamMember(this, "permissions", {
    member: `serviceAccount:service-\${${dataGoogleProjectProject.number}}@gcp-sa-bigquerydatatransfer.iam.gserviceaccount.com`,
    project: dataGoogleProjectProject.projectId,
    role: "roles/iam.serviceAccountTokenCreator",
  });
const googleBigqueryDatasetMyDataset =
  new google.bigqueryDataset.BigqueryDataset(this, "my_dataset", {
    dataset_id: "my_dataset",
    depends_on: [`\${${googleProjectIamMemberPermissions.fqn}}`],
    description: "bar",
    friendly_name: "foo",
    location: "asia-northeast1",
  });
new google.bigqueryDataTransferConfig.BigqueryDataTransferConfig(
  this,
  "query_config",
  {
    data_source_id: "scheduled_query",
    depends_on: [`\${${googleProjectIamMemberPermissions.fqn}}`],
    destination_dataset_id: googleBigqueryDatasetMyDataset.datasetId,
    display_name: "my-query",
    location: "asia-northeast1",
    params: [
      {
        destination_table_name_template: "my_table",
        query: "SELECT name FROM tabl WHERE x = 'y'",
        write_disposition: "WRITE_APPEND",
      },
    ],
    schedule: "first sunday of quarter 00:00",
  }
);

Argument Reference

The following arguments are supported:

  • displayName - (Required) The user specified display name for the transfer config.

  • dataSourceId - (Required) The data source id. Cannot be changed once the transfer config is created.

  • params - (Required) Parameters specific to each data source. For more information see the bq tab in the 'Setting up a data transfer' section for each data source. For example the parameters for Cloud Storage transfers are listed here: https://cloud.google.com/bigquery-transfer/docs/cloud-storage-transfer#bq NOTE : If you are attempting to update a parameter that cannot be updated (due to api limitations) please force recreation of the resource.


  • destinationDatasetId - (Optional) The BigQuery target dataset id.

  • schedule - (Optional) Data transfer schedule. If the data source does not support a custom schedule, this should be empty. If it is empty, the default value for the data source will be used. The specified times are in UTC. Examples of valid format: 1st,3rd monday of month 15:30, every wed,fri of jan, jun 13:15, and first sunday of quarter 00:00. See more explanation about the format here: https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format NOTE: the granularity should be at least 8 hours, or less frequent.

  • scheduleOptions - (Optional) Options customizing the data transfer schedule. Structure is documented below.

  • emailPreferences - (Optional) Email notifications will be sent according to these preferences to the email address of the user who owns this transfer config. Structure is documented below.

  • notificationPubsubTopic - (Optional) Pub/Sub topic where notifications will be sent after transfer runs associated with this transfer config finish.

  • dataRefreshWindowDays - (Optional) The number of days to look back to automatically refresh the data. For example, if dataRefreshWindowDays = 10, then every day BigQuery reingests data for [today-10, today-1], rather than ingesting data for just [today-1]. Only valid if the data source supports the feature. Set the value to 0 to use the default value.

  • disabled - (Optional) When set to true, no runs are scheduled for a given transfer.

  • sensitiveParams - (Optional) Different parameters are configured primarily using the the params field on this resource. This block contains the parameters which contain secrets or passwords so that they can be marked sensitive and hidden from plan output. The name of the field, eg: secret_access_key, will be the key in the params map in the api request. Credentials may not be specified in both locations and will cause an error. Changing from one location to a different credential configuration in the config will require an apply to update state. Structure is documented below.

  • location - (Optional) The geographic location where the transfer config should reside. Examples: US, EU, asia-northeast1. The default value is US.

  • serviceAccountName - (Optional) Service account email. If this field is set, transfer config will be created with this service account credentials. It requires that requesting user calling this API has permissions to act as this service account.

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

The scheduleOptions block supports:

  • disableAutoScheduling - (Optional) If true, automatic scheduling of data transfer runs for this configuration will be disabled. The runs can be started on ad-hoc basis using transferConfigs.startManualRuns API. When automatic scheduling is disabled, the TransferConfig.schedule field will be ignored.

  • startTime - (Optional) Specifies time to start scheduling transfer runs. The first run will be scheduled at or after the start time according to a recurrence pattern defined in the schedule string. The start time can be changed at any moment. The time when a data transfer can be triggered manually is not limited by this option.

  • endTime - (Optional) Defines time to stop scheduling transfer runs. A transfer run cannot be scheduled at or after the end time. The end time can be changed at any moment. The time when a data transfer can be triggered manually is not limited by this option.

The emailPreferences block supports:

  • enableFailureEmail - (Required) If true, email notifications will be sent on transfer run failures.

The sensitiveParams block supports:

  • secretAccessKey - (Required) The Secret Access Key of the AWS account transferring data from. Note: This property is sensitive and will not be displayed in the plan.

Attributes Reference

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

  • id - an identifier for the resource with format {{name}}

  • name - The resource name of the transfer config. Transfer config names have the form projects/{projectId}/locations/{location}/transferConfigs/{configId}. Where configId is usually a uuid, but this is not required. The name is ignored when creating a transfer config.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Config can be imported using any of these accepted formats:

$ terraform import google_bigquery_data_transfer_config.default {{name}}

User Project Overrides

This resource supports User Project Overrides.