Hey guys, I'm trying to print json output during "...
# getting-started
f
Hey guys, I'm trying to print json output during "update" operation in Pulumi. And I'm using Pulumi automation APIs to do the same. I don't see an option here to print json output here - https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/auto/optup . Am I missing anything?
Can you please help me get to json print option in pulumi go automation API?
m
What information are you trying to print exactly? The automation API should produce the same output about resource changes and updates as the Pulumi CLI.
I don't think it's possible to set the
--json
CLI flag through the Automation API if that's your question. It's possible to pass arbitrary arguments to the Pulumi CLI (https://github.com/pulumi/pulumi/blob/master/sdk/go/auto/cmd.go#L263) but the JSON flag cannot be set through "up" (https://github.com/pulumi/pulumi/blob/master/sdk/go/auto/stack.go#L362). If you need this, it should be straightforward to patch it in, not sure if Pulumi would consider adding this feature.
I see you already opened a feature request at https://github.com/pulumi/pulumi/issues/18088
f
Yes. I wanted to store json formatted logs of pulumi's updates. The events stream api (via go channels) seems useful at this point as a good alternative - https://github.com/pulumi/pulumi/issues/7773