OK, I'll start the TS questions. (Forgive my poten...
# typescript
s
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
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
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
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
if you need some more examples of apply let us know
s
Yes, some examples of times when you need to use
.apply
would be helpful, thanks!