Skip to content

Commit

Permalink
Refactor ssh parameters (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
snovikov authored Dec 11, 2024
1 parent d51f75e commit 4913681
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module "vpc" {
bastion_ssh_keys = ["ssh-ed25519 AAAAC3Nznte5aaCdi1a1Lzaai/tX6Mc2E+S6g3lrClL09iBZ5cW2OZdSIqomcMko 2 mysshkey"]
bastion_route53_public_dns_name = "my-project.example.com"
bastion_subdomain" = "bastion-host"
bastion_subdomain = "bastion-host"
}
```

Expand Down Expand Up @@ -232,6 +232,14 @@ Type: `string`

Default: `""`

### <a name="input_bastion_ssh_user"></a> [bastion\_ssh\_user](#input\_bastion\_ssh\_user)

Description: User name used for SSH-connections.

Type: `string`

Default: `"ec2-user"`

### <a name="input_bastion_ssh_keys"></a> [bastion\_ssh\_keys](#input\_bastion\_ssh\_keys)

Description: A list of public ssh keys to add to authorized\_keys file
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ resource "aws_launch_template" "bastion" {
vpc_security_group_ids = [aws_security_group.bastion[0].id]
user_data = length(var.bastion_ssh_keys) > 0 ? base64encode(templatefile("${path.module}/user_data.sh.tftpl",
{
ssh_user = "ec2-user"
ssh_user = var.bastion_ssh_user
ssh_keys = join("\n", var.bastion_ssh_keys)
}
)) : null
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ variable "bastion_name" {
default = ""
}

variable "bastion_ssh_user" {
description = "User name used for SSH-connections."
type = string
default = "ec2-user"
}

variable "bastion_ssh_keys" {
description = "A list of public ssh keys to add to authorized_keys file"
type = list(string)
Expand Down

0 comments on commit 4913681

Please sign in to comment.