Skip to content

Commit

Permalink
Merge pull request #6 from isovalent/pr/bruno/bastion-host-key-pair-name
Browse files Browse the repository at this point in the history
Output the bastion host's key pair name.
  • Loading branch information
darox committed Oct 11, 2023
2 parents 8884c2b + ce2a182 commit 8aea75d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
bastion_host_key_pair_name = "${var.name}-bastion"
}
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ resource "local_file" "private_key" {
resource "aws_key_pair" "bastion" {
count = var.bastion_host_enabled ? 1 : 0

key_name = "${var.name}-bastion"
key_name = local.bastion_host_key_pair_name
public_key = var.bastion_host_ssh_public_key != "" ? var.bastion_host_ssh_public_key : tls_private_key.bastion[0].public_key_openssh
}

Expand Down
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ output "additional_public_subnet_ids" {
]
}

output "bastion_host_key_pair_name" {
description = "The name of the SSH key pair associated with the bastion host."
value = var.bastion_host_enabled ? local.bastion_host_key_pair_name : ""
}

output "bastion_host_private_ip" {
value = join("", module.bastion[*].private_ip)
}
Expand Down

0 comments on commit 8aea75d

Please sign in to comment.