pretty print pulumi.output - At present pprint(var...
# general
c
pretty print pulumi.output - At present pprint(vars(server_object)) produces
Copy code
'address': <pulumi.output.Output object at 0x10f923a58>,
     'allocated_storage': <pulumi.output.Output object at 0x10f8fc048>,
     'allow_major_version_upgrade': <pulumi.output.Output object at 0x10f8fc128>,
     'apply_immediately': <pulumi.output.Output object at 0x10f8fc978>,
     'arn': <pulumi.output.Output object at 0x10f923b00>,
What is the best way to convert entire object to string and print it e.g., the output of server_object = aws.rds.Instance(name,...
I understand I can do something like :
Copy code
url = Output.all([server.username, server.password]).apply(lambda l: f"http://{l[0]}:{l[1]}/")
But Is there a way to dump the whole server object and its fields?
g
You should be able to print the object inside the apply. Something along the lines of
Copy code
url = server_object.apply(lambda l: pprint(vars(l)))
Alternatively, you can view the state of your resources through the pulumi SaaS, or with
pulumi stack export
c
AttributeError: 'Instance' object has no attribute 'apply'   error: an unhandled error occurred: Program exited with non-zero exit code: 1
btw- does it work in the preview ?
may be i will pulumi.export("SERVER", server_object) and see it at the end ?
g
Ah, in that case, you need to wrap the object in an output before running apply:
pulumi.Output(server_object).apply(...)
It may not work during preview, as some of the values may not have been resolved yet. The export should also work.