Open chrs-myrs opened 1 year ago
Yours is the most reliable SSH tunnel for terraform, but was very sad when I tried to add a second tunnel
terraform { required_version = ">= 1.0.9" required_providers { aws = { source = "hashicorp/aws" version = "~> 4.0" } ssh = { source = "AndrewChubatiuk/ssh" version = "0.1.5" } mysql = { source = "petoju/mysql" version = "3.0.18" } redshift = { source = "brainly/redshift" version = "1.0.2" } } backend "s3" { ... } } provider "aws" { ... } provider "ssh" {} data "ssh_tunnel" "mysql" { user = var.bastion_username auth { private_key { content = file(pathexpand("~/.ssh/id_rsa")) } } server { host = "---" } remote { host = "rds.${local.env}.local" port = 3306 } } provider "mysql" { endpoint = data.ssh_tunnel.mysql.local.0.address username = "${local.env}_master" password = data.aws_ssm_parameter.cluster_password.value tls = false } data "aws_ssm_parameter" "cluster_password" { name = "---" with_decryption = true } data "ssh_tunnel" "redshift" { user = var.bastion_username auth { private_key { content = file(pathexpand("~/.ssh/id_rsa")) } } server { host = "bastion.---" } local { port = 5439 } remote { host = "redshift.---" port = 5439 } }
Open two tunnels
Fail with rror: rpc: service already defined: SSHTunnelServer
rror: rpc: service already defined: SSHTunnelServer
Added ability to run multiple tunnels in v0.2.2
Yours is the most reliable SSH tunnel for terraform, but was very sad when I tried to add a second tunnel
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
Open two tunnels
Actual Behavior
Fail with
rror: rpc: service already defined: SSHTunnelServer
Steps to Reproduce