Someone who's more familiar with pulumi's typscrip...
# typescript
s
Someone who's more familiar with pulumi's typscript judo know of a way to work around the
Input<Region> | undefined
limitation when I try to dynamically create
aws.Provider
? I'm trying to do the following to get around another issue with default providers and using
aws:profile
configs:
Copy code
import { getConfig } from "@pulumi/pulumi/runtime/config";

    const defaultProvider = new aws.Provider(`${stack}-peer-provider`, {
        region: getConfig("aws:region"),
        profile: "org_prod"
    });
You get:
Copy code
error TS2322: Type 'string | undefined' is not assignable to type 'Input<Region> | undefined'.
      Type 'string' is not assignable to type 'Input<Region> | undefined'
So I would need to fudge that enum constant somehow but am kind of lost on how I would do that considering its expecting it to be an Input<>
s
You can fix this with a type assertion. Put "as Region" after your region value (import Region from the pulumi aws package)
s
It works! Thx a bunch!
My typescript is still mediocre at best
s
You'll get better. It just takes time :)