Skip to content

Commit

Permalink
Merge pull request #4287 from hwrdprkns/t-aws-one-zone-ia2
Browse files Browse the repository at this point in the history
Add support for ONEZONE_IA for S3
  • Loading branch information
bflad authored Apr 20, 2018
2 parents a884c84 + 103d6bf commit 34b4789
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
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

0 comments on commit 34b4789

Please sign in to comment.