Pulumi (TS) with Event Store Cloud Provider problem

I am trying to configure a cluster with Pulumi + TypeScript.

Following instructions, I install Pulumi with EventStore
npm install @eventstore/pulumi-eventstorecloud

Now the provider instructions mention that only the organizationId and the token are mandatory, and the others are optional. But that’s not true according to the ProviderArgs so I need to provide values I don’t know where to get them from, like clientId, tokenStore, identityProviderUrl and url.

const eventStoreDbProvider = new eventstore.Provider(
      `${args.prefix}-eventstoredb-provider`,
      {
        token: args.eventStoreDbToken,
        organizationId: args.eventStoreDbOrganizationId,
        clientId: "",
        tokenStore: "",
        identityProviderUrl: "",
        url: ""
      },
      {
        parent: this
      }
    );

Notice that I am not using the ENV variables, so I suppose I need to explicitly create a provider and then attach that provider to the resources I need to create with those Event Store Cloud Credentials.

I believe there is a bug in the Typescript ProviderArgs where the optional parameters should be optional.

Also, this example is very useful: pulumi-eventstorecloud/examples/nodejs/index.ts at main · EventStore/pulumi-eventstorecloud (github.com)

but it seems to use env variables, not explicit provider.

{
        parent: this, provider: awsOrEventStoreProvider // here
}

These values are optional. You can see that the TF provider (the Pulumi provider uses TF bridge) is setting those values if they are empty: https://github.com/EventStore/terraform-provider-eventstorecloud/blob/0e216bcb18ba60ac28eed471ceac5150cf4bb094/client/client.go#L70-L82

Empty strings are not valid for url and, possibly, for tokenStore.
See terraform-provider-eventstorecloud/client/client.go at 0e216bcb18ba60ac28eed471ceac5150cf4bb094 · EventStore/terraform-provider-eventstorecloud (github.com)

I updated the issue ProviderArgs are not optional and can’t be left as empty string · Issue #19 · EventStore/pulumi-eventstorecloud (github.com) as I believe this is a bug.

We are looking into this. On Terraform provider side, both tokenStore and url have default value functions. So, although both are “required”, they should get the default value. I am not quite sure how Terraform Bridge translates those requirements, to be honest. We’ll look into this, and also fix the release prefix issue, which looks somewhat related to our move to Pulumi registry and following their advices.

1 Like

For those who use Pulumi Automation API and require to set up the provider explicitly, here’s the issue link where we discussed a workaround (it works). We haven’t spent much time to understand why optional parameters in Terraform translate to mandatory parameters in Pulumi, mainly because it still works with the workaround described. I hope we can still fix it when we understand what to fix :slight_smile: