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
Add option to throw on output toString and toJSON calls #14811
Add option to throw on output toString and toJSON calls #14811
Conversation
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
Changelog[uncommitted] (2023-12-20)Features
|
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
Thanks for taking a look at the PR! |
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
@Frassle should I be applying this to other SDKs, or is doing only the NodeJS SDK fine for now? |
It would be nice if you did the others (well only python needs doing in this repo) but I'll accept this just changing node and I'll go fix the others up afterwards. |
...g/pending/20231210--sdk-nodejs--add-option-to-throw-on-output-tostring-and-tojson-calls.yaml
Outdated
Show resolved
Hide resolved
Co-authored-by: Fraser Waters <frassle@gmail.com>
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
/run-acceptance-tests |
woops, forgot to run make format & lint on the python sdk after the additions. fixed now. |
/run-acceptance-tests |
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
Thanks for this. I'll take a look at updating dotnet and java SDKs to use this envvar as well. |
Description
This adds an environment variable that changes output's
.toString
and.toJSON
methods to throw an exception instead of returning a string containing a warning.This feature mitigates the issue described in #4261 by allowing users to opt in to having accidental toString calls (e.g. in a JS backtick string that is missing
pulumi.interpolate
) throw an exception. The behaviour ends up similar to theget()
method of outputs, which throws an exception.I don't know how to write tests for this change, or even test it manually.
Checklist
make tidy
to update any new dependenciesmake lint
to verify my code passes the lint checkgofumpt
make changelog
and committed thechangelog/pending/<file>
documenting my change