🗂️ Navigation
🔧 Dynamic Environment Provisioner for CI/CD

Dynamic Environment Provisioner for CI/CD

An automation script in a CI/CD pipeline that uses the Automation API to create ephemeral environments for testing pull requests.

Visit Website →

Overview

This pattern involves integrating the Pulumi Automation API into a CI/CD pipeline (like GitHub Actions) to manage dynamic, per-pull-request environments. When a developer opens a pull request, a CI job is triggered. This job runs a script that uses the Automation API to create a new stack (e.g., `pr-123`), deploy a complete, isolated copy of the application and its infrastructure, and post the endpoint URL back to the PR. This allows for comprehensive testing against live infrastructure. When the PR is merged or closed, another job is triggered that calls the Automation API to destroy the stack, ensuring no resources are left running.

✨ Key Features

  • Creates ephemeral infrastructure environments on-demand.
  • Integrates directly into CI/CD pipelines.
  • Programmatically manages stack lifecycle (create, update, destroy).
  • Provides isolated environments for each pull request.
  • Automates cleanup of temporary resources.

🎯 Key Differentiators

  • Provisions the entire infrastructure stack, not just the frontend application.
  • Offers full programmatic control within the CI/CD job using a real programming language.
  • Cloud-agnostic, can create preview environments on any cloud.

Unique Value: Enables high-confidence testing and review by creating a complete, ephemeral copy of the production environment for every pull request.

🎯 Use Cases (3)

Automated end-to-end testing of new features on live infrastructure. Providing a preview environment for stakeholders to review changes. Validating infrastructure changes in isolation before merging to main.

✅ Best For

  • Pulumi's own GitHub Action is powered by the Automation API, giving users control over Pulumi workflows in CI/CD.
  • Tutorials demonstrate modifying an Azure DevOps pipeline to remove dependency on the Pulumi CLI and use a .NET application with the Automation API instead.

💡 Check With Vendor

Verify these considerations match your specific requirements:

  • Projects where preview environments are not necessary or are too costly to create.
  • Simple applications that can be tested sufficiently with local mocks.

🏆 Alternatives

Vercel Preview Deployments Netlify Deploy Previews Custom scripts wrapping Terraform or Pulumi CLI

Using the Automation API is more robust and flexible than wrapping CLI commands in shell scripts, as it allows for complex logic, better error handling, and a cleaner integration with the CI/CD system's programming environment.

💻 Platforms

API

🔌 Integrations

GitHub Actions GitLab CI Jenkins CircleCI Azure DevOps

💰 Pricing

Contact for pricing
Free Tier Available

Free tier: This is a CI/CD pattern; cost is based on CI/CD runner minutes and the ephemeral cloud resources provisioned.

Visit Dynamic Environment Provisioner for CI/CD Website →