according to this - <https://www.pulumi.com/blog/o...
# general
f
according to this - https://www.pulumi.com/blog/observability-with-infrastructure-as-code/ - the progress stream may have been able to be rendered as JSON. Is that possiyble?
b
Just simply add the
--json
parameter to calls for
pulumi up
and
pulumi preview
f
Thanks - I’m using the golang sdk though - is that supported there?
b
@faint-restaurant-96457 Just to avoid any misunderstandings: do you use the Pulumi Automation API or do you use GO to (simply) deploy your infrastructure? Okay, figured it out by look at the article you liked. It's the Automation API and there you have to use
ProgressStreams
to write the progress message of e.g.
pulumi up
to a file or other streams. Issue is that
ProgressStreams
does not allow to specify any manipulation of in the incoming data, you can only pass an arbitrary list of IO streams.
f
Erm, not sure? I’m using this https://github.com/pulumi/pulumi-azure-native (probably incorrectly tbh). I’m just looking for a simple embedded go library that lets me deploy a dtack and watch (and report) that stack to the user as it deploys
b
> Erm, not sure? I’m using this https://github.com/pulumi/pulumi-azure-native (probably incorrectly tbh).misleading. Oh, okay ... So the article link was a bit misleading
I’m just looking for a simple embedded go library that lets me deploy a dtack and watch (and report) that stack to the user as it deploys
If you really want to provider the user a "standalone program" or an "embedded go library" you've to use the Automation API because everything else would require to run the
pulumi
program via GO
f
Gotcha - so then that’s probably what I’m using :)
I’m not sure why the article was misleading though, my code looks a lot like the initial attempt there
Particularly this:
Copy code
stream := optup.ProgressStreams(os.Stdout)
	if _, err := stack.Up(ctx, stream); err != nil {
		 // my processing for progress stream goes here
	}
👍🏻 1
b
> I’m not sure why the article was misleading though, my code looks a lot like the initial attempt there Only a bit misleading for me to figure out what you wanted 😄
❤️ 1
f
Thank you for looking!
b
Regarding your "embedded go library" i.e. a GO module that can be used (imported) somewhere else, I think the "inline program" variant of the Pulumi Automation is the right one to choose. But not quite sure if you're already done that. https://github.com/pulumi/automation-api-examples/tree/main/go/inline_program
f
This is interesting- I hadn’t thought of creating the stack and refreshing based on added features - it’s a neat idea The docs there say “need the pulumi cli installed” but I’m not sure why
My program looks pretty close to this tbh
f
“need the pulumi cli installed” but I’m not sure why
because the automation api makes use of the
pulumi
cmdline app via
os.exec
b
In addition keep in mind that for an inline program the required Pulumi providers must be configured by code. Like in the referenced example.
f
Oh that won’t work then - we need a pure golang library with no other dependencies
f
maybe we'll get into the why of that, but you can have your automation api-based app install the cli via e.g. https://github.com/pulumi/automation-api-examples/tree/main/go/cli_installation
b
Inside the code you'll find a README.md which states
Copy code
Package auto contains the Pulumi Automation API, the programmatic interface for driving Pulumi programs without the CLI. Generally this can be thought of as encapsulating the functionality of the CLI (pulumi up, pulumi preview, pulumi destroy, pulumi stack init, etc.) but with more flexibility. This still requires a CLI binary to be installed and available on your $PATH.
https://github.com/pulumi/pulumi/blob/master/sdk/go/auto/README.md
☝️ 1
f
Understood I’ve just never seen any library require an external CLI so I just assumed (badly!!) My goal is to have a single download, no install. We don’t control the client at all
f
that could still end up being a single-file deploy of a golang app which would satisfy one interpretation of "no other dependencies" 😄
f
Oh? That works!
f
yeah, that'd be possible still
f
How?
f
so e.g. you ship a single binary to your... I dunno, QA team or sales team or clients or whomever that then uses Pulumi "under the covers" to deploy the infra and do whatever else you need
f
No I mean how do I embed one cli in another app and have the library use it :) This is our project - Bacalhau.org. We are trying to build a simple tool to deploy a cluster according to a config file. 1000s of end users will use this - it’ll be MOSTLY production cluster, not a lot of customizations supported, but end users only need to log in with their own credentials to their own cloud to make it work
f
well... first I would seriously consider if it'd be acceptable for your automation api-based binary to (temporarily!) install the pulumi cli for the end user via the example above. if that's not possible, i'd next consider having the user do it themselves via documentation if that's not possible (e.g. airgapped install/execution) others have made promising attempts but you're basically on your own at that point
f
Oh this is a super bummer. I really like pulumi - I just assumed it’d be more supported to be embedded like terraform. RATS. Thanks for your help :(
f
You can do what you're asking - see that issue above. But yeah, if you're not feeling any of this fits your specific use case, no probs, best of luck!
f
This isn’t the core of our business, so using a fork that requires refactoring the core library and hasn’t had updates in two years is pretty scary :(
💯 1