Skip to content

Commit

Permalink
allow to configure bastion port
Browse files Browse the repository at this point in the history
  • Loading branch information
tkjwa committed Mar 23, 2023
1 parent 65f72b8 commit 56e7283
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bastion-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export HOME=/root
yum install -y haproxy

echo "
listen pgsql
bind 0.0.0.0:5432
listen database
bind 0.0.0.0:${db_port}
timeout connect 10s
mode tcp
server pgsql ${db_address}
server database ${db_address}
" >> /etc/haproxy/haproxy.cfg

service haproxy restart
1 change: 1 addition & 0 deletions bastion.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ resource "aws_instance" "bastion" {

user_data = var.db_address == null ? null : templatefile("${path.module}/bastion-setup.sh", {
db_address = var.db_address,
db_port = var.db_port,
})
user_data_replace_on_change = true

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ variable "db_address" {
description = "Address of the database that should be accessible from the bastion via HAProxy"
}

variable "db_port" {
type = number
default = null
description = "Port on which the proxy will listen"
}

variable "profile_permissions_boundary_arn" {
type = string
default = null
Expand Down

0 comments on commit 56e7283

Please sign in to comment.