Last active
June 14, 2020 15:18
-
-
Save rohitg00/bccfab41976749b610186ca3e47fd358 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Creating Key | |
resource "tls_private_key" "tls_key" { | |
algorithm = "RSA" | |
} | |
//Generating Key-Value Pair | |
resource "aws_key_pair" "generated_key" { | |
key_name = "rg-env-key" | |
public_key = "${tls_private_key.tls_key.public_key_openssh}" | |
depends_on = [ | |
tls_private_key.tls_key | |
] | |
} | |
//Saving Private Key PEM File | |
resource "local_file" "key-file" { | |
content = "${tls_private_key.tls_key.private_key_pem}" | |
filename = "rg-env-key.pem" | |
depends_on = [ | |
tls_private_key.tls_key | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment