or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

asset-management.mdautomation.mdconfiguration.mddynamic-resources.mdindex.mdlogging-diagnostics.mdoutput-system.mdprovider-development.mdresource-management.mdruntime-operations.mdstack-references.mdutilities.md
tile.json

tessl/npm-pulumi--pulumi

Pulumi's Node.js SDK for infrastructure-as-code platform that allows you to create, deploy, and manage infrastructure using familiar programming languages and tools.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@pulumi/pulumi@3.193.x

To install, run

npx @tessl/cli install tessl/npm-pulumi--pulumi@3.193.0

index.mddocs/

Pulumi Node.js SDK

Pulumi's Node.js SDK is a comprehensive infrastructure-as-code platform that enables developers to define, deploy, and manage cloud infrastructure using TypeScript and JavaScript. The SDK provides a declarative resource model with support for major cloud providers including AWS, Azure, Google Cloud Platform, and Kubernetes, featuring strongly-typed APIs, automatic dependency management, and state management.

Package Information

  • Package Name: @pulumi/pulumi
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @pulumi/pulumi

Core Imports

import * as pulumi from "@pulumi/pulumi";

Import specific components:

import { Config, Output, Resource, ComponentResource } from "@pulumi/pulumi";

For CommonJS:

const pulumi = require("@pulumi/pulumi");
const { Config, Output, Resource } = require("@pulumi/pulumi");

Basic Usage

import * as pulumi from "@pulumi/pulumi";

// Configuration management
const config = new pulumi.Config();
const name = config.get("name") || "world";

// Resource creation with outputs
const bucket = new aws.s3.Bucket("my-bucket", {
  website: {
    indexDocument: "index.html",
  },
});

// Export stack outputs
export const bucketName = bucket.id;
export const websiteUrl = pulumi.interpolate`http://${bucket.websiteEndpoint}`;

Architecture

Pulumi's Node.js SDK is built around several key components:

  • Resource Model: Declarative resource definitions with dependency tracking
  • Output System: Async value management with automatic dependency resolution
  • Configuration: Secure configuration and secrets management per stack
  • Provider System: Extensible provider architecture supporting 120+ cloud providers
  • Automation: Programmatic stack and workspace management capabilities
  • Runtime System: Serialization, state management, and execution orchestration

Capabilities

Configuration Management

Secure configuration and secrets management for different environments and stacks. Supports both plain text and encrypted secret values.

class Config {
  constructor(name?: string);
  get<K>(key: string, opts?: StringConfigOptions<K>): K | undefined;
  getSecret<K>(key: string, opts?: StringConfigOptions<K>): Output<K | undefined>;
  require<K>(key: string, opts?: StringConfigOptions<K>): K;
  requireSecret<K>(key: string, opts?: StringConfigOptions<K>): Output<K>;
  getBoolean(key: string): boolean | undefined;
  getNumber(key: string, opts?: NumberConfigOptions): number | undefined;
  getObject<T>(key: string): T | undefined;
}

Configuration

Output System

Async value management with dependency tracking for handling promises and resource dependencies throughout your infrastructure code.

class Output<T> {
  apply<U>(func: (t: T) => Input<U>): Output<U>;
  isKnown: Promise<boolean>;
  isSecret: Promise<boolean>;
}

function output<T>(val: Input<T>): Output<Unwrap<T>>;
function secret<T>(val: Input<T>): Output<Unwrap<T>>;
function all<T>(values: T): Output<UnwrappedObject<T>>;
function interpolate(literals: TemplateStringsArray, ...placeholders: Input<any>[]): Output<string>;

type Input<T> = T | Promise<T> | OutputInstance<T>;

Output System

Resource Management

Core infrastructure resource management with lifecycle management, dependency tracking, and provider integration.

abstract class Resource {
  readonly urn: Output<string>;
  protected constructor(type: string, name: string, opts?: ResourceOptions);
}

class CustomResource extends Resource {
  readonly id: Output<ID>;
  protected constructor(type: string, name: string, props?: any, opts?: CustomResourceOptions);
}

class ComponentResource<TData = any> extends Resource {
  protected constructor(type: string, name: string, opts?: ComponentResourceOptions);
  registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void;
}

interface ResourceOptions {
  dependsOn?: Input<Input<Resource>[]> | Input<Resource>;
  protect?: boolean;
  parent?: Resource;
  provider?: ProviderResource;
  version?: string;
}

Resource Management

Stack References

Access outputs from other Pulumi stacks for cross-stack dependencies and data sharing.

class StackReference extends CustomResource {
  constructor(name: string, args: StackReferenceArgs, opts?: CustomResourceOptions);
  getOutput(name: Input<string>): Output<any>;
  requireOutput(name: Input<string>): Output<any>;
  readonly outputs: Output<{[name: string]: any}>;
  readonly secretOutputNames: Output<string[]>;
}

Stack References

Asset Management

File and archive management for deploying code, configurations, and other artifacts to cloud resources.

abstract class Asset {}
abstract class Archive {}

class FileAsset extends Asset {
  constructor(path: string);
}

class StringAsset extends Asset {
  constructor(text: string);
}

class FileArchive extends Archive {
  constructor(path: string);
}

class AssetArchive extends Archive {
  constructor(assets: AssetMap);
}

type AssetMap = {[name: string]: Asset | Archive};

Asset Management

Automation

Programmatic stack and workspace management for building deployment tooling and CI/CD integration.

class LocalWorkspace {
  static create(args?: LocalWorkspaceOptions): Promise<LocalWorkspace>;
  static createStack(args: LocalProgramArgs): Promise<Stack>;
  static selectStack(args: LocalProgramArgs): Promise<Stack>;
}

class Stack {
  constructor(name: string, workspace: Workspace);
  up(opts?: UpOptions): Promise<UpResult>;
  preview(opts?: PreviewOptions): Promise<PreviewResult>;
  destroy(opts?: DestroyOptions): Promise<DestroyResult>;
  refresh(opts?: RefreshOptions): Promise<RefreshResult>;
}

Automation

Dynamic Resources

Create custom resource providers in TypeScript/JavaScript for managing resources not supported by existing providers.

class dynamic.Resource extends CustomResource {
  constructor(
    provider: ResourceProvider<Inputs, Outputs>,
    name: string,
    props: Inputs,
    opts?: CustomResourceOptions
  );
}

interface ResourceProvider<Inputs, Outputs> {
  create?(inputs: Inputs): Promise<CreateResult<Outputs>>;
  read?(id: string, props?: any): Promise<ReadResult<Outputs>>;
  update?(id: string, olds: Outputs, news: Inputs): Promise<UpdateResult<Outputs>>;
  delete?(id: string, props: Outputs): Promise<void>;
}

Dynamic Resources

Provider Development

Build and maintain custom Pulumi resource providers for new cloud services and infrastructure platforms.

interface Provider {
  check?(urn: string, olds: any, news: any): Promise<CheckResult>;
  create?(urn: string, inputs: any): Promise<CreateResult>;
  read?(id: string, urn: string, props?: any): Promise<ReadResult>;
  update?(id: string, urn: string, olds: any, news: any): Promise<UpdateResult>;
  delete?(id: string, urn: string, props: any): Promise<void>;
  construct?(name: string, type: string, inputs: any, options: any): Promise<ConstructResult>;
  invoke?(token: string, inputs: any): Promise<InvokeResult>;
}

function main(provider: Provider, args?: string[]): Promise<void>;

Provider Development

Runtime Operations

Low-level runtime functions for resource registration, serialization, and state management.

function registerResource(
  res: Resource,
  type: string,
  name: string,
  props: Inputs,
  opts?: ResourceOptions
): Promise<void>;

function invoke(
  token: string,
  props: Inputs,
  opts?: InvokeOptions
): Promise<any>;

function invokeOutput(
  token: string,
  props: Inputs,
  opts?: InvokeOutputOptions
): Output<any>;

Runtime Operations

Logging and Diagnostics

Structured logging and error handling for infrastructure deployment diagnostics.

function debug(msg: string, resource?: Resource): void;
function info(msg: string, resource?: Resource): void;
function warn(msg: string, resource?: Resource): void;
function error(msg: string, resource?: Resource): void;

class RunError extends Error {}
class ResourceError extends Error {
  constructor(message: string, resource: Resource | undefined, hideStack?: boolean);
}

Logging and Diagnostics

Utilities

Helper functions and utilities for common operations in Pulumi programs.

function isInstance<T>(obj: any, name: string): obj is T;
function hasTrueBooleanMember(obj: any, memberName: string): boolean;
function values(obj: any): any[];

function getOrganization(): string;
function getProject(): string;
function getStack(): string;
function getRootDirectory(): string;

Utilities

Error Handling

Pulumi provides structured error types for different failure scenarios:

class RunError extends Error {}
class ResourceError extends Error {
  constructor(message: string, resource: Resource | undefined, hideStack?: boolean);
}
class InputPropertyError extends Error {
  propertyPath: string;
  reason: string;
}
class InputPropertiesError extends Error {
  properties: string[];
  reasons: string[];
}

Types

type Input<T> = T | Promise<T> | OutputInstance<T>;
type Inputs = Record<string, Input<any>>;
type ID = string;
type URN = string;

type Unwrap<T> = T extends OutputInstance<infer U> ? U :
  T extends Promise<infer U> ? U :
  T;

type Lifted<T> = {
  [K in keyof T]: Output<T[K]>;
};