From 152beeaa81fef434c859c15e73f4bba687fee4d4 Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Fri, 14 Aug 2020 16:51:58 +0000 Subject: [PATCH] Add archive class to gcs (#3867) Signed-off-by: Modular Magician --- .changelog/3867.txt | 3 +++ google/resource_storage_bucket.go | 6 +++--- google/resource_storage_bucket_object.go | 2 +- google/resource_storage_bucket_test.go | 9 +++++++++ website/docs/d/storage_bucket_object.html.markdown | 2 +- website/docs/r/storage_bucket.html.markdown | 6 +++--- website/docs/r/storage_bucket_object.html.markdown | 2 +- 7 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 .changelog/3867.txt diff --git a/.changelog/3867.txt b/.changelog/3867.txt new file mode 100644 index 00000000000..50aac0e472c --- /dev/null +++ b/.changelog/3867.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +storage: added `ARCHIVE` as an accepted class for `google_storage_bucket` and `google_storage_bucket_object` +``` diff --git a/google/resource_storage_bucket.go b/google/resource_storage_bucket.go index 8302a7d388d..88cbca743da 100644 --- a/google/resource_storage_bucket.go +++ b/google/resource_storage_bucket.go @@ -114,7 +114,7 @@ func resourceStorageBucket() *schema.Resource { Type: schema.TypeString, Optional: true, Default: "STANDARD", - Description: `The Storage Class of the new bucket. Supported values include: STANDARD, MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE.`, + Description: `The Storage Class of the new bucket. Supported values include: STANDARD, MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE.`, }, "lifecycle_rule": { @@ -139,7 +139,7 @@ func resourceStorageBucket() *schema.Resource { "storage_class": { Type: schema.TypeString, Optional: true, - Description: `The target Storage Class of objects affected by this Lifecycle Rule. Supported values include: MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE.`, + Description: `The target Storage Class of objects affected by this Lifecycle Rule. Supported values include: MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE.`, }, }, }, @@ -181,7 +181,7 @@ func resourceStorageBucket() *schema.Resource { Optional: true, MinItems: 1, Elem: &schema.Schema{Type: schema.TypeString}, - Description: `Storage Class of objects to satisfy this condition. Supported values include: MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, DURABLE_REDUCED_AVAILABILITY.`, + Description: `Storage Class of objects to satisfy this condition. Supported values include: MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE, STANDARD, DURABLE_REDUCED_AVAILABILITY.`, }, "num_newer_versions": { Type: schema.TypeInt, diff --git a/google/resource_storage_bucket_object.go b/google/resource_storage_bucket_object.go index bb58cc30a54..c0059c0d0b8 100644 --- a/google/resource_storage_bucket_object.go +++ b/google/resource_storage_bucket_object.go @@ -148,7 +148,7 @@ func resourceStorageBucketObject() *schema.Resource { Optional: true, ForceNew: true, Computed: true, - Description: `The StorageClass of the new bucket object. Supported values include: MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE. If not provided, this defaults to the bucket's default storage class or to a standard class.`, + Description: `The StorageClass of the new bucket object. Supported values include: MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE. If not provided, this defaults to the bucket's default storage class or to a standard class.`, }, "metadata": { diff --git a/google/resource_storage_bucket_test.go b/google/resource_storage_bucket_test.go index 74ad514dfe3..9edbe888eb9 100644 --- a/google/resource_storage_bucket_test.go +++ b/google/resource_storage_bucket_test.go @@ -1269,6 +1269,15 @@ resource "google_storage_bucket" "bucket" { num_newer_versions = 10 } } + lifecycle_rule { + action { + type = "SetStorageClass" + storage_class = "ARCHIVE" + } + condition { + with_state = "ARCHIVED" + } + } } `, bucketName) } diff --git a/website/docs/d/storage_bucket_object.html.markdown b/website/docs/d/storage_bucket_object.html.markdown index 689abebebe4..e4a02c2b1d6 100644 --- a/website/docs/d/storage_bucket_object.html.markdown +++ b/website/docs/d/storage_bucket_object.html.markdown @@ -57,7 +57,7 @@ The following attributes are exported: * `self_link` - (Computed) A url reference to this object. * `storage_class` - (Computed) The [StorageClass](https://cloud.google.com/storage/docs/storage-classes) of the new bucket object. - Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`. If not provided, this defaults to the bucket's default + Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`. If not provided, this defaults to the bucket's default storage class or to a [standard](https://cloud.google.com/storage/docs/storage-classes#standard) class. * `media_link` - (Computed) A url reference to download this object. diff --git a/website/docs/r/storage_bucket.html.markdown b/website/docs/r/storage_bucket.html.markdown index e06763162ce..3dd2b538743 100644 --- a/website/docs/r/storage_bucket.html.markdown +++ b/website/docs/r/storage_bucket.html.markdown @@ -81,7 +81,7 @@ The following arguments are supported: * `project` - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used. -* `storage_class` - (Optional, Default: 'STANDARD') The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `STANDARD`, `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`. +* `storage_class` - (Optional, Default: 'STANDARD') The [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of the new bucket. Supported values include: `STANDARD`, `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`. * `lifecycle_rule` - (Optional) The bucket's [Lifecycle Rules](https://cloud.google.com/storage/docs/lifecycle#configuration) configuration. Multiple blocks of this type are permitted. Structure is documented below. @@ -113,7 +113,7 @@ The `action` block supports: * `type` - The type of the action of this Lifecycle Rule. Supported values include: `Delete` and `SetStorageClass`. -* `storage_class` - (Required if action type is `SetStorageClass`) The target [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of objects affected by this Lifecycle Rule. Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`. +* `storage_class` - (Required if action type is `SetStorageClass`) The target [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of objects affected by this Lifecycle Rule. Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`. The `condition` block supports the following elements, and requires at least one to be defined. If you specify multiple conditions in a rule, an object has to match all of the conditions for the action to be taken: @@ -123,7 +123,7 @@ The `condition` block supports the following elements, and requires at least one * `with_state` - (Optional) Match to live and/or archived objects. Unversioned buckets have only live objects. Supported values include: `"LIVE"`, `"ARCHIVED"`, `"ANY"`. -* `matches_storage_class` - (Optional) [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of objects to satisfy this condition. Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `STANDARD`, `DURABLE_REDUCED_AVAILABILITY`. +* `matches_storage_class` - (Optional) [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of objects to satisfy this condition. Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`, `STANDARD`, `DURABLE_REDUCED_AVAILABILITY`. * `num_newer_versions` - (Optional) Relevant only for versioned objects. The number of newer versions of an object to satisfy this condition. diff --git a/website/docs/r/storage_bucket_object.html.markdown b/website/docs/r/storage_bucket_object.html.markdown index a982bd34ee8..4eab59f8bad 100644 --- a/website/docs/r/storage_bucket_object.html.markdown +++ b/website/docs/r/storage_bucket_object.html.markdown @@ -60,7 +60,7 @@ One of the following is required: * `content_type` - (Optional) [Content-Type](https://tools.ietf.org/html/rfc7231#section-3.1.1.5) of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8". * `storage_class` - (Optional) The [StorageClass](https://cloud.google.com/storage/docs/storage-classes) of the new bucket object. - Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`. If not provided, this defaults to the bucket's default + Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `ARCHIVE`. If not provided, this defaults to the bucket's default storage class or to a [standard](https://cloud.google.com/storage/docs/storage-classes#standard) class. ## Attributes Reference