Even more mind-blowing, if I just change the type ...
# python
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
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
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.
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