Skip to content

Commit 7f94f4d

Browse files
committed
add instructions for breaking change introduced in #22605
1 parent a79da77 commit 7f94f4d

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

website/docs/guides/version-4-upgrade.html.md

+67
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,73 @@ The resources that were imported are shown above. These resources are now in
10411041
your Terraform state and will henceforth be managed by Terraform.
10421042
```
10431043

1044+
### `server_side_encryption_configuration` Argument deprecation
1045+
1046+
Switch your Terraform configuration to the `aws_s3_bucket_server_side_encryption_configuration` resource instead.
1047+
1048+
For example, given this previous configuration:
1049+
1050+
```terraform
1051+
resource "aws_s3_bucket" "example" {
1052+
# ... other configuration ...
1053+
server_side_encryption_configuration {
1054+
rule {
1055+
apply_server_side_encryption_by_default {
1056+
kms_master_key_id = aws_kms_key.mykey.arn
1057+
sse_algorithm = "aws:kms"
1058+
}
1059+
}
1060+
}
1061+
}
1062+
```
1063+
1064+
It will receive the following error after upgrading:
1065+
1066+
```
1067+
│ Error: Value for unconfigurable attribute
1068+
1069+
│ with aws_s3_bucket.example,
1070+
│ on main.tf line 1, in resource "aws_s3_bucket" "example":
1071+
│ 1: resource "aws_s3_bucket" "example" {
1072+
1073+
│ Can't configure a value for "server_side_encryption_configuration": its value will be decided automatically based on the result of applying this configuration.
1074+
```
1075+
1076+
Since the `server_side_encryption_configuration` argument changed to read-only, the recommendation is to update the configuration to use the `aws_s3_bucket_server_side_encryption_configuration`
1077+
resource and remove any references to `server_side_encryption_configuration` and its nested arguments in the `aws_s3_bucket` resource:
1078+
1079+
```terraform
1080+
resource "aws_s3_bucket" "example" {
1081+
# ... other configuration ...
1082+
}
1083+
1084+
resource "aws_s3_bucket_server_side_encryption_configuration" "example" {
1085+
bucket = aws_s3_bucket.example.id
1086+
1087+
rule {
1088+
apply_server_side_encryption_by_default {
1089+
kms_master_key_id = aws_kms_key.mykey.arn
1090+
sse_algorithm = "aws:kms"
1091+
}
1092+
}
1093+
}
1094+
```
1095+
1096+
It is then recommended running `terraform import` on each new resource to prevent data loss, e.g.
1097+
1098+
```shell
1099+
$ terraform import aws_s3_bucket_server_side_encryption_configuration.example example
1100+
aws_s3_bucket_server_side_encryption_configuration.example: Importing from ID "example"...
1101+
aws_s3_bucket_server_side_encryption_configuration.example: Import prepared!
1102+
Prepared aws_s3_bucket_server_side_encryption_configuration for import
1103+
aws_s3_bucket_server_side_encryption_configuration.example: Refreshing state... [id=example]
1104+
1105+
Import successful!
1106+
1107+
The resources that were imported are shown above. These resources are now in
1108+
your Terraform state and will henceforth be managed by Terraform.
1109+
```
1110+
10441111
### `website`, `website_domain`, and `website_endpoint` Argument deprecation
10451112

10461113
Switch your Terraform configuration to the `aws_s3_bucket_website_configuration` resource instead.

0 commit comments

Comments
 (0)