5.39.6 • Published 2 days ago

@webiny/pulumi v5.39.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

@webiny/pulumi

npm.io npm.io code style: prettier PRs Welcome

A small framework for creating flexible Pulumi programs.

Table of Contents

Installation

npm install --save @webiny/pulumi

Or if you prefer yarn:

yarn add @webiny/pulumi

Overview

The @webiny/pulumi package enables creation of flexible Pulumi apps (programs).

More specifically, a Pulumi app not only encapsulates the essential Pulumi program code defined by developers, but also, once defined, provides a way to adjust any defined cloud infrastructure resource configuration and even add new resources into the mix.

This is useful when you just want to export a simple constructor function to the user, and not bother them with all the internals. And, as mentioned, in those rare cases when the user actually needs to perform further adjustments, a Pulumi app provides a way to do it.

💡 TIP

Pulumi apps are heavily used in real Webiny projects. As mentioned, this is because of their ability to abstract the actual cloud infrastructure code from the user, and, at the same time, provide a way for the user to perform adjustments when needed.

The following example shows how a Pulumi app looks in the actual code:

// This is imported in our Pulumi program's entrypoint file (index.ts).
import createXyzApp from "@webiny/xyz-app";

export = async () => {
    const xyzApp = createXyzApp({
        pulumi: app => {
            // Let's imagine the `xyz` Pulumi app deploys an Amazon S3 bucket.
            // Then, we would be able to do something like the following:
            app.resources.bucket.config.acl(aws.s3.CannedAcl.Private);
            app.resources.bucket.config.forceDestroy(true);
        }
    });

    return xyzApp.run();
};

Examples

ExampleDescription
Quick ExampleShows how to create and use a simple Pulumi app.

Reference

Functions

createPulumiApp

export interface CreatePulumiAppParams<TResources extends Record<string, unknown>> {
    name: string;
    path: string;
    config?: Record<string, any>;
    program(app: PulumiApp): TResources | Promise<TResources>;
}

export declare function createPulumiApp<TResources extends Record<string, unknown>>(params: CreatePulumiAppParams<TResources>): PulumiApp<TResources>;

Creates a new Pulumi app.

// Defining the app.
import * as aws from "@pulumi/aws";
import { createPulumiApp } from "@webiny/pulumi";

export interface CreateMyAppParams {
    pulumi?: (app: ReturnType<typeof createMyApp>) => void;
}

const createMyApp = (projectAppConfig: CreateMyAppParams) => {
    const app = createPulumiApp({
        name: "my-app",
        path: "relative/path/from/cwd",
        program: async app => {
            const bucket = app.addResource(aws.s3.Bucket, {
                name: "my-app",
                config: {
                    acl: aws.s3.CannedAcl.PublicRead,
                    forceDestroy: false,
                    website: {
                        indexDocument: "index.html",
                        errorDocument: "index.html"
                    }
                }
            });

            app.addOutputs({
                appStorage: bucket.output.id
            });

            return {
                bucket
            };
        }
    });

    if (projectAppConfig.pulumi) {
        projectAppConfig.pulumi(app);
    }

    return app;
};
5.39.6

2 days ago

5.39.6-beta.1

2 days ago

5.39.6-beta.0

2 days ago

5.39.5

16 days ago

5.40.0-beta.2

16 days ago

5.39.5-beta.1

16 days ago

5.40.0-beta.1

22 days ago

5.39.4

28 days ago

5.39.4-beta.1

29 days ago

5.40.0-beta.0

1 month ago

5.39.4-beta.0

2 months ago

5.39.3

2 months ago

5.39.3-beta.0

2 months ago

5.39.3-beta.1

2 months ago

5.39.2

2 months ago

5.39.2-beta.2

2 months ago

5.39.2-beta.3

2 months ago

5.39.2-beta.1

2 months ago

5.39.2-beta.0

2 months ago

5.38.6

3 months ago

5.39.1

3 months ago

5.39.1-beta.1

3 months ago

5.39.0

3 months ago

5.39.1-beta.0

3 months ago

5.39.0-beta.2

3 months ago

5.39.0-beta.3

3 months ago

5.38.5-beta.0

4 months ago

5.38.5

4 months ago

5.38.4

4 months ago

5.38.4-beta.0

4 months ago

5.38.3-beta.1

4 months ago

5.38.3

4 months ago

5.38.3-beta.0

4 months ago

5.38.2

5 months ago

5.38.2-beta.0

5 months ago

5.37.2-beta.3

9 months ago

5.37.2-beta.2

9 months ago

5.39.0-beta.0

6 months ago

5.39.0-beta.1

6 months ago

5.38.0-beta.0

6 months ago

5.37.1-beta.3

9 months ago

5.37.1-beta.1

9 months ago

5.37.1-beta.2

9 months ago

5.37.3-beta.0

8 months ago

5.37.1-beta.0

9 months ago

5.37.6-beta.0

7 months ago

5.37.5-beta.0

7 months ago

5.37.3-beta.1

8 months ago

5.37.2-beta.1

9 months ago

5.37.6-beta.1

7 months ago

5.37.3-beta.2

8 months ago

5.37.2-beta.0

9 months ago

5.37.5-beta.1

7 months ago

5.37.4-beta.1

8 months ago

5.37.4-beta.0

8 months ago

5.37.8-beta.0

7 months ago

5.37.7-beta.0

7 months ago

5.38.0-beta.5

6 months ago

5.38.0-beta.6

6 months ago

5.38.0-beta.3

6 months ago

5.38.0-beta.4

6 months ago

5.38.0-beta.1

6 months ago

5.38.0-beta.2

6 months ago

5.38.1-beta.0

6 months ago

5.37.0-beta.3

10 months ago

5.37.0-beta.2

10 months ago

5.37.0-beta.1

10 months ago

5.37.7

7 months ago

5.37.8

7 months ago

5.37.5

7 months ago

5.37.6

7 months ago

5.37.3

8 months ago

5.37.4

8 months ago

5.37.1

9 months ago

5.37.2

9 months ago

5.37.0

10 months ago

5.34.9-beta.0

8 months ago

5.38.0

6 months ago

5.38.1

6 months ago

5.36.2

11 months ago

5.36.2-beta.2

11 months ago

5.36.2-beta.1

11 months ago

5.37.0-beta.0

11 months ago

5.36.2-beta.0

11 months ago

5.35.4

11 months ago

5.35.4-beta.1

11 months ago

5.35.4-beta.0

11 months ago

5.35.3

12 months ago

5.36.1

12 months ago

5.36.1-beta.1

12 months ago

5.36.1-beta.0

12 months ago

5.35.3-beta.0

12 months ago

5.36.0

12 months ago

5.36.0-beta.2

12 months ago

5.36.0-beta.1

12 months ago

5.36.0-beta.0

12 months ago

5.35.2

12 months ago

5.35.2-beta.0

12 months ago

5.35.1

12 months ago

5.35.1-beta.0

12 months ago

5.35.0

1 year ago

5.35.0-beta.2

1 year ago

5.35.0-beta.1

1 year ago

5.35.0-beta.0

1 year ago

5.34.8

1 year ago

5.34.8-beta.1

1 year ago

5.34.8-beta.0

1 year ago

5.34.7

1 year ago

5.34.7-beta.2

1 year ago

5.34.7-beta.1

1 year ago

5.34.7-beta.0

1 year ago

5.34.6

1 year ago

5.34.6-beta.6

1 year ago

5.34.6-beta.5

1 year ago

5.34.6-beta.4

1 year ago

5.34.6-beta.3

1 year ago

5.34.6-beta.2

1 year ago

5.34.6-beta.1

1 year ago

5.34.6-beta.0

1 year ago

5.34.5

1 year ago

5.34.5-beta.1

1 year ago

5.34.5-beta.0

1 year ago

5.34.4

1 year ago

5.34.4-beta.0

1 year ago

5.34.3

1 year ago

5.34.3-beta.3

1 year ago

5.34.3-beta.2

1 year ago

5.34.3-beta.1

1 year ago

5.34.3-beta.0

1 year ago

5.34.2

1 year ago

5.34.2-beta.2

1 year ago

5.34.2-beta.1

1 year ago

5.34.2-beta.0

1 year ago

5.34.1

1 year ago

5.34.1-beta.3

1 year ago

5.34.1-beta.2

1 year ago

5.34.1-beta.1

1 year ago

5.34.1-beta.0

1 year ago

5.34.0

1 year ago

5.34.0-beta.2

1 year ago

5.34.0-beta.1

1 year ago

5.34.0-beta.0

1 year ago

5.33.5

1 year ago

5.33.5-beta.0

1 year ago

5.33.4

1 year ago

5.33.4-beta.0

1 year ago

5.33.3

1 year ago

5.33.3-beta.0

1 year ago

5.33.2

1 year ago

5.33.2-beta.2

1 year ago

5.33.2-beta.1

1 year ago

5.33.2-beta.0

1 year ago

5.33.1

2 years ago

5.33.1-beta.0

2 years ago

5.33.0

2 years ago

5.33.0-beta.1

2 years ago

5.33.0-beta.0

2 years ago

5.32.0

2 years ago

5.32.0-beta.0

2 years ago

5.31.0

2 years ago

5.31.0-beta.1

2 years ago

5.31.0-beta.0

2 years ago

5.30.0

2 years ago

5.30.0-beta.1

2 years ago

5.30.0-beta.0

2 years ago

5.29.0

2 years ago

5.29.0-beta.2

2 years ago

5.29.0-beta.1

2 years ago

5.29.0-beta.0

2 years ago