-
Notifications
You must be signed in to change notification settings - Fork 4
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
generated schema disallows reference strings #70
Comments
So, I must admit I haven't been following tf-ncl for quite some time, so my knowledge is a bit rusty. But I think the auto-generated schema automatically populate some computed fields in Nickel, that are special values with a marker (probably today they should just be ADTs aka enum variants, but at the time of developing tf-ncl, those didn't exist in Nickel). They are post-processed by Thus, I think you should be able to reference That being said, there are some limitations and not all computed values can be used this way (in particular tf-ncl doesn't support . I thus agree that to be more flexible we should also accept plain interpolated strings, although we lose some validation power, because we wouldn't check anymore that the computed field is indeed a number. Ideally we would check as well, but that doesn't seem easy at all, and forbidding custom interpolations in the meantime might prove too restrictive in practice. |
(I hereby invoke @vkleen to correct me if I said something wrong) |
That's right, the design intent was that you wouldn't have to use Terraform's interpolation. Instead, it should be possible (and easier! Not least because of LSP completion) to just recursively reference fields and have things work magically. Unfortunately, the current setup doesn't support complex interpolations and maybe it would be a good idea to offer an escape hatch. Maybe |
@yannham i think your sentence is missing a bit there? 🙈 the workaround i had trouble with for a few reasons:
* these were on my coding style, coming from nix It looks like mostly the last one seems not to have workarounds still.
@vkleen That would seem great - sounds like that should address any of these. |
Oops, I meant in particular tf-ncl doesn't support compound expressions involving TF computed values, like taking the first byte of an IP address, which TF does handle to some extent if I recall correctly.
That sounds fair. I wonder if maybe we don't even need to modify the original
To be used as |
@yannham thanks, i think your suggested function sounds great. i guess we could add both versions, as they seem to offer low-level vs high-level interfaces respectively. |
Describe the bug
currently, tf-ncl seems to generate straightforward types (e.g.
Number
), which ends up not matching up with how in practice one should also be able to pass reference strings:To Reproduce
Expected behavior
probably any TF type should also accept strings (formatted like references)
Environment
Additional context
The TF docs describe the intended functioning on this as follows:
The text was updated successfully, but these errors were encountered: