Skip to content

Commit

Permalink
Fix null expiration date handling (#545)
Browse files Browse the repository at this point in the history
(cherry picked from commit f3d4298)
  • Loading branch information
pjsier authored and felladrin committed Nov 7, 2023
1 parent bf14a1c commit d1e4ed8
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 d1e4ed8

Please sign in to comment.