Resource block key pair is failing with path

Resource block is failing with below path, But I have download key value pair correctly in the AWS and provided same path in the below area, but it is giving error. Please help on how to fix this. Thank you

I think your line 219 has to change to:
Your resource name has to change from web to wsk1 as shown below:

resource "aws_key_pair" "wsk1" {
  public_key = file("C:/Users/kumar/downloads/wsk1.pem")

Hi Ram Sateesh,

Thank you for the response, looks like what you suggested is working , however I encountered different error now, Do I need to change key length, if yes how?
I took and pasted whatever machine generated.

Hi @sk8228402,

The aws_key_pair resource registers a public key which your Linux instances will add to the authorized_keys file for your main user on boot. Public keys are usually given in the OpenSSH public key format, which has a single line of text containing a key type and then base64-encoded key material.

You seem to be providing the contents of a .pem file, which is typically used for the private key. You’ve therefore now shared your private key with the remote API and so you should destroy it and generate a new one that hasn’t been compromised. The private key file should not be sent to any other system because it is your secret credential for use only on your current computer.

Hi Mart,

which one I should choose here while creating new key pair?