https://pulumi.com logo
#typescript
Title
# typescript
p

polite-motherboard-78438

03/07/2020, 5:15 PM
Hello. I am new to Pulumi and Typescript and I am trying to create a DigitalOcean Kubernetes cluster. The cluster resource have a property region of type "digitalocean.Region" that I want to make configurable. It is possible to read a string from config and convert it to an object of that type without manually mapping? Here is the type definitions of the region object:
l

limited-rainbow-51650

03/07/2020, 5:35 PM
As a
Region
seems to be a
string
, isn’t it possible to pass a config property of type
string
?
p

polite-motherboard-78438

03/08/2020, 12:02 PM
No, The compiler complains it required an object. Solved it with a simple cast
Copy code
export const clusterRegion =
  <Region>config.get("clusterRegion") || Regions.FRA1;
👍🏼 1