Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google_bigquery_job - required paramter missing (project_reference) #19834

Open
ralbritton-utah opened this issue Oct 11, 2024 · 0 comments
Open
Labels
bug forward/review In review; remove label to forward service/bigquery

Comments

@ralbritton-utah
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Terraform vX.X.X
on

  • provider registry.terraform.io/hashicorp/google vX.X.X
  • provider registry.terraform.io/hashicorp/google-beta vX.X.X

Affected Resource(s)

google_bigquery_job

Terraform Configuration

Terraform v1.9.6
on windows_amd64

provider registry.terraform.io/hasicorp/google v 6.6.0

Debug Output

google_bigquery_job.job: Creating...

│ Error: Error creating Job: googleapi: Error 400: Required parameter is missing: project_reference, required

│ with google_bigquery_job.job,
│ on main.tf line 1, in resource "google_bigquery_job" "job":
│ 1: resource "google_bigquery_job" "job" {

Expected Behavior

job should be created

Actual Behavior

Error received

Steps to reproduce

create main.tf:

resource "google_bigquery_job" "job" {
  project = var.project
  job_id  = var.job_id
  labels  = var.job_labels
  query {
    query = file("sql/${var.query["file_path"]}")
    destination_table {
      dataset_id = var.destination_table["dataset_id"]
      table_id   = var.destination_table["table_id"]
    }
    write_disposition = var.query["write_disposition"]
  }
}

Define Variables:

variable "project" {
  description = "Project where the dataset and table are created"
}

variable "job_id" {
  description = "Required.The ID of the job."
  type        = string
}

variable "query" {
  description = "Required. SQL query text to execute along with additional parameters."
  type        = map(string)
}

variable "job_labels" {
  description = "A mapping of labels to assign to the job"
  type        = map(string)
}

variable "destination_table" {
  description = "destination of the query results"
  type        = map(string)
}

Created a tfvars file:


Important Factoids

project = "my-gcp-project"
job_id="my_job_id"

query = {
file_path ="query.txt"
write_disposition="WRITE_TRUNCATE"
}

destination_table = {
dataset_id = "my_dataset"
table_id = "my_table"
}

job_labels = {
env = "dev"
}

run `terraform plan -var-file="my_var_file.tfvars"

The plan runs successfully.
Then run `terraform apply -auto-approve -var-file="my_var_file.tfvars"
It begins creating the job and fails with the error

Error: Error creating Job: googleapi: Error 400: Required parameter is missing: project_reference, required
│
│   with google_bigquery_job.job,
│   on main.tf line 1, in resource "google_bigquery_job" "job":
│    1: resource "google_bigquery_job" "job" {

There is no project_reference parameter in the terraform documentation. A project is provided.

References

No response

@github-actions github-actions bot added forward/review In review; remove label to forward service/bigquery labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug forward/review In review; remove label to forward service/bigquery
Projects
None yet
Development

No branches or pull requests

1 participant