From ddd9e01d980ad7a7b851ee1cc045b12ff05370f2 Mon Sep 17 00:00:00 2001 From: Thomas Poindessous Date: Wed, 17 Oct 2018 21:35:49 +0000 Subject: [PATCH 1/6] Create a link to storage_bucket_acl documentation (#2275) Create a link to storage_bucket_acl ressource documentation page. It's easier than scrolling and scrolling or copy text and search it on the page. Thank you ! --- website/docs/r/storage_bucket.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/storage_bucket.html.markdown b/website/docs/r/storage_bucket.html.markdown index 29b46fdfba1..548a38d9ce1 100644 --- a/website/docs/r/storage_bucket.html.markdown +++ b/website/docs/r/storage_bucket.html.markdown @@ -10,7 +10,7 @@ description: |- Creates a new bucket in Google cloud storage service (GCS). Once a bucket has been created, its location can't be changed. -[ACLs](https://cloud.google.com/storage/docs/access-control/lists) can be applied using the `google_storage_bucket_acl` resource. +[ACLs](https://cloud.google.com/storage/docs/access-control/lists) can be applied using the [`google_storage_bucket_acl` resource](/docs/providers/google/r/storage_bucket_acl.html). For more information see [the official documentation](https://cloud.google.com/storage/docs/overview) and From 86133b3316d4f10275a63aa085f27476e1e28c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adria=CC=81n=20Matellanes?= Date: Fri, 19 Oct 2018 14:45:17 +0200 Subject: [PATCH 2/6] Add timePartitioning.requirePartitionFilter field to google_bigquery_table resource --- google/resource_bigquery_table.go | 19 ++++++++++++++++++- google/resource_bigquery_table_test.go | 4 +++- website/docs/r/bigquery_table.html.markdown | 4 ++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/google/resource_bigquery_table.go b/google/resource_bigquery_table.go index 19dfc7c9800..a5aa09958e9 100644 --- a/google/resource_bigquery_table.go +++ b/google/resource_bigquery_table.go @@ -142,7 +142,7 @@ func resourceBigQueryTable() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{"DAY"}, false), }, - // Type: [Optional] The field used to determine how to create a time-based + // Field: [Optional] The field used to determine how to create a time-based // partition. If time-based partitioning is enabled without this value, the // table is partitioned based on the load time. "field": { @@ -150,6 +150,15 @@ func resourceBigQueryTable() *schema.Resource { Optional: true, ForceNew: true, }, + + // RequirePartitionFilter: [Optional] If set to true, queries over this table + // require a partition filter that can be used for partition elimination to be + // specified. + "require_partition_filter": { + Type: schema.TypeBool, + Optional: true, + //ForceNew: true, + }, }, }, }, @@ -436,6 +445,10 @@ func expandTimePartitioning(configured interface{}) *bigquery.TimePartitioning { tp.ExpirationMs = int64(v.(int)) } + if v, ok := raw["require_partition_filter"]; ok { + tp.RequirePartitionFilter = v.(bool) + } + return tp } @@ -450,6 +463,10 @@ func flattenTimePartitioning(tp *bigquery.TimePartitioning) []map[string]interfa result["expiration_ms"] = tp.ExpirationMs } + if tp.RequirePartitionFilter == true { + result["require_partition_filter"] = tp.RequirePartitionFilter + } + return []map[string]interface{}{result} } diff --git a/google/resource_bigquery_table_test.go b/google/resource_bigquery_table_test.go index 7f63543b36c..9303c28603e 100644 --- a/google/resource_bigquery_table_test.go +++ b/google/resource_bigquery_table_test.go @@ -52,6 +52,7 @@ func TestAccBigQueryTable_View(t *testing.T) { CheckDestroy: testAccCheckBigQueryTableDestroy, Steps: []resource.TestStep{ { + Config: testAccBigQueryTableWithView(datasetID, tableID), }, { @@ -122,7 +123,8 @@ resource "google_bigquery_table" "test" { time_partitioning { type = "DAY" - field = "ts" + field = "ts" + require_partition_filter = true } schema = < Date: Wed, 14 Nov 2018 10:08:42 +0100 Subject: [PATCH 3/6] Remove empty line Co-Authored-By: amatellanes --- google/resource_bigquery_table_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/google/resource_bigquery_table_test.go b/google/resource_bigquery_table_test.go index 9303c28603e..b225c5dec78 100644 --- a/google/resource_bigquery_table_test.go +++ b/google/resource_bigquery_table_test.go @@ -52,7 +52,6 @@ func TestAccBigQueryTable_View(t *testing.T) { CheckDestroy: testAccCheckBigQueryTableDestroy, Steps: []resource.TestStep{ { - Config: testAccBigQueryTableWithView(datasetID, tableID), }, { From ffb5547fee403e8071226c4ef0450eed9ddb86fd Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Wed, 14 Nov 2018 10:09:09 +0100 Subject: [PATCH 4/6] Fix indentation Co-Authored-By: amatellanes --- google/resource_bigquery_table_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/resource_bigquery_table_test.go b/google/resource_bigquery_table_test.go index b225c5dec78..dc0b909083d 100644 --- a/google/resource_bigquery_table_test.go +++ b/google/resource_bigquery_table_test.go @@ -123,7 +123,7 @@ resource "google_bigquery_table" "test" { time_partitioning { type = "DAY" field = "ts" - require_partition_filter = true + require_partition_filter = true } schema = < Date: Wed, 14 Nov 2018 10:09:25 +0100 Subject: [PATCH 5/6] Fix typo Co-Authored-By: amatellanes --- website/docs/r/bigquery_table.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/bigquery_table.html.markdown b/website/docs/r/bigquery_table.html.markdown index 809c9527508..9470589b872 100644 --- a/website/docs/r/bigquery_table.html.markdown +++ b/website/docs/r/bigquery_table.html.markdown @@ -88,7 +88,7 @@ The `time_partitioning` block supports: * `type` - (Required) The only type supported is DAY, which will generate one partition per day based on data loading time. -* `require_partition_filter` - (Optional) f set to true, queries over this table +* `require_partition_filter` - (Optional) If set to true, queries over this table require a partition filter that can be used for partition elimination to be specified. From 80533f72da50c64aaf8691f72feb435fcccb2ced Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Wed, 14 Nov 2018 10:09:42 +0100 Subject: [PATCH 6/6] Remove useless comment Co-Authored-By: amatellanes --- google/resource_bigquery_table.go | 1 - 1 file changed, 1 deletion(-) diff --git a/google/resource_bigquery_table.go b/google/resource_bigquery_table.go index a5aa09958e9..cc01a069bc6 100644 --- a/google/resource_bigquery_table.go +++ b/google/resource_bigquery_table.go @@ -157,7 +157,6 @@ func resourceBigQueryTable() *schema.Resource { "require_partition_filter": { Type: schema.TypeBool, Optional: true, - //ForceNew: true, }, }, },