# @nx-extend/pulumi
**Nx plugin for deploying your resources with [Pulumi](https://www.pulumi.com/)**.
## Features
- Manage infrastructure as code with Pulumi
- Multiple executors for different Pulumi operations
- Stack management and configuration
- Preview changes before applying
- Import existing resources
- Refresh state
## Setup
### Prerequisites
- Pulumi CLI installed and available in PATH
- Pulumi account and project configured
### Install
```sh
npm install -D @nx-extend/pulumi
nx g @nx-extend/pulumi:init
```
## Usage
### Available Executors
#### Up
Deploy your Pulumi stack:
```sh
nx run :up
```
##### Available options:
| Name | Type | Default | Description |
|------------|----------|---------|-------------------------------------------------------|
| **`stack`** | `string` | - | The target stack to use, if specified |
| **`root`** | `string` | - | The working directory to run Pulumi commands from |
#### Preview
Preview changes to your stack:
```sh
nx run :preview
```
##### Available options:
| Name | Type | Default | Description |
|------------|----------|---------|-------------------------------------------------------|
| **`stack`** | `string` | - | The target stack to use, if specified |
| **`root`** | `string` | - | The working directory to run Pulumi commands from |
#### Refresh
Refresh the state of your stack:
```sh
nx run :refresh
```
##### Available options:
| Name | Type | Default | Description |
|------------|----------|---------|-------------------------------------------------------|
| **`stack`** | `string` | - | The target stack to use, if specified |
| **`root`** | `string` | - | The working directory to run Pulumi commands from |
#### Import
Import existing resources into your Pulumi stack:
```sh
nx run :import
```
##### Available options:
| Name | Type | Default | Description |
|------------|----------|---------|-------------------------------------------------------|
| **`stack`** | `string` | - | The target stack to use, if specified |
| **`root`** | `string` | - | The working directory to run Pulumi commands from |
### Config
Set config variable:
```sh
nx config set --name="" --value=""
```
Set secret config variable:
```sh
nx config set --secret --name="" --value=""
```
##### Available options:
| Name | Type | Default | Description |
|--------------|-----------|---------|-----------------------------------------------------|
| **`stack`** | `string` | - | The target stack to use, if specified |
| **`root`** | `string` | - | The working directory to run Pulumi commands from |
| **`name`** | `string` | - | The name of the config key to set |
| **`value`** | `string` | - | The value to set |
| **`secret`** | `boolean` | `false` | Whether to store the value as a secret |
## Examples
### Basic Stack Deployment
```sh
nx run my-infrastructure:up --stack=production
```
### Preview Changes
```sh
nx run my-infrastructure:preview --stack=staging
```
### Set Configuration
```sh
nx config my-infrastructure set --name="region" --value="us-east-1"
nx config my-infrastructure set --secret --name="api-key" --value="secret-value"
```