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

gifted-sandwich-82552

10/02/2023, 4:23 PM
Hi all - newish to pulumi. I created a Dynamic Resource Provider in python that has an output of
new_tags: Output[List[str]]
. The code seems to be working, I can see the resource in preview and code being executed but having a hard time actually getting the output list. Trying to follow along from documentation but
new_tags.apply(lambda x: f"{x[0]}")
or even
new_tags.apply(lambda x: print(x)
still errors out with
tags: Calling __str__ on an Output[T] is not supported.
s

straight-cat-87033

10/02/2023, 8:55 PM
The output you’re getting suggests that you may be dealing with an
Output[list[Output[str]]
instead of just an
Output[list[str]]
? If that’s the case, further expanding with another apply, or (if it my be a mix on inputs and outputs) defining a function such as:
Copy code
def print_output_list(output_list: list[Input[str]]):
   as_outputs = [ Output.from_input(x) for x in output_list ]
   Output.all(*as_outputs).apply(print)
And then calling
new_tags.apply(print_output_list)
could help
2 Views