@@ -2,6 +2,8 @@ package schemas
2
2
3
3
import (
4
4
"context"
5
+ "strings"
6
+
5
7
"github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util"
6
8
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
7
9
datasourceSchema "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
@@ -16,7 +18,6 @@ import (
16
18
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
17
19
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
18
20
"github.com/hashicorp/terraform-plugin-framework/types"
19
- "strings"
20
21
)
21
22
22
23
var _ EntitySchema = LifecycleSchema {}
@@ -205,7 +206,7 @@ func (v retentionPolicyValidator) ValidateObject(ctx context.Context, req valida
205
206
return
206
207
}
207
208
208
- if ! retentionPolicy .QuantityToKeep .IsNull () && ! retentionPolicy .ShouldKeepForever .IsNull () {
209
+ if ! retentionPolicy .QuantityToKeep .IsNull () && ! retentionPolicy .QuantityToKeep . IsUnknown () && ! retentionPolicy . ShouldKeepForever .IsNull () && ! retentionPolicy . ShouldKeepForever . IsUnknown () {
209
210
quantityToKeep := retentionPolicy .QuantityToKeep .ValueInt64 ()
210
211
shouldKeepForever := retentionPolicy .ShouldKeepForever .ValueBool ()
211
212
@@ -224,7 +225,7 @@ func (v retentionPolicyValidator) ValidateObject(ctx context.Context, req valida
224
225
}
225
226
}
226
227
227
- if ! retentionPolicy .Unit .IsNull () {
228
+ if ! retentionPolicy .Unit .IsNull () && ! retentionPolicy . Unit . IsUnknown () {
228
229
unit := retentionPolicy .Unit .ValueString ()
229
230
if ! strings .EqualFold (unit , "Days" ) && ! strings .EqualFold (unit , "Items" ) {
230
231
resp .Diagnostics .AddAttributeError (
0 commit comments