Skip to content

Commit c71d142

Browse files
committed
fix environment variable branch value validation
1 parent 64a9808 commit c71d142

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

internal/provider/netlify_validators/environment_variable_context_parameter_validator.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,20 @@ func (av EnvironmentVariableContextParameterValidator) Validate(ctx context.Cont
7979
continue
8080
}
8181

82-
isBranch := !mpVal.IsNull() && mpVal.Equal(listValue)
82+
var mpValList basetypes.ListValue
83+
mpValList, diags = types.ListValue(types.StringType, []attr.Value{mpVal})
84+
res.Diagnostics.Append(diags...)
85+
86+
// Collect all errors
87+
if diags.HasError() {
88+
continue
89+
}
90+
isBranch := !mpVal.IsNull() && mpValList.Equal(listValue)
8391

8492
if isNonEmpty != isBranch {
8593
res.Diagnostics.Append(validatordiag.InvalidAttributeCombinationDiagnostic(
8694
req.Path,
87-
fmt.Sprintf("Attribute %q must be a non-empty string iff %q is specified", req.Path, mp),
95+
fmt.Sprintf("Attribute %q must be a non-empty string iff %q is specified %q %q %q", req.Path, mp, listValue, mpVal, req.ConfigValue),
8896
))
8997
}
9098
}

0 commit comments

Comments
 (0)