orange-airport-6459210/11/2022, 1:16 PM
, I found some test case in
but there are not async function in my pulumi script , I’m not using asynchronous, I don’t know how to use this.
class OutputSecretTests(unittest.TestCase): @pulumi_test async def test_secret(self): x = Output.secret("foo") is_secret = await x.is_secret() self.assertTrue(is_secret) @pulumi_test async def test_unsecret(self): x = Output.secret("foo") x_is_secret = await x.is_secret() self.assertTrue(x_is_secret) y = Output.unsecret(x) y_val = await y.future() y_is_secret = await y.is_secret() self.assertEqual(y_val, "foo") self.assertFalse(y_is_secret)
echoing-dinner-1953110/11/2022, 2:26 PM
able-ability-1120310/11/2022, 5:10 PM
not working on an (eventually) string output (blaming me for using
apply(lambda _: _)
on Outputs, that kind of message) but
working well with this output. In the first case I've tried to interpolate
, and got error message instead of value. The issue is thus solved for me, but I've just wondered, how that's possible?)
orange-airport-6459210/12/2022, 2:44 AM
apply to . And what is the difference between them.
echoing-dinner-1953110/12/2022, 8:50 AM
The issue is thus solved for me, but I've just wondered, how that's possible?) (edited)It's not possible. Once a value is an output it has to stay an output.
always returns an
. Not that in the next version of the python SDK we'll have
which is the same as the built in
method but with support for outputs. I'd like to see if we could get
to get f strings with output support but Python doesn't really support extensions to the f string machinery so this would probably be a bit hacky (e.g. there's a suggestion of looking up stack frames here https://stackoverflow.com/questions/61185448/custom-string-interpolation-in-python)
I would like to know which scenario doseapply to
is for when you've ended up with a value tagged as a secret and you don't want it be. Normally this is because you've got one large output structure which has a secret part and non-secret part but the whole thing has come in as secret, you can pull off the non-secret part call
on it and then see it in plain text in display output and state and the like.