I am pretty sure I created the TLS key pair PEM file correctly. Can anyone check my work? Take note that I already tried to create the file with and without the “.pem” file extension, and neither work.
The missing piece here is that it’s an AWS key pair; so there are 3 resources in the set:
resource "tls_private_key" "rsa-pk" {
  algorithm = "RSA"
  rsa_bits  = 4096
}
resource "aws_key_pair" "devops-kp" {
  key_name = "devops-kp"
  public_key = tls_private_key.rsa-pk.public_key_openssh    
}
resource "local_file" "devops-pk" {
    filename = "/home/bob/devops-kp.pem"
    content = tls_private_key.rsa-pk.private_key_pem
    file_permission = "0400"
}
        Thanks for the response. It works.
I think the task direction/procedure could be worded better. There is no mention of “AWS” for the key pair instruction, which is why I tried to create a 2 local_file resource the first time I did this. One for the public key and one for the private key.
Sometimes, the wording is a bit vague. This is not out of line how you’d get instructions IRL though – sometimes, you just have wing it a bit. Looking up tasks in the forum can be helpful too.
