Update main.tf
This commit is contained in:
parent
f2079c0825
commit
39e329c99e
17
main.tf
17
main.tf
|
@ -30,6 +30,23 @@ resource "aws_route_table_association" "public-rt-association" {
|
|||
route_table_id = aws_route_table.public-rt.id
|
||||
}
|
||||
|
||||
# Generates a secure private key and encodes it as PEM
|
||||
resource "tls_private_key" "key_pair" {
|
||||
algorithm = "RSA"
|
||||
rsa_bits = 4096
|
||||
}
|
||||
|
||||
# Create the Key Pair
|
||||
resource "aws_key_pair" "key_pair" {
|
||||
key_name = "${lower(var.app_name)}-${lower(var.app_environment)}-windows-${lower(var.aws_region)}"
|
||||
public_key = tls_private_key.key_pair.public_key_openssh
|
||||
}
|
||||
|
||||
# Save file
|
||||
resource "local_file" "ssh_key" {
|
||||
filename = "${aws_key_pair.key_pair.key_name}.pem"
|
||||
content = tls_private_key.key_pair.private_key_pem
|
||||
}
|
||||
|
||||
# Bootstrapping PowerShell Script
|
||||
data "template_file" "windows-userdata" {
|
||||
|
|
Loading…
Reference in New Issue