Note able to validate terraform level 1 task 1

Hi everyone,

I’m having an issue with the first challenge of Terraform Level 1.

I believe I’m following all the steps correctly, but when I try to validate the task, I get an error saying that it can’t find a key with the name “devops-kp”.

Below is a screenshot showing the environment I submitted for evaluation.

Can anyone tell me if there anything wrong my configs or if is a lab issue?

I also tryed this approach:

Update:

able to complete with the following main.tf

resource "tls_private_key" "xfusion-kp" {
  algorithm = "RSA"
  rsa_bits  = 2048
}

resource "aws_key_pair" "xfusion-kp" {
  key_name   = "xfusion-kp"
  public_key = tls_private_key.xfusion-kp.public_key_openssh
}

resource "local_file" "private_key" {
  content  = tls_private_key.xfusion-kp.private_key_pem
  filename = "/home/bob/xfusion-kp.pem"
}

output "tls_private_key" {
  value       = tls_private_key.xfusion-kp.private_key_pem
  sensitive   = true
  description = "The private key in PEM format."
}

output "tls_fingerprint" {
  value       = tls_private_key.xfusion-kp.public_key_fingerprint_sha256
  description = "The public key fingerprint in SHA256 format."
}
4 Likes