pulumi/pulumi · error · Exception

Subclass of ResourceProvider must implement 'create'

Error message

Subclass of ResourceProvider must implement 'create'

What it means

ResourceProvider.create is an abstract-like base method that raises Exception when called. The dynamic provider runtime invokes create() on your subclass; if the subclass did not override it, this error surfaces at deployment time. Only create is strictly mandatory (read/diff/update have defaults).

Source

Thrown at sdk/python/lib/pulumi/dynamic/dynamic.py:239

    def diff(
        self,
        _id: str,
        _olds: dict[str, Any],
        _news: dict[str, Any],
    ) -> DiffResult:
        """
        Diff checks what impacts a hypothetical update will have on the resource's properties.
        """
        return DiffResult()

    def create(self, props: dict[str, Any]) -> CreateResult:
        """
        Create allocates a new instance of the provided resource and returns its unique ID
        afterwards. If this call fails, the resource must not have been created (i.e., it is
        "transactional").
        """
        raise Exception("Subclass of ResourceProvider must implement 'create'")

    def read(self, id_: str, props: dict[str, Any]) -> ReadResult:
        """
        Reads the current live state associated with a resource.  Enough state must be included in
        the inputs to uniquely identify the resource; this is typically just the resource ID, but it
        may also include some properties.
        """
        return ReadResult(id_, props)

    def update(
        self,
        _id: str,
        _olds: dict[str, Any],
        _news: dict[str, Any],
    ) -> UpdateResult:
        """
        Update updates an existing resource with new values.
        """

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Implement create(self, props) returning a dynamic.CreateResult(id_, outs={...}) on the subclass
  2. Check method spelling/casing matches exactly 'create'
  3. Use a base class or linter (abstract check) to ensure required methods are implemented before deploying

Example fix

// before
class Prov(dynamic.ResourceProvider):
    def update(self, id, olds, news): ...
// after
class Prov(dynamic.ResourceProvider):
    def create(self, props):
        return dynamic.CreateResult(id_='my-id', outs=props)
Defensive patterns

Strategy: validation

Validate before calling

class Prov(dynamic.ResourceProvider):
    def create(self, props):
        return dynamic.CreateResult(id_='id', outs=props)

assert isinstance(getattr(Prov, 'create'), type(Prov.create)) and Prov.create is not dynamic.ResourceProvider.create, 'override create()'

Type guard

def implements_create(cls):
    return cls.create is not dynamic.ResourceProvider.create

Try / catch

try:
    MyRes('r', props)
except Exception as e:
    if "must implement 'create'" in str(e):
        raise TypeError('ResourceProvider subclass missing create()') from e

Prevention

When it happens

Trigger: Subclassing pulumi.dynamic.ResourceProvider and registering a dynamic resource without defining a create method, then creating that resource in a stack.

Common situations: Copy-pasting a provider class and forgetting create; renaming create misspelled (e.g. Create) so the override doesn't bind; scaffolding a provider before implementing CRUD.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/13807ee3da866a14. Report an issue: GitHub.