You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: website/docs/guides/version-4-upgrade.html.md
+199
Original file line number
Diff line number
Diff line change
@@ -467,6 +467,199 @@ your Terraform state and will henceforth be managed by Terraform.
467
467
468
468
Switch your Terraform configuration to the [`aws_s3_bucket_lifecycle_configuration` resource](/docs/providers/aws/r/s3_bucket_lifecycle_configuration.html) instead.
469
469
470
+
#### For Lifecycle Rules with no `prefix` previously configured
471
+
472
+
For example, given this previous configuration:
473
+
474
+
```terraform
475
+
resource "aws_s3_bucket" "example" {
476
+
bucket = "my-example-bucket"
477
+
478
+
lifecycle_rule {
479
+
id = "Keep previous version 30 days, then in Glacier another 60"
480
+
enabled = true
481
+
482
+
noncurrent_version_transition {
483
+
days = 30
484
+
storage_class = "GLACIER"
485
+
}
486
+
487
+
noncurrent_version_expiration {
488
+
days = 90
489
+
}
490
+
}
491
+
492
+
lifecycle_rule {
493
+
id = "Delete old incomplete multi-part uploads"
494
+
enabled = true
495
+
abort_incomplete_multipart_upload_days = 7
496
+
}
497
+
}
498
+
```
499
+
500
+
It will receive the following error after upgrading:
501
+
502
+
```
503
+
│ Error: Value for unconfigurable attribute
504
+
│
505
+
│ with aws_s3_bucket.example,
506
+
│ on main.tf line 1, in resource "aws_s3_bucket" "example":
507
+
│ 1: resource "aws_s3_bucket" "example" {
508
+
│
509
+
│ Can't configure a value for "lifecycle_rule": its value will be decided automatically based on the result of applying this configuration.
510
+
```
511
+
512
+
Since the `lifecycle_rule` argument changed to read-only, the recommendation is to update the configuration to use the `aws_s3_bucket_lifecycle_configuration`
513
+
resource and remove any references to `lifecycle_rule` and its nested arguments in the `aws_s3_bucket` resource.
514
+
515
+
~> **Note:** When configuring the `rule.filter` configuration block in the new `aws_s3_bucket_lifecycle_configuration` resource, it is recommended to use the AWS CLI s3api [get-bucket-lifecycle-configuration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/get-bucket-lifecycle-configuration.html)
516
+
to fetch the source bucket's lifecycle configuration and determine if the `Filter` is configured as `"Filter" : {}` or `"Filter" : { "Prefix": "" }`.
517
+
If the former is returned, `rule.filter` should be configured as `filter {}`. If the latter is returned, `rule.filter` should be configured as follows.
The resources that were imported are shown above. These resources are now in
572
+
your Terraform state and will henceforth be managed by Terraform.
573
+
```
574
+
575
+
#### For Lifecycle Rules with `prefix` previously configured as an empty string
576
+
577
+
For example, given this configuration:
578
+
579
+
```terraform
580
+
resource "aws_s3_bucket" "example" {
581
+
bucket = "my-example-bucket"
582
+
583
+
lifecycle_rule {
584
+
id = "log-expiration"
585
+
enabled = true
586
+
prefix = ""
587
+
588
+
transition {
589
+
days = 30
590
+
storage_class = "STANDARD_IA"
591
+
}
592
+
593
+
transition {
594
+
days = 180
595
+
storage_class = "GLACIER"
596
+
}
597
+
}
598
+
}
599
+
```
600
+
601
+
It will receive the following error after upgrading:
602
+
603
+
```
604
+
│ Error: Value for unconfigurable attribute
605
+
│
606
+
│ with aws_s3_bucket.example,
607
+
│ on main.tf line 1, in resource "aws_s3_bucket" "example":
608
+
│ 1: resource "aws_s3_bucket" "example" {
609
+
│
610
+
│ Can't configure a value for "lifecycle_rule": its value will be decided automatically based on the result of applying this configuration.
611
+
```
612
+
613
+
Since the `lifecycle_rule` argument changed to read-only, the recommendation is to update the configuration to use the `aws_s3_bucket_lifecycle_configuration`
614
+
resource and remove any references to `lifecycle_rule` and its nested arguments in the `aws_s3_bucket` resource:
Copy file name to clipboardexpand all lines: website/docs/r/s3_bucket_lifecycle_configuration.html.markdown
+2-2
Original file line number
Diff line number
Diff line change
@@ -151,11 +151,11 @@ The `rule` configuration block supports the following arguments:
151
151
152
152
*`abort_incomplete_multipart_upload` - (Optional) Configuration block that specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before permanently removing all parts of the upload [documented below](#abort_incomplete_multipart_upload).
153
153
*`expiration` - (Optional) Configuration block that specifies the expiration for the lifecycle of the object in the form of date, days and, whether the object has a delete marker [documented below](#expiration).
154
-
*`filter` - (Optional) Configuration block used to identify objects that a Lifecycle Rule applies to [documented below](#filter).
154
+
*`filter` - (Optional) Configuration block used to identify objects that a Lifecycle Rule applies to [documented below](#filter). If not specified, the `rule` will default to using `prefix`.
155
155
*`id` - (Required) Unique identifier for the rule. The value cannot be longer than 255 characters.
156
156
*`noncurrent_version_expiration` - (Optional) Configuration block that specifies when noncurrent object versions expire [documented below](#noncurrent_version_expiration).
157
157
*`noncurrent_version_transition` - (Optional) Set of configuration blocks that specify the transition rule for the lifecycle rule that describes when noncurrent objects transition to a specific storage class [documented below](#noncurrent_version_transition).
158
-
*`prefix` - (Optional) **DEPRECATED** Use `filter` instead. This has been deprecated by Amazon S3. Prefix identifying one or more objects to which the rule applies.
158
+
*`prefix` - (Optional) **DEPRECATED** Use `filter` instead. This has been deprecated by Amazon S3. Prefix identifying one or more objects to which the rule applies. Defaults to an empty string (`""`) if `filter` is not specified.
159
159
*`status` - (Required) Whether the rule is currently being applied. Valid values: `Enabled` or `Disabled`.
160
160
*`transition` - (Optional) Set of configuration blocks that specify when an Amazon S3 object transitions to a specified storage class [documented below](#transition).
0 commit comments