pulumi/sdk/nodejs/tests/cmd/dynamic
Julien 6e39175f8d
Allow accessing configuration in Node.js dynamic providers (#17697)
This PR follows https://github.com/pulumi/pulumi/pull/17673 by adding a
`configure` method to Node.js dynamic providers.

The `configure` method of the `ResourceProvider` interface is called
with a `ConfigureRequest` that holds the stack’s configuration, and
allows the provider implementation to retrieve and store configuration
values for later use.

```typescript
class MyResourceProvider implements pulumi.dynamic.ResourceProvider {
    private password: string;

    async configure(req: pulumi.dynamic.ConfigureRequest): Promise<void> {
        this.password = req.config.require("password");
    }

    async create(props: any): Promise<pulumi.dynamic.CreateResult> {
      // use self.password
    }
}
```

---------

Co-authored-by: Will Jones <will@sacharissa.co.uk>
2024-11-07 14:34:11 +00:00
..
config.spec.ts Allow accessing configuration in Node.js dynamic providers (#17697) 2024-11-07 14:34:11 +00:00