Skip to content

Commit

Permalink
Fix null expiration date handling (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjsier committed Nov 7, 2023
1 parent 2e6e936 commit f3d4298
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion minio/resource_minio_ilm_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func minioReadILMPolicy(ctx context.Context, d *schema.ResourceData, meta interf
expiration = "DeleteMarker"
} else if r.Expiration.Days != 0 {
expiration = fmt.Sprintf("%dd", r.Expiration.Days)
} else {
} else if !r.Expiration.IsNull() {
expiration = r.Expiration.Date.Format("2006-01-02")
}

Expand Down
3 changes: 2 additions & 1 deletion minio/resource_minio_ilm_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ func TestAccILMPolicy_expireNoncurrentVersion(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckMinioILMPolicyExists(resourceName, &lifecycleConfig),
testAccCheckMinioLifecycleConfigurationValid(&lifecycleConfig),
resource.TestCheckResourceAttr(
resourceName, "rule.0.expiration", ""),
resource.TestCheckResourceAttr(
resourceName, "rule.0.noncurrent_version_expiration_days", "5"),
),
Expand Down Expand Up @@ -242,7 +244,6 @@ resource "minio_ilm_policy" "rule4" {
bucket = "${minio_s3_bucket.bucket4.id}"
rule {
id = "expireNoncurrentVersion"
expiration = "5d"
noncurrent_version_expiration_days = 5
}
}
Expand Down

0 comments on commit f3d4298

Please sign in to comment.