Terraform level 1 - 1st lab seems impossible to pass

Hello,

The exercise is checking the key type to be RSA. But it seems impossible to solve.

Terraform may not retrieve this key_type attribute, because AWS does not expose this information through its APIs. As a result, Terraform cannot populate the key_type field, leaving it empty.

Here is the response message from an aws cli 1.40 (the one installed in the lab. I also tried with cli v2)

2025-05-10 07:23:41,030 - MainThread - botocore.parsers - DEBUG - Response body:
b'
<?xml version=\'1.0\' encoding=\'utf-8\'?>\n
<DescribeKeyPairsResponse
	xmlns="http://ec2.amazonaws.com/doc/2016-11-15">
	<keySet>
		<item>
			<keyPairId>key-ccdcceaeb2b162f6b</keyPairId>
			<createTime>2025-05-10T07:21:34.549000Z</createTime>
			<keyName>devops-kp</keyName>
			<keyFingerprint>32:d7:9e:1f:86:b8:5a:4b:91:6b:a0:b7:c7:e4:9b:4e</keyFingerprint>
		</item>
	</keySet>
	<requestId>585fecd2-8c61-4260-8247-d7373461b58e</requestId>
</DescribeKeyPairsResponse>'

Regards,

Please provide a link to the lab.

Hello Alistair,
Here is the lab: https://engineer.kodekloud.com/task?id=6818ba8bcbecfd499a8c85a7
Regards,
Florent

I think it is a grader error. Reported to concerned team

1 Like

The lab is working.

Terraform does not need to retrieve the key type from AWS. You create the RSA key material first with terraform and then upload that to AWS with aws_key_pair

The solution in the first post here: Issue in Terraform task does work. Note the 3 resources

  1. To create the key pair locally
  2. To upload the public key to AWS, thus creating the key pair resource
  3. To save the private key as PEM to bob’s home directory.