Created
June 17, 2020 12:40
-
-
Save AmanM13/6069c5d576066ace8942c456db744a80 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 = "Aman-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