From 6a4935f8548b483c52a6bd91f13c85b0a4161d73 Mon Sep 17 00:00:00 2001 From: Mickael Stanislas Date: Fri, 9 Jun 2023 16:37:31 +0200 Subject: [PATCH] fix: field possible unknown for RequireIfAttributeIsOneOf --- internal/require_if_attribute_is_one_of.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/require_if_attribute_is_one_of.go b/internal/require_if_attribute_is_one_of.go index 29727f6..fa99734 100644 --- a/internal/require_if_attribute_is_one_of.go +++ b/internal/require_if_attribute_is_one_of.go @@ -46,10 +46,10 @@ func (av RequireIfAttributeIsOneOf) Description(_ context.Context) string { var expectedValueDescritpion string for i, expectedValue := range av.ExceptedValues { if i == len(av.ExceptedValues)-1 { - expectedValueDescritpion += fmt.Sprintf("%s, ", expectedValue.String()) + expectedValueDescritpion += expectedValue.String() break } - expectedValueDescritpion += expectedValue.String() + expectedValueDescritpion += fmt.Sprintf("%s, ", expectedValue.String()) } return fmt.Sprintf("If %s attribute is set and the value is one of %s, this attribute is REQUIRED", av.PathExpression, expectedValueDescritpion) } @@ -110,7 +110,7 @@ func (av RequireIfAttributeIsOneOf) Validate(ctx context.Context, req RequireIfA for _, expectedValue := range av.ExceptedValues { if mpVal.Equal(expectedValue) { - if req.ConfigValue.IsNull() || req.ConfigValue.IsUnknown() { + if req.ConfigValue.IsNull() { res.Diagnostics.AddAttributeError( path, fmt.Sprintf("Invalid configuration for attribute %s", req.Path),