Pulumi supports writing your infrastructure as code using the Go language.
The fastest way to get up and running is to choose from one of the following Getting Started guides:
The fastest way to get started is to use a template. The template will initialize a Pulumi project. The getting started guides shown above will help do this on your cloud of choice, but this section describes doing so independently.
From an empty directory, create a new project:
$ mkdir myproject && cd myproject $ pulumi new go
This will create a
Pulumi.yaml project file containing some minimal metadata about your project (including a name and description which you may wish to change) and a
main.go file containing your program. The name of the directory is used as the project name in
Pulumi.yaml. Use your favorite Go dependency manager (such as Go’s built-in modules system, by running
go mod init in your project’s directory).
To deploy your infrastructure, first build your Go program:
go build -o $(basename $(pwd)). Then run
pulumi up and Pulumi will perform the operations needed to deploy the infrastructure you have declared.
go template is cloud agnostic, and you will need to install additional Go modules for the cloud provider of your choice. Additional templates are available that do this for you:
pulumi new aws-go: creates a starter AWS Go project
pulumi new azure-go: creates a starter Azure Go project
pulumi new gcp-go: creates a starter Google Cloud Go project