Skip to content

Commit bec3bd9

Browse files
fix: return early on unknown bedrock config (#31)
Fixes #30 Co-authored-by: Steffen Schmitz <steffen@langfuse.com>
1 parent ac85448 commit bec3bd9

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

internal/provider/llm_connections_resource.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ func (v llmConnectionConfigValidator) ValidateResource(ctx context.Context, req
166166

167167
switch adapter {
168168
case "bedrock":
169-
if configStr.IsNull() || configStr.IsUnknown() || configStr.ValueString() == "" {
169+
if configStr.IsUnknown() {
170+
return
171+
}
172+
if configStr.IsNull() || configStr.ValueString() == "" {
170173
resp.Diagnostics.AddError(
171174
"Config required for bedrock adapter",
172175
"The bedrock adapter requires a config JSON string containing a \"region\" key.",

internal/provider/llm_connections_resource_unit_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ func TestLlmConnectionsResource_ConfigValidator(t *testing.T) {
275275
config: tftypes.NewValue(tftypes.String, `{"region":"us-east-1"}`),
276276
expectError: false,
277277
},
278+
{
279+
name: "bedrock_unknown_config",
280+
adapter: "bedrock",
281+
config: tftypes.NewValue(tftypes.String, tftypes.UnknownValue),
282+
expectError: false,
283+
},
278284
{
279285
name: "google_vertex_ai_missing_location",
280286
adapter: "google-vertex-ai",

0 commit comments

Comments
 (0)