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 ONEZONE_IA for S3 #4287

Merged
merged 2 commits into from
Apr 20, 2018
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 @@ -381,6 +381,7 @@ func resourceAwsS3Bucket() *schema.Resource {
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
s3.StorageClassStandard,
s3.StorageClassOnezoneIa,
s3.StorageClassStandardIa,
s3.StorageClassReducedRedundancy,
}, false),
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 @@ -106,6 +106,7 @@ func resourceAwsS3BucketObject() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{
s3.StorageClassStandard,
s3.StorageClassReducedRedundancy,
s3.StorageClassOnezoneIa,
s3.StorageClassStandardIa,
}, false),
},
Expand Down
18 changes: 15 additions & 3 deletions aws/resource_aws_s3_bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,11 +636,17 @@ func TestAccAWSS3Bucket_Lifecycle(t *testing.T) {
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.2000431762.storage_class", "STANDARD_IA"),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.6450812.date", ""),
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.3008443917.date", ""),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.6450812.days", "60"),
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.3008443917.days", "60"),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.6450812.storage_class", "GLACIER"),
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.3008443917.storage_class", "ONEZONE_IA"),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.2476382906.date", ""),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.2476382906.days", "90"),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.0.transition.2476382906.storage_class", "GLACIER"),
resource.TestCheckResourceAttr(
"aws_s3_bucket.bucket", "lifecycle_rule.1.id", "id2"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -1707,8 +1713,14 @@ resource "aws_s3_bucket" "bucket" {
days = 30
storage_class = "STANDARD_IA"
}

transition {
days = 60
storage_class = "ONEZONE_IA"
}

transition {
days = 90
storage_class = "GLACIER"
}
}
Expand Down
1 change: 1 addition & 0 deletions aws/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ func validateS3BucketLifecycleTimestamp(v interface{}, k string) (ws []string, e

func validateS3BucketLifecycleStorageClass() schema.SchemaValidateFunc {
return validation.StringInSlice([]string{
s3.TransitionStorageClassOnezoneIa,
s3.TransitionStorageClassStandardIa,
s3.TransitionStorageClassGlacier,
}, false)
Expand Down
9 changes: 7 additions & 2 deletions website/docs/r/s3_bucket.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ resource "aws_s3_bucket" "bucket" {
"autoclean" = "true"
}

transition {
days = 15
storage_class = "ONEZONE_IA"
}

transition {
days = 30
storage_class = "STANDARD_IA"
Expand Down Expand Up @@ -385,7 +390,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 `STANDARD_IA` 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`, or `GLACIER`.

The `noncurrent_version_expiration` object supports the following

Expand All @@ -394,7 +399,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 `STANDARD_IA` 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`, or `GLACIER`.

The `replication_configuration` object supports the following:

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 @@ -79,7 +79,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`", or "`STANDARD_IA`". Defaults to "`STANDARD`".
for the object. Can be either "`STANDARD`", "`REDUCED_REDUNDANCY`", "`ONEZONE_IA`", or "`STANDARD_IA`". Defaults to "`STANDARD`".
* `etag` - (Optional) Used to trigger updates. The only meaningful value is `${md5(file("path/to/file"))}`.
This attribute is not compatible with `kms_key_id`.
* `server_side_encryption` - (Optional) Specifies server-side encryption of the object in S3. Valid values are "`AES256`" and "`aws:kms`".
Expand Down