> ## Documentation Index
> Fetch the complete documentation index at: https://docs.envzero.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pulumi integration

> Deploy Pulumi stacks with env zero using Python, TypeScript, Go, and .NET, with PULUMI_ACCESS_TOKEN configuration and Pulumi remote backend state.

[Pulumi ](https://www.envzero.com/blog/what-is-pulumi-and-how-to-use-it-with-envzero) is an infrastructure-as-code framework that supports popular programming languages such as Go, JS/TS, Python, and .NET Platform. With env zero, you can enjoy all of the benefits that are built on top of it such as Plan on Pull Request, Drift Detection, and more...

Unlike the HCL language that is used in terraform, Pulumi represents the concept of writing IaC by commonly used programming languages. There are many benefits of such concept, for example, strong-type support, homogeneous codebase, testing easiness, etc. You can read more about Pulumi in their [docs.](https://www.pulumi.com/docs/)

## Environment Deployment

To manage your Pulumi executions in env zero, follow these steps:

1. Create a Pulumi [Template](https://docs.envzero.com/guides/admin-guide/templates.md) first.
2. Create [`env0.yml`](https://docs.envzero.com/guides/admin-guide/custom-flows) file in the target repository and inject a required packages installation command\
   (`npm i` for example, see [gist](https://gist.github.com/away168/50b406854197657d8a4631b9f52203e1)).
3. [Connect your cloud account](https://docs.envzero.com/guides/getting-started/connect-your-cloud-account.md)
4. Add `PULUMI_ACCESS_TOKEN` [environment variable](https://docs.envzero.com/guides/admin-guide/variables.md)
5. Create an environment, you can set the stack name if you already configured one, if not, env zero will create a random stack name.

> [!WARNING]
>
> State Storage
>
> Currently, env zero does not store the stack state, which means that it is saved in Pulumi's remote backend or using a Pulumi self-managed option. See [Pulumi Docs on State Storage ](https://www.pulumi.com/docs/concepts/state/)for more details.

## Execution Steps

Beyond the common steps such as Clone, Loading variables, etc. Deploy/Destroy Pulumi environment contains the following steps:

1. Pulumi Login - `pulumi login --non-interactive`
2. Stack Selection - `pulumi stack select --create <stack_name>`
3. Pulumi Preview - ` pulumi preview --refresh --diff --show-replacement-steps`
4. Pulumi Up - `pulumi up -f --yes --refresh --diff --show-replacement-steps `
5. Pulumi Stack Output
6. Pulumi Destroy - `pulumi destroy -f --yes --refresh --diff --show-replacement-steps`

Set `ENV0_PULUMI_SKIP_PREVIEW_REFRESH=true` to run the Pulumi Preview step without `--refresh`. See [Skip state refresh in Pulumi deploy previews](https://docs.envzero.com/guides/admin-guide/additional-controls.md#skip-state-refresh-in-pulumi-deploy-previews).

To add or turn off flags on the Preview, Up and Destroy commands, set `ENV0_PULUMI_CLI_ARGS_preview`, `ENV0_PULUMI_CLI_ARGS_up` or `ENV0_PULUMI_CLI_ARGS_destroy`. See [Pass custom CLI arguments to Pulumi commands](https://docs.envzero.com/guides/admin-guide/additional-controls.md#pass-custom-cli-arguments-to-pulumi-commands).

![Pulumi deployment execution steps showing Login, Stack Selection, Preview, Up, Output, and Destroy](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/325a55c-screen_shot_2022-03-24_at_15.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=e9e8036088e4d6b547c9071a8d129747)

## Additional Configuration

Check out [Pulumi's Environment Variable configurations](https://www.pulumi.com/docs/cli/environment-variables/) to further customize your environment

For example, to use your own S3 remote backend, create an Environment Variable in your env zero Environment with `PULUMI_BACKEND_URL=s3://your-pulumi-state-bucket`

## Next steps

Your Pulumi template needs access to the repository that holds your stack code, so [connect your VCS provider](https://docs.envzero.com/guides/admin-guide/manage-vcs.md) if you haven't yet.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.