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

# Install and Manage using Pulumi

> Install, upgrade, and manage Control Plane Template Catalog releases using the Pulumi provider. Covers prerequisites, CatalogTemplate resource configuration, and lifecycle management.

## Prerequisites

<AccordionGroup>
  <Accordion title="Pulumi installed">
    Install the Pulumi CLI. See [Pulumi Provider](/iac/pulumi) for installation instructions.
  </Accordion>

  <Accordion title="Control Plane provider installed">
    Install the [Control Plane Pulumi provider](https://www.pulumi.com/registry/packages/cpln/api-docs/catalogtemplate/) and configure your organization. See [Pulumi Provider](/iac/pulumi) for setup instructions.
  </Accordion>
</AccordionGroup>

## Install a Template

Use the `CatalogTemplate` resource to install a template from the catalog.

<Steps>
  <Step title="Choose a Template">
    Browse the available templates in the [Template Catalog](/template-catalog/overview#available-templates) and identify the template name and version you want to install.
  </Step>

  <Step title="Add a Values File">
    Create a `values.yaml` file in your Pulumi project directory with the template's configuration. Refer to the specific template's documentation for available options.
  </Step>

  <Step title="Define the Resource">
    Add a `CatalogTemplate` resource to your Pulumi program, reading the values from the file:

    <Tabs>
      <Tab title="TypeScript">
        ```typescript theme={null}
        import * as cpln from '@pulumiverse/cpln';
        import * as fs from 'fs';

        const values = fs.readFileSync('values.yaml', 'utf8');

        const release = new cpln.CatalogTemplate('example', {
            name: 'my-release',
            template: 'postgres',
            version: '1.0.0',
            gvc: 'my-gvc',
            values: values,
        });
        ```
      </Tab>

      <Tab title="Python">
        ```python theme={null}
        import pulumiverse_cpln as cpln
        from pathlib import Path

        values = Path("values.yaml").read_text()

        release = cpln.CatalogTemplate(
            "example",
            name="my-release",
            template="postgres",
            version="1.0.0",
            gvc="my-gvc",
            values=values,
        )
        ```
      </Tab>

      <Tab title="Go">
        ```go theme={null}
        package main

        import (
            "os"

            "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
            "github.com/pulumiverse/pulumi-cpln/sdk/go/cpln"
        )

        func main() {
            pulumi.Run(func(ctx *pulumi.Context) error {
                valuesBytes, err := os.ReadFile("values.yaml")
                if err != nil {
                    return err
                }

                _, err = cpln.NewCatalogTemplate(ctx, "example", &cpln.CatalogTemplateArgs{
                    Name:     pulumi.String("my-release"),
                    Template: pulumi.String("postgres"),
                    Version:  pulumi.String("1.0.0"),
                    Gvc:      pulumi.String("my-gvc"),
                    Values:   pulumi.String(string(valuesBytes)),
                })
                return err
            })
        }
        ```
      </Tab>

      <Tab title="C#">
        ```csharp theme={null}
        using Pulumi;
        using Pulumiverse.Cpln;
        using System.IO;

        return await Deployment.RunAsync(() =>
        {
            var values = File.ReadAllText("values.yaml");

            var release = new CatalogTemplate("example", new CatalogTemplateArgs
            {
                Name = "my-release",
                Template = "postgres",
                Version = "1.0.0",
                Gvc = "my-gvc",
                Values = values,
            });
        });
        ```
      </Tab>
    </Tabs>

    Properties:

    * **name** — A unique release name for this installation.
    * **template** — The name of the catalog template (e.g., `postgres`).
    * **version** — The template version to install.
    * **gvc** — The GVC to deploy to. Leave empty if the template creates its own GVC.
    * **values** — YAML-formatted string to customize the template configuration.
  </Step>

  <Step title="Deploy">
    Deploy the stack:

    ```bash theme={null}
    pulumi up
    ```

    Pulumi will provision the required Control Plane resources based on your configuration.
  </Step>
</Steps>

### Outputs

After deploying, the resource exposes a `resources` output containing a list of all Control Plane resources created by the release. Each entry includes:

* **kind** — The resource type (e.g., `workload`, `secret`, `gvc`).
* **name** — The resource name.
* **link** — The full Control Plane URL for the resource.

## Manage a Template

### Upgrade

To upgrade a release with new values or a new template version, update the `version` property and/or your `values.yaml` file and re-deploy:

```bash theme={null}
pulumi up
```

<Note>
  Any workloads affected by the change will roll out new deployments. Unchanged items will not be redeployed.
</Note>

### Preview Changes

Use `pulumi preview` to see the changes that will be applied before upgrading:

```bash theme={null}
pulumi preview
```

## Uninstall a Template

Remove the `CatalogTemplate` resource from your program and deploy:

```bash theme={null}
pulumi up
```

Alternatively, destroy all resources in the stack:

```bash theme={null}
pulumi destroy
```

This deletes all Control Plane resources created by the release.
