File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,12 @@ variable "target_host" {
77 description = " DNS host to deploy to"
88}
99
10+ variable "target_port" {
11+ description = " SSH port used to connect to the target_host"
12+ type = number
13+ default = 22
14+ }
15+
1016variable "ssh_private_key_file" {
1117 description = " Path to private key used to connect to the target_host. Ignored if `-` or empty."
1218 default = " -"
@@ -113,6 +119,7 @@ resource "null_resource" "deploy_nixos" {
113119 connection {
114120 type = " ssh"
115121 host = var. target_host
122+ port = var. target_port
116123 user = var. target_user
117124 agent = var. ssh_agent
118125 timeout = " 100s"
@@ -155,6 +162,7 @@ resource "null_resource" "deploy_nixos" {
155162 data . external . nixos-instantiate . result [" drv_path" ],
156163 data . external . nixos-instantiate . result [" out_path" ],
157164 " ${ var . target_user } @${ var . target_host } " ,
165+ " ${ var . target_port } " ,
158166 local . build_on_target ,
159167 local . ssh_private_key_file ,
160168 " switch" ,
Original file line number Diff line number Diff line change @@ -30,15 +30,18 @@ sshOpts=(
3030drvPath=" $1 "
3131outPath=" $2 "
3232targetHost=" $3 "
33- buildOnTarget=" $4 "
34- sshPrivateKeyFile=" $5 "
35- action=" $6 "
36- shift 6
33+ targetPort=" $4 "
34+ buildOnTarget=" $5 "
35+ sshPrivateKeyFile=" $6 "
36+ action=" $7 "
37+ shift 7
3738
3839# remove the last argument
3940set -- " ${@: 1: $(($# - 1))} "
4041buildArgs+=(" $@ " )
4142
43+ sshOpts+=( -p " ${targetPort} " )
44+
4245if [[ -n " ${sshPrivateKeyFile} " && " ${sshPrivateKeyFile} " != " -" ]]; then
4346 sshOpts+=( -o " IdentityFile=${sshPrivateKeyFile} " )
4447fi
You can’t perform that action at this time.
0 commit comments