I am trying to complete the first task in the terraform KK Engineer course.
The requirement I did not satisfy is as follows:
‘devops-kp’ doesn’t exist or or its type is not ‘rsa’.
I was able to create an RSA private key devops-kp.pem and save it to the indicated path /home/bob/. I was also able to verify that it is an RSA private key with the openssl tool. (see image below)
I satisfied all the requirements best I can tell - what am I missing?
Have you shared an incomplete Terraform file?
Because this also requires a aws_key_pair resource as well.
Try this; make sure you update the key_name accordingly.
resource "tls_private_key" "rsa_key"{
algorithm = "RSA"
rsa_bits = 4096
}
resource "aws_key_pair" "aws_key" {
key_name = "devops-kp"
public_key = tls_private_key.rsa_key.public_key_openssh
}
resource "local_file" "key_local" {
content = tls_private_key.rsa_key.private_key_pem
filename = "/home/bob/devops-kp.pem"
}
1 Like
Thank you for the response! I can confirm inclusion of the AWS module is required to complete the lab.
I believe the problem of understanding was in the requirements stated beneath the text.
I satisfied all requirements dictated below, but did not use the AWS module to do so. I could have inferred I should’ve used the AWS module given its presence in the provider.tf and mention of AWS in the problem statement, but given the way these labs build upon each other, I had (incorrectly) assumed the AWS piece would come into play later.
If I may suggest it, declaring an additional requirement to utilize the AWS module would be very helpful, without giving away how to implement it.
Thank you for the help!