Validate that resource keys do not contain variable references#5169
Validate that resource keys do not contain variable references#5169andrewnester wants to merge 3 commits intomainfrom
Conversation
Approval status: pending
|
| @@ -0,0 +1,6 @@ | |||
| Error: resource key "${var.env}_job" must not contain variable references | |||
There was a problem hiding this comment.
Could you add as a comment or on PR description what output this test had before this PR?
There was a problem hiding this comment.
I see from #5098 that it's panic stacktrace, but good to confirm.
There was a problem hiding this comment.
It did fail with the same error before the fix
simonfaltum
left a comment
There was a problem hiding this comment.
Ran cursor-agent (gpt-5.5 1M Extra High) over this. The diagnostic is much nicer than the panic, thanks for landing it. One important issue and a couple of suggestions inline.
One thing not in the diff: the underlying nil-deref in bundle/direct/dresources/schema.go:22 (reached via calladapt's typed-nil conversion) is still reachable in theory. The validator catches the user-facing path, but if any other code path lands a nil at GetResourceConfig, we panic again. I think adding a defensive guard there to surface it as an internal error is worth doing as a follow-up, not blocking this PR.
Changes
Validate that resource keys do not contain variable references
Why
Fixes #5098
Tests
Added an acceptance test, failed with panic before the fix