Skip to content

Commit d18c889

Browse files
committed
test: validate lifecycle policy rule with newer_noncurrent_versions
1 parent 9d867b9 commit d18c889

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- '**.go'
99
- 'go.mod'
1010
- 'go.sum'
11+
- 'internal/provider/testdata/*.tf'
1112
- '.github/workflows/test.yml'
1213
push:
1314
branches:
@@ -16,6 +17,7 @@ on:
1617
- '**.go'
1718
- 'go.mod'
1819
- 'go.sum'
20+
- 'internal/provider/testdata/*.tf'
1921
- '.github/workflows/test.yml'
2022

2123
permissions:
@@ -51,6 +53,7 @@ jobs:
5153
cli:
5254
- terraform
5355
- tofu
56+
fail-fast: false
5457
needs: build
5558
runs-on: ubuntu-latest
5659
timeout-minutes: 15

internal/provider/bucket_lifecycle_configuration.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
99
"github.com/aws/aws-sdk-go-v2/service/s3"
1010
s3_types "github.com/aws/aws-sdk-go-v2/service/s3/types"
11-
"github.com/hashicorp/terraform-plugin-framework-validators/int32validator"
1211
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
1312
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
1413
"github.com/hashicorp/terraform-plugin-framework-validators/objectvalidator"
@@ -266,11 +265,6 @@ func (r *BucketLifecycleConfigurationResource) Schema(ctx context.Context, req r
266265
"newer_noncurrent_versions": schema.Int32Attribute{
267266
Optional: true,
268267
MarkdownDescription: "The number of newer noncurrent versions.",
269-
Validators: []validator.Int32{
270-
int32validator.ConflictsWith(
271-
path.MatchRelative().AtParent().AtName("noncurrent_days"),
272-
),
273-
},
274268
},
275269
"noncurrent_days": schema.Int32Attribute{
276270
Optional: true,

internal/provider/testdata/bucket_lifecycle.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ resource "objsto_bucket" "this" {
1010
resource "objsto_bucket_lifecycle_configuration" "this" {
1111
bucket = objsto_bucket.this.bucket
1212

13+
rule {
14+
id = "Expire non-current versions after 3 newer versions"
15+
16+
filter {
17+
prefix = "test/"
18+
}
19+
20+
noncurrent_version_expiration {
21+
noncurrent_days = 1
22+
newer_noncurrent_versions = 3
23+
}
24+
}
25+
1326
rule {
1427
id = "Expire non-current versions after 7 days"
1528

0 commit comments

Comments
 (0)