https://pulumi.com logo
#python
Title
# python
s

square-dress-80180

05/19/2022, 12:41 AM
I have had a couple times run into an issue where my call to
<stackname>.get_output('foo')
silently fails and I only find out when some resource mysteriously isn’t configured correctly. The root of the error is me doing something silly like misspelling the variable name and I usually find it in not too long, but it would certainly make it easier to catch if the failure wasn’t silent. What is the rationale for not throwing an error during preview to prevent these issues?
f

full-artist-27215

05/19/2022, 2:40 PM
It's not so much silently failing as it is working as intended...
get_output
naturally returns
None
if the given key doesn't exist. If you use
require_output
, it will throw an error if the key isn't present.
Same as
my_dict.get("foo")
vs.
my_dict.require("foo")
For stack references, I don't think I ever use
get_output
, for this exact reason.
s

square-dress-80180

05/20/2022, 7:06 PM
Ah - ok. That makes sense. Thanks @full-artist-27215 for guiding me in the right direction!
👍 1
2 Views