Deployment Triggers
A deployment trigger is a method of initializing a deployment. Deployments may be triggered in the following ways:
- Click to Deploy: Run any Deployments operation on demand by clicking a button in the Pulumi Cloud console UI
- GitHub Push to Deploy: Automatically run a
pulumi preview
when a Pull Request is created and/or runpulumi up
when a Pull Request is merged - Review Stacks: Create and deploy an ephemeral stack on the current branch whenever a new Pull Request is created, and tear it down automatically once the Pull Request is merged
- Scheduled Deployments: Run any Deployments operation on a recurring basis
- TTL Stacks: Run
pulumi destroy
on a stack (and optionally delete the stack entirely) after a specific amount of time has passed - REST API: Run any Deployments operation on demand, optionally with custom configuration, programmatically by issuing an HTTP request against the Pulumi Deployments REST API
- Deployment Webhooks: Trigger a Deployment in response to an event on another stack
Deployment Operations
Each Pulumi Deployment is centered around a given operation, that is, a pulumi
CLI command. Pulumi Deployment supports the following operations:
- Update: Run the
pulumi up
command to create or update stack resources - Preview: Review changes by running the
pulumi preview
command - Refresh: Update your stack’s state file with the current state of your resources from your cloud provider by running the
pulumi refresh
command - Destroy: Delete all resources in your stack by running the
pulumi destroy
command - Detect drift: Refresh your stack’s state file with the
pulumi refresh
command and fail if any changes are detected - Remediate drift: Refresh your stack’s state file and ensure that the state of your resources matches the declared state in your Pulumi program via the
pulumi update --refresh
command
Note that not every operation is available for every trigger.
Click to Deploy
A deployment may be triggered on demand by clicking a button in the Pulumi Console. This deployment trigger allows you to perform any supported Pulumi Deployments operation.
GitHub Push to Deploy
git push
.Pulumi Deployments can run a pulumi preview
for a stack (e.g., dev
) when a Pull Request is opened against a particular git branch (e.g., a proposed change to the main
branch). This will give the reviewer the full context necessary to understand the impact of the changes in your Pull Request: both the code changes and the changes to your resources (i.e., the pulumi preview
output). The Pulumi GitHub app will create or update a comment on your Pull Request with the results of pulumi preview
.
pulumi preview
on Pull Request capability requires that the Github user creating the Pull Request has their Github Organization Visibility set to Public
.GitHub Push to Deploy can also be configured to run a pulumi update
for a stack when changes are merged to a particular git branch. This feature is useful to enable continuous delivery, for example to a shared development or QA environment.
Scheduled Deployments
Scheduled Deployments allow you to define Pulumi Deployments operations that you want to occur on a regular basis. For example, you may want to schedule a nightly deployment for a shared QA environment.
Drift Detection is a specialized case of a Scheduled Deployment that allows you to ensure that your declared state in your Pulumi program has not diverged from the actual state of your resources.
TTL Stacks
TTL (Time to Live) Stacks are temporary stacks that are automatically destroyed after a specified period of time. TTL Stacks are useful for controlling cloud costs and improving security posture by ensuring resources are torn down once they are no longer needed.
Review Stacks
Review Stacks are dedicated cloud environments that get created automatically every time a pull request is opened. Open a pull request, and Pulumi Deployments will stand up a stack with your changes and the Pulumi GitHub App will add a PR comment with the outputs from your deployment. Merge the PR and Pulumi Deployments will destroy the stack and free up the associated resources.
REST API
The Pulumi Deployments REST API allows you to trigger a deployment programmatically. Your stack does not need to have any Deployments Settings pre-defined - you can pass them in as part of the request. Alternatively, if your stack does have defined Deployments Settings, you can override any values by passing them in as part of the request.
For more information, see Create Deployment in the Pulumi Deployments REST API docs.
Deployment Webhooks
Deployment Webhooks allow you to trigger Deployments on other stacks when a given event or occurs. Common use cases include:
- Update a dependent stack when an upstream stack (e.g. one that is referenced via a Stack Reference) changes.
- Update a higher environment (e.g. staging) when a lower environment (e.g. QA) successfully updates.
The Pulumi Auto Deploy package (currently in Preview) allows you to manage dependent stack updates in a declarative fashion.
Thank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.