LogoLogo
Bonsai (0.13) DocsGitHubDiscord CommunityGarden Enterprise
Acorn (0.12)
Acorn (0.12)
  • Welcome!
  • 🌳Basics
    • How Garden Works
    • Quickstart Guide
    • The Stack Graph (Terminology)
  • 🌻Tutorials
    • Your First Project
      • 1. Initialize a Project
      • 2. Connect to a Cluster
      • 3. Deploy and Test
      • 4. Configure Your Project
  • 💐Using Garden
    • Configuration Overview
    • Projects
    • Modules
    • Services
    • Tests
    • Tasks
    • Workflows
    • Variables and templating
    • Module Templates
    • Using the CLI
  • 🌿Kubernetes Plugins
    • About
    • Remote K8s Plugin Configuration
      • 1. Create a Cluster
        • AWS
        • GCP
        • Azure
      • 2. Configure Container Registry (Optional)
        • AWS
        • GCP
        • Azure
      • 3. Set Up Ingress, TLS and DNS
      • 4. Configure the Provider
    • Local K8s Plugin Configuration
      • 1. Install Local Kubernetes
      • 2. Configure the Provider
    • Module Configuration
      • Container
      • Kubernetes
      • Helm
      • PersistentVolumeClaim
      • ConfigMap
    • Advanced
      • In-Cluster Building
      • Minimal RBAC Configuration for Development Clusters
      • Deploying to Production
  • 🌺Terraform Plugin
    • About
    • Provider Configuration
    • Module Configuration
  • ☘️Pulumi Plugin
    • About
    • Provider Configuration
    • Module Configuration
  • 🌹Other Plugins
    • Container
    • Exec (local scripts)
  • 🌼Guides
    • Installing Garden
    • Adopting Garden
    • Code Synchronization (Dev Mode)
    • Connecting a local service to a K8s cluster (Local Mode)
    • Environments and namespaces
    • Hot Reload
    • Migrating from Docker Compose to Garden
    • Using Garden in CI
  • 🌷Advanced
    • cert-manager Integration
    • Using Remote Sources
    • Custom Commands
  • 🪷Reference
    • Providers
      • conftest-container
      • conftest-kubernetes
      • conftest
      • container
      • exec
      • hadolint
      • jib
      • kubernetes
      • local-kubernetes
      • maven-container
      • octant
      • openfaas
      • pulumi
      • terraform
    • Module Types
      • configmap
      • conftest
      • container
      • exec
      • hadolint
      • helm
      • jib-container
      • kubernetes
      • maven-container
      • openfaas
      • persistentvolumeclaim
      • pulumi
      • templated
      • terraform
    • Template Strings
      • Project configuration context
      • Environment configuration context
      • Provider configuration context
      • Module configuration context
      • Remote Source configuration context
      • Project Output configuration context
      • Custom Command configuration context
      • Workflow configuration context
      • Template Helper Functions
    • Glossary
    • Commands
    • Project Configuration
    • Module Template Configuration
    • Workflow Configuration
  • 🎋Misc
    • FAQ
    • Troubleshooting
    • Telemetry
Powered by GitBook
On this page
  • How it works
  • Deploying your Pulumi stacks
  • Referencing stack outputs in other Garden modules
  • Plugin commands
  • Next steps

Was this helpful?

  1. Pulumi Plugin

About

PreviousModule ConfigurationNextProvider Configuration

Last updated 1 year ago

Was this helpful?

The Pulumi plugin is already being used in large projects, but is still considered experimental. Please let us know if you have any questions or if any issues come up!

Garden includes an experimental Pulumi plugin that wraps the Pulumi CLI. This way, you can incorporate Pulumi stacks into your Garden project with minimal extra configuration. The benefits of using this plugin include:

  • Leveraging Garden's dependency semantics with your Pulumi stacks.

    • For example, Kubernetes modules can depend on infrastructure deployed with Pulumi (and access stack outputs via the ${runtime.services.[service-name].outputs}) key).

    • Deploy, preview, update, refresh or destroy Pulumi stacks in dependency order with a single command.

  • Fast incremental deploys that use Garden's versioning system in combination with Pulumi stack tags to implement efficient service status checks.

We strongly recommend that you (if you haven't already) before using it with Garden.

How it works

Internally, Garden simply wraps the Pulumi CLI, calling the appropriate Pulumi CLI commands to deploy, delete or check the status of a service.

The Pulumi plugin can optionally make use of stack tags to implement fast service status checks, which can be a major boost to performance when deploying projects containing several Pulumi stacks.

Finally, the plugin defines several plugin-specific commands that let you run Pulumi commands in one or more Pulumi modules in dependency order (which can be very useful for projects with several Pulumi stacks).

Deploying your Pulumi stacks

Once you've got your Pulumi module configured, it will be deployed when you run garden deploy in your project—just like any other Garden service!

Referencing stack outputs in other Garden modules

Garden's dependency graph functionality is a great fit for stack references. For example, if pulumi-module-a's Pulumi program uses a stack references to an IP address that's an output of pulumi-module-b's Pulumi program, you can add a dependency on pulumi-module-b by referencing that output:

kind: Module
type: pulumi
name: pulumi-module-a
cacheStatus: true
# Here, you should list all stack references used by this module's pulumi program.
stackReferences:
  - ${runtime.services.pulumi-module-b.outputs.ip-address}
# Make sure to add a dependency on each pulumi module you're using for stack references
# above (otherwise an error will be thrown when you deploy).
dependencies:
  - module-b

This ensures that Garden deploys pulumi-module-b before pulumi-module-a when running e.g. garden deploy.

If you make sure to include all stack references to pulumi modules in your project in the stackReferences field, you can safely set cacheStatus: true for your module, since Garden will factor the stack output values into its version calculations.

If cacheStatus is set to false, Garden runs pulumi up on every deploy. While this is safe and easy to reason about, it's much slower and more resource-intensive than using cacheStatus = true. However setting cacheStatus = true is only possible for Pulumi service managed state backends.

This is because running pulumi up is a much more expensive operation (in terms of CPU, RAM and time used) than the calls to pulumi stack tag set/get that Garden uses when cacheStatus = true.

With that in mind, we recommend using cacheStatus = true in your pulumi modules whenever possible, once you've made sure you've included all relevant stack references in your pulumi module configs.

Plugin commands

The pulumi plugin also comes with plugin-specific commands, which are designed to run pulumi commands in dependency order (and with access to Garden's full config/templating capabilities).

The currently available plugin commands are:

  • preview

  • cancel

  • refresh

  • destroy

  • reimport Each of the above wraps the pulumi command with the same name, except for reimport (which wraps pulumi export | pulumi import—a workflow that's occasionally needed).

By default, each command runs for every pulumi module in the project. Each plugin command also accepts an optional list of pulumi module names as CLI arguments.

When a list of module names is provided, the pulumi command will only be run for those modules (still in dependency order).

For example:

garden plugins pulumi preview -- my-pulumi-module my-other-pulumi-module

Next steps

Pulumi stacks can define .

These can then be read by other Pulumi stacks via .

Check out the project.

Also take a look at the and the for details on all the configuration parameters.

If you're having issues with pulumi itself, please refer to the .

☘️
learn about Pulumi
stack outputs
stack references
pulumi example
pulumi provider reference
pulumi module type reference
official docs