Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle unknown values #49

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/prevention_policy/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,15 +407,15 @@ func validateRequiredAttribute(
func validateHostGroups(ctx context.Context, hostGroupSet types.Set) diag.Diagnostics {
var diags diag.Diagnostics

var hostGroups []string
var hostGroups []types.String

diags.Append(hostGroupSet.ElementsAs(ctx, &hostGroups, false)...)
if diags.HasError() {
return diags
}

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

var ioaRuleGroups []string
var ioaRuleGroups []types.String

diags.Append(ioaRuleGroupSet.ElementsAs(ctx, &ioaRuleGroups, false)...)
if diags.HasError() {
return diags
}

for _, id := range ioaRuleGroups {
if len(id) == 0 {
if !id.IsUnknown() && len(id.ValueString()) == 0 {
diags.AddAttributeError(
path.Root("ioa_rule_groups"),
"Error validating ioa rule group",
Expand Down