https://pulumi.com logo
#golang
Title
# golang
b

bumpy-bear-61087

02/21/2024, 9:26 AM
Hi, my following Go code always exits with status 32 without any (pulumi) logs. I am not using
pulumi up
but just
go run
. Is this not supported?
Copy code
<http://logger.Info|logger.Info>("running pulumi")

	pulumi.Run(func(ctx *pulumi.Context) error {
		if err := <http://ctx.Log.Info|ctx.Log.Info>("Pulumi run", nil); err != nil {
			logger.Error(err)
		}

		logger.Debug("initializing gcp")
		infra, err := gcp.New(ctx, conf.GCP)
		if err != nil {
			logger.WithError(err).Fatal("failed to initialize GCP")
		}

		logger.Debug("creating infra")
		if err = infra.Create(ctx); err != nil {
			logger.WithError(err).Fatal("failed to create GCP infra")
		}

		return nil
	})
}
a

ancient-policeman-24615

02/21/2024, 11:22 AM
To write a Pulumi program that doesn’t use the
pulumi
CLI is possible, but slightly different. You will need to use Pulumi’s Automation API.
b

bumpy-bear-61087

02/21/2024, 1:11 PM
Thanks!
s

salmon-account-74572

02/21/2024, 3:04 PM
Without using the Automation API, you'll need to use the
pulumi
CLI to perform all operations.
b

bumpy-bear-61087

02/21/2024, 3:05 PM
I got it working with the
pulumi cli
, but I find it more comfortable with a custom config struct loaded from one single yaml config file so maybe i'll try that. Thanks!