mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-01 16:21:06 +00:00
Add defaultPartitionExpirationMs field to google_bigquery_dataset resource (#2287)
Add [`defaultPartitionExpirationMs`](https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets) to [`google_bigquery_dataset`](https://www.terraform.io/docs/providers/google/r/bigquery_dataset.html) resource.
This commit is contained in:
parent
77c757d1e0
commit
8543521b75
@ -75,6 +75,25 @@ func resourceBigQueryDataset() *schema.Resource {
|
||||
ValidateFunc: validation.StringInSlice([]string{"US", "EU", "asia-northeast1", "europe-west2", "australia-southeast1"}, false),
|
||||
},
|
||||
|
||||
// defaultPartitionExpirationMs: [Optional] The default partition
|
||||
// expiration for all partitioned tables in the dataset, in
|
||||
// milliseconds. Once this property is set, all newly-created
|
||||
// partitioned tables in the dataset will have an expirationMs
|
||||
// property in the timePartitioning settings set to this value, and
|
||||
// changing the value will only affect new tables, not existing ones.
|
||||
// The storage in a partition will have an expiration time of its
|
||||
// partition time plus this value. Setting this property overrides the
|
||||
// use of defaultTableExpirationMs for partitioned tables: only one of
|
||||
// defaultTableExpirationMs and defaultPartitionExpirationMs will be used
|
||||
// for any new partitioned table. If you provide an explicit
|
||||
// timePartitioning.expirationMs when creating or updating a partitioned
|
||||
// table, that value takes precedence over the default partition expiration
|
||||
// time indicated by this property.
|
||||
"default_partition_expiration_ms": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
},
|
||||
|
||||
// DefaultTableExpirationMs: [Optional] The default lifetime of all
|
||||
// tables in the dataset, in milliseconds. The minimum value is 3600000
|
||||
// milliseconds (one hour). Once this property is set, all newly-created
|
||||
@ -223,6 +242,10 @@ func resourceDataset(d *schema.ResourceData, meta interface{}) (*bigquery.Datase
|
||||
dataset.Location = v.(string)
|
||||
}
|
||||
|
||||
if v, ok := d.GetOk("default_partition_expiration_ms"); ok {
|
||||
dataset.DefaultPartitionExpirationMs = int64(v.(int))
|
||||
}
|
||||
|
||||
if v, ok := d.GetOk("default_table_expiration_ms"); ok {
|
||||
dataset.DefaultTableExpirationMs = int64(v.(int))
|
||||
}
|
||||
@ -337,6 +360,7 @@ func resourceBigQueryDatasetRead(d *schema.ResourceData, meta interface{}) error
|
||||
d.Set("creation_time", res.CreationTime)
|
||||
d.Set("last_modified_time", res.LastModifiedTime)
|
||||
d.Set("dataset_id", res.DatasetReference.DatasetId)
|
||||
d.Set("default_partition_expiration_ms", res.DefaultPartitionExpirationMs)
|
||||
d.Set("default_table_expiration_ms", res.DefaultTableExpirationMs)
|
||||
|
||||
// Older Tables in BigQuery have no Location set in the API response. This may be an issue when importing
|
||||
|
@ -111,6 +111,7 @@ resource "google_bigquery_dataset" "test" {
|
||||
friendly_name = "foo"
|
||||
description = "This is a foo description"
|
||||
location = "EU"
|
||||
default_partition_expiration_ms = 3600000
|
||||
default_table_expiration_ms = 3600000
|
||||
|
||||
labels {
|
||||
@ -127,6 +128,7 @@ resource "google_bigquery_dataset" "test" {
|
||||
friendly_name = "bar"
|
||||
description = "This is a bar description"
|
||||
location = "EU"
|
||||
default_partition_expiration_ms = 7200000
|
||||
default_table_expiration_ms = 7200000
|
||||
|
||||
labels {
|
||||
|
@ -66,6 +66,21 @@ The following arguments are supported:
|
||||
The default value is multi-regional location `US`.
|
||||
Changing this forces a new resource to be created.
|
||||
|
||||
* `default_partition_expiration_ms` - (Optional) The default partition expiration
|
||||
for all partitioned tables in the dataset, in milliseconds.
|
||||
|
||||
Once this property is set, all newly-created partitioned tables in the dataset
|
||||
will have an expirationMs property in the timePartitioning settings set to this
|
||||
value, and changing the value will only affect new tables, not existing ones.
|
||||
The storage in a partition will have an expiration time of its partition time
|
||||
plus this value. Setting this property overrides the use of
|
||||
`defaultTableExpirationMs` for partitioned tables: only one of
|
||||
`defaultTableExpirationMs` and `defaultPartitionExpirationMs` will be used for
|
||||
any new partitioned table. If you provide an explicit
|
||||
`timePartitioning.expirationMs` when creating or updating a partitioned table,
|
||||
that value takes precedence over the default partition expiration time
|
||||
indicated by this property.
|
||||
|
||||
* `default_table_expiration_ms` - (Optional) The default lifetime of all
|
||||
tables in the dataset, in milliseconds. The minimum value is 3600000
|
||||
milliseconds (one hour).
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user