Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Glacier Deep Archive storage class #8109

Merged
merged 2 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aws/resource_aws_s3_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ func resourceAwsS3Bucket() *schema.Resource {
s3.StorageClassOnezoneIa,
s3.StorageClassIntelligentTiering,
s3.StorageClassGlacier,
s3.StorageClassDeepArchive,
}, false),
},
"replica_kms_key_id": {
Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_s3_bucket_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func resourceAwsS3BucketObject() *schema.Resource {
s3.ObjectStorageClassStandardIa,
s3.ObjectStorageClassOnezoneIa,
s3.ObjectStorageClassIntelligentTiering,
s3.ObjectStorageClassDeepArchive,
}, false),
},

Expand Down
8 changes: 8 additions & 0 deletions aws/resource_aws_s3_bucket_object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,14 @@ func TestAccAWSS3BucketObject_storageClass(t *testing.T) {
testAccCheckAWSS3BucketObjectStorageClass(resourceName, "INTELLIGENT_TIERING"),
),
},
{
Config: testAccAWSS3BucketObjectConfig_storageClass(rInt, "DEEP_ARCHIVE"),
Check: resource.ComposeTestCheckFunc(
// Can't GetObject on an object in DEEP_ARCHIVE without restoring it.
resource.TestCheckResourceAttr(resourceName, "storage_class", "DEEP_ARCHIVE"),
testAccCheckAWSS3BucketObjectStorageClass(resourceName, "DEEP_ARCHIVE"),
),
},
},
})
}
Expand Down
11 changes: 11 additions & 0 deletions aws/resource_aws_s3_bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,12 @@ func TestAccAWSS3Bucket_Lifecycle(t *testing.T) {
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.962205413.days", "120"),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.962205413.storage_class", "GLACIER"),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.1571523406.date", ""),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.1571523406.days", "210"),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.1571523406.storage_class", "DEEP_ARCHIVE"),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.1.id", "id2"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -2474,6 +2480,11 @@ resource "aws_s3_bucket" "bucket" {
days = 120
storage_class = "GLACIER"
}

transition {
days = 210
storage_class = "DEEP_ARCHIVE"
}
}
lifecycle_rule {
id = "id2"
Expand Down
1 change: 1 addition & 0 deletions aws/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@ func validateS3BucketLifecycleTransitionStorageClass() schema.SchemaValidateFunc
s3.TransitionStorageClassStandardIa,
s3.TransitionStorageClassOnezoneIa,
s3.TransitionStorageClassIntelligentTiering,
s3.StorageClassDeepArchive,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: Looks like there is an AWS Go SDK constant to match the others in this function: TransitionStorageClassDeepArchive -- will adjust this on merge so we can release this today.

}, false)
}

Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/s3_bucket.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ The `transition` object supports the following

* `date` (Optional) Specifies the date after which you want the corresponding action to take effect.
* `days` (Optional) Specifies the number of days after object creation when the specific rule action takes effect.
* `storage_class` (Required) Specifies the Amazon S3 storage class to which you want the object to transition. Can be `ONEZONE_IA`, `STANDARD_IA`, `INTELLIGENT_TIERING`, or `GLACIER`.
* `storage_class` (Required) Specifies the Amazon S3 storage class to which you want the object to transition. Can be `ONEZONE_IA`, `STANDARD_IA`, `INTELLIGENT_TIERING`, `GLACIER`, or `DEEP_ARCHIVE`.

The `noncurrent_version_expiration` object supports the following

Expand All @@ -397,7 +397,7 @@ The `noncurrent_version_expiration` object supports the following
The `noncurrent_version_transition` object supports the following

* `days` (Required) Specifies the number of days an object is noncurrent object versions expire.
* `storage_class` (Required) Specifies the Amazon S3 storage class to which you want the noncurrent versions object to transition. Can be `ONEZONE_IA`, `STANDARD_IA`, `INTELLIGENT_TIERING`, or `GLACIER`.
* `storage_class` (Required) Specifies the Amazon S3 storage class to which you want the noncurrent versions object to transition. Can be `ONEZONE_IA`, `STANDARD_IA`, `INTELLIGENT_TIERING`, `GLACIER`, or `DEEP_ARCHIVE`.

The `replication_configuration` object supports the following:

Expand All @@ -424,7 +424,7 @@ Replication configuration V1 supports filtering based on only the `prefix` attri
The `destination` object supports the following:

* `bucket` - (Required) The ARN of the S3 bucket where you want Amazon S3 to store replicas of the object identified by the rule.
* `storage_class` - (Optional) The class of storage used to store the object. Can be `STANDARD`, `REDUCED_REDUNDANCY`, `STANDARD_IA`, `ONEZONE_IA`, `INTELLIGENT_TIERING`, or `GLACIER`.
* `storage_class` - (Optional) The class of storage used to store the object. Can be `STANDARD`, `REDUCED_REDUNDANCY`, `STANDARD_IA`, `ONEZONE_IA`, `INTELLIGENT_TIERING`, `GLACIER`, or `DEEP_ARCHIVE`.
* `replica_kms_key_id` - (Optional) Destination KMS encryption key ARN for SSE-KMS replication. Must be used in conjunction with
`sse_kms_encrypted_objects` source selection criteria.
* `access_control_translation` - (Optional) Specifies the overrides to use for object owners on replication. Must be used in conjunction with `account_id` owner override configuration.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/s3_bucket_object.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The following arguments are supported:
* `content_type` - (Optional) A standard MIME type describing the format of the object data, e.g. application/octet-stream. All Valid MIME Types are valid for this input.
* `website_redirect` - (Optional) Specifies a target URL for [website redirect](http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html).
* `storage_class` - (Optional) Specifies the desired [Storage Class](http://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html)
for the object. Can be either "`STANDARD`", "`REDUCED_REDUNDANCY`", "`ONEZONE_IA`", "`INTELLIGENT_TIERING`", "`GLACIER`", or "`STANDARD_IA`". Defaults to "`STANDARD`".
for the object. Can be either "`STANDARD`", "`REDUCED_REDUNDANCY`", "`ONEZONE_IA`", "`INTELLIGENT_TIERING`", "`GLACIER`", "`DEEP_ARCHIVE`", or "`STANDARD_IA`". Defaults to "`STANDARD`".
* `etag` - (Optional) Used to trigger updates. The only meaningful value is `${filemd5("path/to/file")}` (Terraform 0.11.12 or later) or `${md5(file("path/to/file"))}` (Terraform 0.11.11 or earlier).
This attribute is not compatible with KMS encryption, `kms_key_id` or `server_side_encryption = "aws:kms"`.
* `server_side_encryption` - (Optional) Specifies server-side encryption of the object in S3. Valid values are "`AES256`" and "`aws:kms`".
Expand Down