For `aws.ec2.KeyPair.get(...)` how would one use t...
# general
q
For
aws.ec2.KeyPair.get(...)
how would one use the
id
property for a key that already exists and wasn’t created through pulumi?
w
You can reference a resource managed outside of Pulumi using
.get()
no problem. You should be able to pass the KeyyPair's name as the
id
here. Does that not work for you? What error do you see?
q
I’m not sure how to do it.
const key = aws.ec2.KeyPair.get({ name: 'mykey',  id: ... });
^ pulumi wants id to be an
Input<string>
and not just a string
w
I believe you need;
const key = aws.ec2.KeyPair.get('mykey', id);
q
doh!
w
q
Yea I was looking at that, just failed to read for comprehension
I think that worked!
👍 1
thanks! 👍