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

polite-mechanic-60124

12/07/2021, 9:18 PM
Even more mind-blowing, if I just change the type hint for the return to a pulumi.Output it works (but fails mypy since its a string)
Copy code
def render_user_data_output(
        env: Environment, template_name: str, kwargs: Mapping[str, Any]
) -> pulumi.Output:
    rendered_template = render_template_file(env, template_name, kwargs)
    return base64.b64encode(rendered_template.encode("utf-8")).decode("utf-8")
It's kind of like python loses track of the coroutine and doesn't know to await
s

sparse-tomato-5980

12/10/2021, 9:17 PM
i'd be very, very surprised if changing the type hint changed anything at runtime - it's possible you're just seeing nondeterministic behavior that happens to map to this
g

great-sunset-355

12/14/2021, 10:03 AM
I noticed that MAP outputs simply produce unordered results when converted to a string (as expected) but this is a problem because if you pass this string further down the line - then it changes the state of everything that depends on it.
p

polite-mechanic-60124

12/23/2021, 1:33 AM
Thank you. I'll try playing around with this again soon. I suspect that the order of operations is non-deterministic and needs a type hint to know which path to go down
19 Views