Skip to content

Instantly share code, notes, and snippets.

@usrbinkat
Created October 9, 2023 19:27
Show Gist options
  • Save usrbinkat/56badb02c1b4c8b19151874999c64de8 to your computer and use it in GitHub Desktop.
Save usrbinkat/56badb02c1b4c8b19151874999c64de8 to your computer and use it in GitHub Desktop.
Pulumi Dynamic Provider Cheat Sheet

Pulumi Dynamic Resources Quick Reference

Overview

  • Module for inline implementation of Pulumi Resource's CRUD operations.
  • Part of the @pulumi/pulumi package.

Resource Class

  • new Resource(provider, name, props, opts?, module?, type)
    • provider: CRUD operations implementation.
    • name: Resource name.
    • props: Arguments to populate the new resource.
    • opts: Options bag.
    • module: Resource module.
    • type: Resource type.
  • Methods:
    • getProvider(moduleMember: string): Returns ProviderResource or undefined.
    • isInstance(obj: any): Checks if object is an instance of CustomResource.
  • Properties:
    • id: Provider-assigned unique ID.
    • urn: Stable logical URN.

Interfaces

CheckFailure

  • property: Property that failed validation.
  • reason: Reason for failure.

CheckResult

  • failures: Array of CheckFailure.
  • inputs: Inputs to use.

CreateResult

  • id: ID of the created resource.
  • outs: Properties computed during creation.

DiffResult

  • changes: Indicates if update is needed.
  • deleteBeforeReplace: Indicates if deletion is needed before replacement.
  • replaces: Properties triggering replacement.
  • stables: Properties that will not change.

ReadResult

  • id: ID of the resource read back.
  • props: Current property state.

ResourceProvider

  • Methods:
    • check(olds, news): Validates property bag.
    • create(inputs): Allocates new resource instance.
    • delete(id, props): Tears down existing resource.
    • diff(id, olds, news): Checks update impacts.
    • read(id, props): Reads current live state.
    • update(id, olds, news): Updates existing resource.

UpdateResult

  • outs: Properties computed during updating.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment