Skip to content

Commit 8279ad8

Browse files
Exeteresmergify[bot]
authored andcommitted
Add install_port variable to all-in-one terraform module
1 parent e885f10 commit 8279ad8

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

terraform/all-in-one.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ No resources.
113113
| <a name="input_extra_environment"></a> [extra\_environment](#input_extra_environment) | Extra environment variables to be set during installation. This can be useful to set extra variables for the extra\_files\_script or disk\_encryption\_key\_scripts | `map(string)` | `{}` | no |
114114
| <a name="input_extra_files_script"></a> [extra\_files\_script](#input_extra_files_script) | A script that should place files in the current directory that will be copied to the targets / directory | `string` | `null` | no |
115115
| <a name="input_file"></a> [file](#input_file) | Nix file containing the nixos\_system\_attr and nixos\_partitioner\_attr. Use this if you are not using flake | `string` | `null` | no |
116+
| <a name="input_install_port"></a> [install\_port](#input_install_port) | SSH port used to connect to the target\_host, before installing NixOS. If null than the value of `target_port` is used | `string` | `null` | no |
116117
| <a name="input_install_ssh_key"></a> [install\_ssh\_key](#input_install_ssh_key) | Content of private key used to connect to the target\_host during initial installation | `string` | `null` | no |
117118
| <a name="input_install_user"></a> [install\_user](#input_install_user) | SSH user used to connect to the target\_host, before installing NixOS. If null than the value of `target_host` is used | `string` | `null` | no |
118119
| <a name="input_instance_id"></a> [instance\_id](#input_instance_id) | The instance id of the target\_host, used to track when to reinstall the machine | `string` | `null` | no |
@@ -123,7 +124,7 @@ No resources.
123124
| <a name="input_no_reboot"></a> [no\_reboot](#input_no_reboot) | Do not reboot after installation | `bool` | `false` | no |
124125
| <a name="input_stop_after_disko"></a> [stop\_after\_disko](#input_stop_after_disko) | Exit after disko formatting | `bool` | `false` | no |
125126
| <a name="input_target_host"></a> [target\_host](#input_target_host) | DNS host to deploy to | `string` | n/a | yes |
126-
| <a name="input_target_port"></a> [target\_port](#input_target_port) | SSH port used to connect to the target\_host, before installing NixOS | `number` | `22` | no |
127+
| <a name="input_target_port"></a> [target\_port](#input_target_port) | SSH port used to connect to the target\_host after installing NixOS. If install\_port is not set than this port is also used before installing. | `number` | `22` | no |
127128
| <a name="input_target_user"></a> [target\_user](#input_target_user) | SSH user used to connect to the target\_host after installing NixOS. If install\_user is not set than this user is also used before installing. | `string` | `"root"` | no |
128129

129130
## Outputs

terraform/all-in-one/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ module "partitioner-build" {
1414

1515
locals {
1616
install_user = var.install_user == null ? var.target_user : var.install_user
17+
install_port = var.install_port == null ? var.target_port : var.install_port
1718
}
1819

1920
module "install" {
2021
source = "../install"
2122
kexec_tarball_url = var.kexec_tarball_url
2223
target_user = local.install_user
2324
target_host = var.target_host
24-
target_port = var.target_port
25+
target_port = local.install_port
2526
nixos_partitioner = module.partitioner-build.result.out
2627
nixos_system = module.system-build.result.out
2728
ssh_private_key = var.install_ssh_key

terraform/all-in-one/variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ variable "install_user" {
3333
default = null
3434
}
3535

36+
variable "install_port" {
37+
type = string
38+
description = "SSH port used to connect to the target_host, before installing NixOS. If null than the value of `target_port` is used"
39+
default = null
40+
}
41+
3642
variable "target_user" {
3743
type = string
3844
description = "SSH user used to connect to the target_host after installing NixOS. If install_user is not set than this user is also used before installing."
@@ -41,7 +47,7 @@ variable "target_user" {
4147

4248
variable "target_port" {
4349
type = number
44-
description = "SSH port used to connect to the target_host, before installing NixOS"
50+
description = "SSH port used to connect to the target_host after installing NixOS. If install_port is not set than this port is also used before installing."
4551
default = 22
4652
}
4753

0 commit comments

Comments
 (0)