# Portainer Provider

> Manage container environments with Portainer using Pulumi

The Portainer provider enables you to manage container environments, stacks, users, and teams in Portainer using Pulumi. This provider is dynamically bridged from the [Terraform Portainer Provider](https://registry.terraform.io/providers/portainer/portainer).

## Installation

Install the Portainer provider package using your preferred package manager:

<Tabs>
  <Tab title="bun">
    ```bash
    bun add pulumi-portainer
    ```
  </Tab>
  <Tab title="pnpm">
    ```bash
    pnpm add pulumi-portainer
    ```
  </Tab>
  <Tab title="yarn">
    ```bash
    yarn add pulumi-portainer
    ```
  </Tab>
  <Tab title="npm">
    ```bash
    npm install pulumi-portainer
    ```
  </Tab>
</Tabs>

## Configuration

### Provider Setup

```bash
pulumi config set portainer:url https://portainer.example.com
pulumi config set portainer:username admin
pulumi config set portainer:password YOUR_PASSWORD --secret
```

Or using environment variables:

```bash
export PORTAINER_URL="https://portainer.example.com"
export PORTAINER_USERNAME="admin"
export PORTAINER_PASSWORD="your-password"
```

## Quick Start

```typescript
import * as pulumi from "@pulumi/pulumi";
import * as portainer from "pulumi-portainer";

// Deploy a stack
const stack = new portainer.Stack("web-app", {
    name: "web-application",
    environmentId: 1,
    stackFile: `
version: '3'
services:
  web:
    image: nginx:latest
    ports:
      - "80:80"
`,
});

export const stackId = stack.id;
```

## Key Features

### Stack Management

```typescript
const appStack = new portainer.Stack("app", {
    name: "web-application",
    environmentId: environment.id,
    stackFile: stackContent,
});
```

### Environment Management

```typescript
const environment = new portainer.Environment("docker", {
    name: "Production Docker",
    type: "docker",
    url: "tcp://docker.example.com:2375",
});
```

### User Management

```typescript
const user = new portainer.User("developer", {
    username: "dev-user",
    password: "secure-password",
    role: 2, // Standard user
});
```
