From 91ef3252a31e8d9e54b9548b511483940ce0a2d4 Mon Sep 17 00:00:00 2001 From: Gleb Kanterov Date: Tue, 2 Feb 2021 18:53:01 +0100 Subject: [PATCH 1/2] Add `status` field to `google_bigquery_job` fixes https://github.com/hashicorp/terraform-provider-google/issues/8357 --- mmv1/products/bigquery/api.yaml | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/mmv1/products/bigquery/api.yaml b/mmv1/products/bigquery/api.yaml index 73d2852243ec..f32f9e8f8014 100644 --- a/mmv1/products/bigquery/api.yaml +++ b/mmv1/products/bigquery/api.yaml @@ -978,6 +978,50 @@ objects: description: | The geographic location of the job. The default value is US. default_value: 'US' + - !ruby/object:Api::Type::NestedObject + name: 'status' + output: true + description: | + The status of this job. Examine this value when polling an asynchronous job to see if the job is complete. + properties: + - !ruby/object:Api::Type::NestedObject + name: 'errorResult' + output: true + description: | + Final error result of the job. If present, indicates that the job has completed and was unsuccessful. + properties: + - !ruby/object:Api::Type::String + name: 'reason' + description: A short error code that summarizes the error. + - !ruby/object:Api::Type::String + name: 'location' + description: Specifies where the error occurred, if present. + - !ruby/object:Api::Type::String + name: 'message' + description: A human-readable description of the error. + - !ruby/object:Api::Type::Array + name: 'errors' + output: true + description: | + The first errors encountered during the running of the job. The final message + includes the number of errors that caused the process to stop. Errors here do + not necessarily mean that the job has not completed or was unsuccessful. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'reason' + description: A short error code that summarizes the error. + - !ruby/object:Api::Type::String + name: 'location' + description: Specifies where the error occurred, if present. + - !ruby/object:Api::Type::String + name: 'message' + description: A human-readable description of the error. + - !ruby/object:Api::Type::String + name: 'state' + output: true + description: | + Running state of the job. Valid states include 'PENDING', 'RUNNING', and 'DONE'. - !ruby/object:Api::Resource name: 'Table' kind: 'bigquery#table' From 93f9b5548ddd39d9f9ecc5c6c769a532fcb525b3 Mon Sep 17 00:00:00 2001 From: Gleb Kanterov Date: Wed, 3 Feb 2021 19:56:36 +0100 Subject: [PATCH 2/2] fixup! ignore `.status.0.state` in tests --- mmv1/products/bigquery/terraform.yaml | 8 ++++++++ .../terraform/tests/resource_bigquery_job_test.go | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mmv1/products/bigquery/terraform.yaml b/mmv1/products/bigquery/terraform.yaml index cbfd3853ea3e..1d258861dde9 100644 --- a/mmv1/products/bigquery/terraform.yaml +++ b/mmv1/products/bigquery/terraform.yaml @@ -146,6 +146,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides account_name: "bqowner" ignore_read_extra: - "etag" + - "status.0.state" - !ruby/object:Provider::Terraform::Examples name: "bigquery_job_query_table_reference" primary_resource_id: "job" @@ -156,6 +157,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides - "etag" - "query.0.default_dataset.0.dataset_id" - "query.0.destination_table.0.table_id" + - "status.0.state" - !ruby/object:Provider::Terraform::Examples name: "bigquery_job_load" primary_resource_id: "job" @@ -163,6 +165,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides job_id: "job_load" ignore_read_extra: - "etag" + - "status.0.state" - !ruby/object:Provider::Terraform::Examples name: "bigquery_job_load_table_reference" primary_resource_id: "job" @@ -171,6 +174,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides ignore_read_extra: - "etag" - "load.0.destination_table.0.table_id" + - "status.0.state" skip_docs: true # there are a lot of examples for this resource, so omitting some that are similar to others - !ruby/object:Provider::Terraform::Examples name: "bigquery_job_copy" @@ -184,6 +188,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides project: :PROJECT_NAME ignore_read_extra: - "etag" + - "status.0.state" - !ruby/object:Provider::Terraform::Examples name: "bigquery_job_copy_table_reference" primary_resource_id: "job" @@ -199,6 +204,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides - "copy.0.destination_table.0.table_id" - "copy.0.source_tables.0.table_id" - "copy.0.source_tables.1.table_id" + - "status.0.state" skip_docs: true # there are a lot of examples for this resource, so omitting some that are similar to others - !ruby/object:Provider::Terraform::Examples name: "bigquery_job_extract" @@ -208,6 +214,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides account_name: "bqowner" ignore_read_extra: - "etag" + - "status.0.state" - !ruby/object:Provider::Terraform::Examples name: "bigquery_job_extract_table_reference" primary_resource_id: "job" @@ -217,6 +224,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides ignore_read_extra: - "etag" - "extract.0.source_table.0.table_id" + - "status.0.state" skip_docs: true # there are a lot of examples for this resource, so omitting some that are similar to others properties: id: !ruby/object:Overrides::Terraform::PropertyOverride diff --git a/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go b/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go index 1ad5ac45607a..8bd98bd1a15a 100644 --- a/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go +++ b/mmv1/third_party/terraform/tests/resource_bigquery_job_test.go @@ -33,7 +33,7 @@ func TestAccBigQueryJob_withLocation(t *testing.T) { ImportStateId: importID, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"etag"}, + ImportStateVerifyIgnore: []string{"etag", "status.0.state"}, }, }, })