Open antoinedeschenes opened 9 months ago
@antoinedeschenes it works for me. Can you try similar?
resource "google_bigquery_dataset" "main" {
dataset_id = 1234
}
import {
id = "projects/myprojects/datasets/imydataset"
to = google_bigquery_dataset.main
}
resource "google_bigquery_dataset" "main" {
dataset_id = 1234
}
import {
id = "myprojects/mydataset"
to = google_bigquery_dataset.main
}
@edwardmedia don't define a resource in the terraform file, terraform is supposed to generate it with the following command: terraform plan -generate-config-out=generated.tf
import {
id = "myprojects/mydataset"
to = google_bigquery_dataset.main
}
terraform init && terraform plan -generate-config-out=generated.tf
generated.tf
is created successfully, but doesn't pass validation if the dataset's default_table_expiration_ms
is set to 0
/disabled@antoinedeschenes can you share the debug log for your import?
@edwardmedia there's the log: https://gist.github.com/antoinedeschenes/7b380ed9c0a38b86b8ebd369bc8edcb5
My issue is that the generated terraform contains
default_table_expiration_ms = 0
in the resource attributes. It's a valid value for the API, but not the validation code. The input validation code expects null
and translates it to a 0
in the resource state
Yes, I can repro it and see the error.
Questionable function is here
Looking here https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#Dataset
it looks like 0
is a valid value
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
https://gist.github.com/antoinedeschenes/7b380ed9c0a38b86b8ebd369bc8edcb5
Panic Output
Expected Behavior
Plan command should exit successfully
Actual Behavior
Plan crashes with
Steps to Reproduce
imports.tf
terraform file only.terraform init
terraform plan -generate-config-out=generated.tf
Important Factoids
null
. The validateDefaultTableExpirationMs should probably ignore a0
value as it's a valid value in the BigQuery APIReferences
b/319825217