On running "terraform apply" the following error is thrown
Error: Error import KeyPair: InvalidKey.Format: Key is not in valid OpenSSH public key format
│ status code: 400, request id: 0cb63772-f4d8-49a5-9454-6e97f7c36742
│
│ with aws_key_pair.terraformkey,
│ on aws.tf line 9, in resource "aws_key_pair" "terraformkey":
│ 9: resource "aws_key_pair" "terraformkey" {
On running "terraform apply" the following error is thrown Error: Error import KeyPair: InvalidKey.Format: Key is not in valid OpenSSH public key format │ status code: 400, request id: 0cb63772-f4d8-49a5-9454-6e97f7c36742 │ │ with aws_key_pair.terraformkey, │ on aws.tf line 9, in resource "aws_key_pair" "terraformkey": │ 9: resource "aws_key_pair" "terraformkey" {
Issue seems to be because of the way file is handled as discussed here https://github.com/aws/aws-cli/issues/4969 Need to use aws cli version 1