Code
==================================
provider "aws" {
region = "ap-south-1"
access_key = ""
secret_key = ""
}
resource "aws_key_pair" "terraform-demo" {
key_name = "terraform-demo"
public_key = "file(/home/ec2-user/.ssh/authorized_keys)"
}
Error
Error: Error import KeyPair: InvalidKey.Format: Key is not in valid OpenSSH public key format
status code: 400, request id: fa4b1c85-4372-467a-a228-83a159a5d12b
on check.tf line 7, in resource "aws_key_pair" "terraform-demo":
7: resource "aws_key_pair" "terraform-demo" {
Solutions:
Try converting the key to an openssh format using the -f flag.
ssh-keygen -i -f /home/ec2-user/.ssh/authorized_keys > mykey-openssh.pub # NOT WORKING
ssh-keygen -f terraform_ec2_key # NOT WORKING
ssh-keygen -i -f terraform_ec2_key.pub > terraform_ec2_key1.pub # NOT WORKING
WORK IS IN PROGRESS
Terraform Basic Tutorial with Demo by Piyush 2020
Terraform Fundamental Tutorials by Harish in 2020
Terraform Fundamental Tutorial By Guru in 2020 Part-1
Terraform Fundamental Tutorial By Guru in 2020 Part-2
Terraform Fundamental Tutorial By Guru in 2020 Part-3
Terraform Fundamental Tutorial By Guru in 2020 Part-4
Terraform Fundamental Tutorial By Guru in 2020 Part-5
Terraform Advance Tutorial for Beginners with Demo 2020 — By DevOpsSchool
Latest posts by Rajesh Kumar (see all)
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024