Download this file
| 1 | # db region forward spec T17 (J4): the deployment bucket expires everything |
| 2 | # under db-reads/: current versions a day after they are written, |
| 3 | # noncurrent versions a day after they become noncurrent, and expired |
| 4 | # delete markers. It is the forwarded read protocol's only deletion. |
| 5 | |
| 6 | mock_provider "aws" {} |
| 7 | |
| 8 | variables { |
| 9 | deployment_bucket_name = "dep" |
| 10 | data_bucket_name = "data" |
| 11 | } |
| 12 | |
| 13 | run "db_reads_expire_with_their_versions_and_markers" { |
| 14 | command = plan |
| 15 | |
| 16 | assert { |
| 17 | condition = length([ |
| 18 | for r in aws_s3_bucket_lifecycle_configuration.deployment.rule : r |
| 19 | if r.id == "db-reads-expire" && r.status == "Enabled" && |
| 20 | one(r.filter).prefix == "db-reads/" && |
| 21 | one(r.expiration).days == 1 && |
| 22 | one(r.noncurrent_version_expiration).noncurrent_days == 1 |
| 23 | ]) == 1 |
| 24 | error_message = "db-reads/ must expire current versions after 1 day and noncurrent versions 1 day after they become noncurrent" |
| 25 | } |
| 26 | |
| 27 | assert { |
| 28 | condition = length([ |
| 29 | for r in aws_s3_bucket_lifecycle_configuration.deployment.rule : r |
| 30 | if r.id == "db-reads-delete-markers" && r.status == "Enabled" && |
| 31 | one(r.filter).prefix == "db-reads/" && |
| 32 | one(r.expiration).expired_object_delete_marker == true |
| 33 | ]) == 1 |
| 34 | error_message = "db-reads/ must remove expired delete markers" |
| 35 | } |
| 36 | |
| 37 | assert { |
| 38 | condition = length([ |
| 39 | for r in aws_s3_bucket_lifecycle_configuration.deployment.rule : r |
| 40 | if r.id == "geoip-noncurrent" && one(r.filter).prefix == "control/geoip/" |
| 41 | ]) == 1 |
| 42 | error_message = "the control/geoip/ rule must stay as it was" |
| 43 | } |
| 44 | } |
| 45 | |