I have GCP project which use bigquery schedules queries. Now I'm trying to import these scheduled queries in bigquery to terraform plan. But it gives me the following error message when i runt this command.
terraform plan -generate-config-out=generated.tf
│ Error: Cannot import non-existent remote object
│
│ While attempting to import an existing object to
│ "google_bigquery_data_transfer_config.default", the provider detected that no
│ object exists with the given id. Only pre-existing objects can be imported;
│ check that the id is correct and that it is associated with the provider's
│ configured region or endpoint, or use "terraform apply" to create a new
│ remote object for this resource.
To test it I'm trying to import one resource, my terraform import file contains one import block like this
import {
id = "scheduled_query_1"
to = google_bigquery_data_transfer_config.default
}
I'm using Terraform v1.6.6 & google provider v5.14.0 and refer this official documentation https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/bigquery_data_transfe...
I believe that the documentation is incorrect (name is not enough), or maybe I'm missing something. Please help to resolve this issue.
Regards
Solved! Go to Solution.
The error "Cannot import non-existent remote object" indicates that Terraform cannot find an existing BigQuery Data Transfer Config in your Google Cloud Project with the ID you've provided. This could be due to several reasons:
Causes
Troubleshooting Steps
Verify the ID:
projects/[PROJECT_ID]/locations/[LOCATION]/transferConfigs/[TRANSFER_CONFIG_ID]
.Check Region:
Review Permissions:
roles/bigquery.dataViewer
and roles/bigquery.transfers.viewer
.Full Resource Name in Import Command:
terraform import google_bigquery_data_transfer_config.default "projects/[PROJECT_ID]/locations/[LOCATION]/transferConfigs/[TRANSFER_CONFIG_ID]"
Example Workflow
Acquire the Correct ID:
id="projects/my-project/locations/us-central1/transferConfigs/my-transfer-config"
Prepare the Import Command: Use the terraform import
command with the full ID of the BigQuery Data Transfer Config:
terraform import google_bigquery_data_transfer_config.default "projects/my-project/locations/us-central1/transferConfigs/my-transfer-config"
Important Notes:
[PROJECT_ID]
, [LOCATION]
, and [TRANSFER_CONFIG_ID]
with your actual resource details.terraform import
command for importing resources into Terraform. The terraform plan
command is not used for importing.The error "Cannot import non-existent remote object" indicates that Terraform cannot find an existing BigQuery Data Transfer Config in your Google Cloud Project with the ID you've provided. This could be due to several reasons:
Causes
Troubleshooting Steps
Verify the ID:
projects/[PROJECT_ID]/locations/[LOCATION]/transferConfigs/[TRANSFER_CONFIG_ID]
.Check Region:
Review Permissions:
roles/bigquery.dataViewer
and roles/bigquery.transfers.viewer
.Full Resource Name in Import Command:
terraform import google_bigquery_data_transfer_config.default "projects/[PROJECT_ID]/locations/[LOCATION]/transferConfigs/[TRANSFER_CONFIG_ID]"
Example Workflow
Acquire the Correct ID:
id="projects/my-project/locations/us-central1/transferConfigs/my-transfer-config"
Prepare the Import Command: Use the terraform import
command with the full ID of the BigQuery Data Transfer Config:
terraform import google_bigquery_data_transfer_config.default "projects/my-project/locations/us-central1/transferConfigs/my-transfer-config"
Important Notes:
[PROJECT_ID]
, [LOCATION]
, and [TRANSFER_CONFIG_ID]
with your actual resource details.terraform import
command for importing resources into Terraform. The terraform plan
command is not used for importing.User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 |