https://pulumi.com logo
q

quick-action-34599

04/10/2019, 6:52 PM
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

white-balloon-205

04/10/2019, 7:07 PM
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

quick-action-34599

04/10/2019, 7:13 PM
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

white-balloon-205

04/10/2019, 7:15 PM
I believe you need;
const key = aws.ec2.KeyPair.get('mykey', id);
q

quick-action-34599

04/10/2019, 7:16 PM
doh!
w

white-balloon-205

04/10/2019, 7:16 PM
q

quick-action-34599

04/10/2019, 7:16 PM
Yea I was looking at that, just failed to read for comprehension
I think that worked!
👍 1
thanks! 👍