Get ssh_public_key_id from AWS key pair

Howdy folks. I’m attempting to retrieve the public key value for IAM-associated key pairs in AWS, so that I may add them to instances.

As I do not want Terraform to manage these keys itself (the private keys are unknown to me) I am trying to use “data. aws_iam_user_ssh_key” to retrieve the public key.

Can you tell me where I might find a value for “ssh_public_key_id”?

I have tried the id value from the AWS console, which looks like “key-1fe2d2ed42e23e77e” but fails the regex validation ([\w]).

Taking the “key-” off the start similarly doesn’t work, and the “fingerprint” value also fails.

Using the public key value itself also failed the regex validation.

I am using version 4.24.0 of the hashicorp/aws provider.

any help would be much appreciated,

Thanks.