Skip to content

Commit 24c720a

Browse files
authored
handle unknown values (#49)
1 parent ab161a1 commit 24c720a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/prevention_policy/shared.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,15 @@ func validateRequiredAttribute(
407407
func validateHostGroups(ctx context.Context, hostGroupSet types.Set) diag.Diagnostics {
408408
var diags diag.Diagnostics
409409

410-
var hostGroups []string
410+
var hostGroups []types.String
411411

412412
diags.Append(hostGroupSet.ElementsAs(ctx, &hostGroups, false)...)
413413
if diags.HasError() {
414414
return diags
415415
}
416416

417417
for _, id := range hostGroups {
418-
if len(id) == 0 {
418+
if !id.IsUnknown() && len(id.ValueString()) == 0 {
419419
diags.AddAttributeError(
420420
path.Root("host_groups"),
421421
"Error validating host group",
@@ -431,15 +431,15 @@ func validateHostGroups(ctx context.Context, hostGroupSet types.Set) diag.Diagno
431431
func validateIOARuleGroups(ctx context.Context, ioaRuleGroupSet types.Set) diag.Diagnostics {
432432
var diags diag.Diagnostics
433433

434-
var ioaRuleGroups []string
434+
var ioaRuleGroups []types.String
435435

436436
diags.Append(ioaRuleGroupSet.ElementsAs(ctx, &ioaRuleGroups, false)...)
437437
if diags.HasError() {
438438
return diags
439439
}
440440

441441
for _, id := range ioaRuleGroups {
442-
if len(id) == 0 {
442+
if !id.IsUnknown() && len(id.ValueString()) == 0 {
443443
diags.AddAttributeError(
444444
path.Root("ioa_rule_groups"),
445445
"Error validating ioa rule group",

0 commit comments

Comments
 (0)