I want to read the machine type from environment v...
# typescript
w
I want to read the machine type from environment variables but pulumi is expecting a
InstanceType
and I cannot figure out how to cast from one to the other.
s
Use
<aws.ec2.InstanceType> stringVariable
. E.g.
<aws.ec2.InstanceType> config.get("instanceType")
(copied from https://github.com/pulumi/examples/blob/master/aws-ts-ruby-on-rails/config.ts#L41)
w
That worked. Thank you.
b
FYI, I have opened this PR to relax this requirement
this will allow the aws.ec2.InstanceType or a string representation of it
w
To be fair, this only tripped me up because I'm new to Typescript. I prefer types be strong-typed if possible. Had I known how to cast I would have just done so.
s
@wide-holiday-59376 Nice to hear. I’m also in to have more types in Pulumi than less. Maybe you want to follow the PR, as well? Just added my 2 cents there.
w
Will do, thanks.