carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1# Platform #336: the data bucket's noncurrent versions expire after
2# data_noncurrent_days (7 by default), expired delete markers go, and
3# current objects never expire.
4
5mock_provider "aws" {}
6
7variables {
8 deployment_bucket_name = "dep"
9 data_bucket_name = "data"
10}
11
12run "data_noncurrent_versions_expire_after_seven_days" {
13 command = plan
14
15 assert {
16 condition = length([
17 for r in aws_s3_bucket_lifecycle_configuration.data.rule : r
18 if r.id == "expire-noncurrent" && r.status == "Enabled" &&
19 one(r.noncurrent_version_expiration).noncurrent_days == 7 &&
20 one(r.expiration).expired_object_delete_marker == true
21 ]) == 1
22 error_message = "the data bucket must expire noncurrent versions after 7 days and clear expired delete markers"
23 }
24}
25
26run "data_noncurrent_days_is_configurable" {
27 command = plan
28
29 variables {
30 data_noncurrent_days = 30
31 }
32
33 assert {
34 condition = one(one(aws_s3_bucket_lifecycle_configuration.data.rule).noncurrent_version_expiration).noncurrent_days == 30
35 error_message = "data_noncurrent_days must set the noncurrent expiry"
36 }
37}
38
39run "data_noncurrent_days_refuses_zero" {
40 command = plan
41
42 variables {
43 data_noncurrent_days = 0
44 }
45
46 expect_failures = [var.data_noncurrent_days]
47}
48