Dear all,
I’m fairly new to Terraform et al, please excuse any gap in knowledge and experience. I’m working on setting up a Nomad cluster on AWS, with a separate instance serving as a Vault CA. I’m using Terraform Cloud and want to have SSH access to all instances. As for the generated key pair:
resource “tls_private_key” “private_key” {
algorithm = “RSA”
rsa_bits = 4096
}
resource “aws_key_pair” “generated_key” {
key_name = “tf-key”
public_key = tls_private_key.private_key.public_key_openssh
}
I’m wondering if there is a way to store the private key somewhere in Terraform Cloud so I download it in order to use it for logging into the AWS instances. The only way I’ve found is grabbing it from the state file. Alternatively, I tried using a pre-generated key pair and save public and private keys as environment variables but that didn’t work for me either.
Thanks for your thoughts and guidance on this matter.
Cheers
Philipp