Hello all, I am trying to import a key pair resour...
# aws
p
Hello all, I am trying to import a key pair resource with: key=pulumi_aws.ec2.KeyPair.get(“myKeyPairs”, id=‘key-00789edf16bef11xx’) but pulumi up is giving: “error: Preview failed: resource ‘key-00789edf16bef11xx’ does not exist”. While I can see this Key pair in console > EC2 > Key pairs, under ID column. Am I missing something?
l
Yes 😉
According to the documention (https://www.pulumi.com/registry/packages/aws/api-docs/ec2/keypair/#import), the import ID for key pairs is the name.
That's the first column, not the last column.
p
🙂 Thanks tenwit. I still don’t know how you understood this from the document. The doc is very confusing. To me,name is dealt differently from id in this doc. Anyways, no error from pulumi up ! thanks !
l
At the bottom of the page, the docs are about the import opt:
Key Pairs can be imported using the key_name, e.g.,
pulumi import awsec2/keyPairKeyPair deployer deployer-key
The docs are migrated from Terraform, so the name of the property doesn't always match up exactly, but
key_name
is pretty clear.
p
Thanks. “migrated from Terraform” is something I should consider. I always have issues with pulumi docs. 🙏