https://pulumi.com logo
Title
s

salmon-account-74572

05/10/2019, 9:05 PM
OK, I'll start the TS questions. (Forgive my potentially incorrect terminology; gently correct me where needed.) I understand that properties of a class like
aws.ec2.Instance
are of type Input. How does one take the result of a function like
aws.getAmi
(which is a Promise, AIUI) and use it to specify a value for a property?
b

best-gigabyte-81826

05/10/2019, 9:21 PM
If you look at the docs, you will usually find example usage. In this case use
pulumi.output(aws.ec2.getAmi())
to get the value of Input type
s

salmon-account-74572

05/10/2019, 9:25 PM
I did find that in an example, thanks. I've also seen references to needing to use the
.apply
method and an arrow function in order to access the
.id
property of the Output. Can you provide a high-level explanation of whether this is indeed required and why?
b

best-gigabyte-81826

05/10/2019, 9:44 PM
mostly Input type is used to reference other resources. In some cases (e.g. when you need JSON / string construction) you may need access to raw value. That is where you will want to use
.apply
https://pulumi.io/reference/programming-model.html#outputs
o

orange-tailor-85423

05/10/2019, 10:18 PM
if you need some more examples of apply let us know
s

salmon-account-74572

05/13/2019, 10:24 PM
Yes, some examples of times when you need to use
.apply
would be helpful, thanks!