Skip to content

Commit b64999e

Browse files
committed
format terraform code with treefmt
1 parent 1501dc0 commit b64999e

File tree

9 files changed

+80
-79
lines changed

9 files changed

+80
-79
lines changed

terraform/all-in-one/main.tf

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
module "system-build" {
2-
source = "../nix-build"
3-
attribute = var.nixos_system_attr
4-
file = var.file
5-
nix_options = var.nix_options
2+
source = "../nix-build"
3+
attribute = var.nixos_system_attr
4+
file = var.file
5+
nix_options = var.nix_options
66
special_args = var.special_args
77
}
88

99
module "partitioner-build" {
10-
source = "../nix-build"
11-
attribute = var.nixos_partitioner_attr
12-
file = var.file
13-
nix_options = var.nix_options
10+
source = "../nix-build"
11+
attribute = var.nixos_partitioner_attr
12+
file = var.file
13+
nix_options = var.nix_options
1414
special_args = var.special_args
1515
}
1616

@@ -20,26 +20,26 @@ locals {
2020
}
2121

2222
module "install" {
23-
source = "../install"
24-
kexec_tarball_url = var.kexec_tarball_url
25-
target_user = local.install_user
26-
target_host = var.target_host
27-
target_port = local.install_port
28-
nixos_partitioner = module.partitioner-build.result.out
29-
nixos_system = module.system-build.result.out
30-
ssh_private_key = var.install_ssh_key
31-
debug_logging = var.debug_logging
32-
extra_files_script = var.extra_files_script
33-
disk_encryption_key_scripts = var.disk_encryption_key_scripts
34-
extra_environment = var.extra_environment
35-
instance_id = var.instance_id
36-
phases = var.phases
37-
nixos_generate_config_path = var.nixos_generate_config_path
38-
nixos_facter_path = var.nixos_facter_path
39-
build_on_remote = var.build_on_remote
23+
source = "../install"
24+
kexec_tarball_url = var.kexec_tarball_url
25+
target_user = local.install_user
26+
target_host = var.target_host
27+
target_port = local.install_port
28+
nixos_partitioner = module.partitioner-build.result.out
29+
nixos_system = module.system-build.result.out
30+
ssh_private_key = var.install_ssh_key
31+
debug_logging = var.debug_logging
32+
extra_files_script = var.extra_files_script
33+
disk_encryption_key_scripts = var.disk_encryption_key_scripts
34+
extra_environment = var.extra_environment
35+
instance_id = var.instance_id
36+
phases = var.phases
37+
nixos_generate_config_path = var.nixos_generate_config_path
38+
nixos_facter_path = var.nixos_facter_path
39+
build_on_remote = var.build_on_remote
4040
# deprecated attributes
41-
stop_after_disko = var.stop_after_disko
42-
no_reboot = var.no_reboot
41+
stop_after_disko = var.stop_after_disko
42+
no_reboot = var.no_reboot
4343
}
4444

4545
module "nixos-rebuild" {
@@ -50,12 +50,12 @@ module "nixos-rebuild" {
5050
# Do not execute this step if var.stop_after_disko == true
5151
count = var.stop_after_disko ? 0 : 1
5252

53-
source = "../nixos-rebuild"
54-
nixos_system = module.system-build.result.out
55-
ssh_private_key = var.deployment_ssh_key
56-
target_host = var.target_host
57-
target_user = var.target_user
58-
target_port = var.target_port
53+
source = "../nixos-rebuild"
54+
nixos_system = module.system-build.result.out
55+
ssh_private_key = var.deployment_ssh_key
56+
target_host = var.target_host
57+
target_user = var.target_user
58+
target_port = var.target_port
5959
install_bootloader = var.install_bootloader
6060
}
6161

terraform/all-in-one/variables.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
variable "kexec_tarball_url" {
2-
type = string
2+
type = string
33
description = "NixOS kexec installer tarball url"
4-
default = null
4+
default = null
55
}
66

77
# To make this re-usable we maybe should accept a store path here?
@@ -100,8 +100,8 @@ variable "extra_files_script" {
100100
}
101101

102102
variable "disk_encryption_key_scripts" {
103-
type = list(object({
104-
path = string
103+
type = list(object({
104+
path = string
105105
script = string
106106
}))
107107
description = "Each script will be executed locally. Output of each will be created at the given path to disko during installation. The keys will be not copied to the final system"
@@ -115,9 +115,9 @@ variable "extra_environment" {
115115
}
116116

117117
variable "nix_options" {
118-
type = map(string)
118+
type = map(string)
119119
description = "the options of nix"
120-
default = {}
120+
default = {}
121121
}
122122

123123
variable "nixos_generate_config_path" {
@@ -133,8 +133,8 @@ variable "nixos_facter_path" {
133133
}
134134

135135
variable "special_args" {
136-
type = any
137-
default = {}
136+
type = any
137+
default = {}
138138
description = "A map exposed as NixOS's `specialArgs` thru a file."
139139
}
140140

@@ -145,7 +145,7 @@ variable "build_on_remote" {
145145
}
146146

147147
variable "install_bootloader" {
148-
type = bool
148+
type = bool
149149
description = "Install/re-install the bootloader"
150-
default = false
150+
default = false
151151
}

terraform/install/main.tf

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
locals {
22
disk_encryption_key_scripts = [for k in var.disk_encryption_key_scripts : "\"${k.path}\" \"${k.script}\""]
3-
removed_phases = setunion(var.stop_after_disko ? ["install"] : [], (var.no_reboot ? ["reboot"] : []))
4-
phases = setsubtract(var.phases, local.removed_phases)
3+
removed_phases = setunion(var.stop_after_disko ? ["install"] : [], (var.no_reboot ? ["reboot"] : []))
4+
phases = setsubtract(var.phases, local.removed_phases)
55
arguments = jsonencode({
6-
ssh_private_key = var.ssh_private_key
7-
debug_logging = var.debug_logging
8-
kexec_tarball_url = var.kexec_tarball_url
9-
nixos_partitioner = var.nixos_partitioner
10-
nixos_system = var.nixos_system
11-
target_user = var.target_user
12-
target_host = var.target_host
13-
target_port = var.target_port
14-
target_pass = var.target_pass
15-
extra_files_script = var.extra_files_script
16-
build_on_remote = var.build_on_remote
17-
flake = var.flake
18-
phases = join(",", local.phases)
6+
ssh_private_key = var.ssh_private_key
7+
debug_logging = var.debug_logging
8+
kexec_tarball_url = var.kexec_tarball_url
9+
nixos_partitioner = var.nixos_partitioner
10+
nixos_system = var.nixos_system
11+
target_user = var.target_user
12+
target_host = var.target_host
13+
target_port = var.target_port
14+
target_pass = var.target_pass
15+
extra_files_script = var.extra_files_script
16+
build_on_remote = var.build_on_remote
17+
flake = var.flake
18+
phases = join(",", local.phases)
1919
nixos_generate_config_path = var.nixos_generate_config_path
20-
nixos_facter_path = var.nixos_facter_path
20+
nixos_facter_path = var.nixos_facter_path
2121
})
2222
}
2323

terraform/install/providers.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
22
required_providers {
3-
null = { source = "hashicorp/null" }
3+
null = { source = "hashicorp/null" }
44
}
55
}

terraform/install/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ variable "target_port" {
3636
}
3737

3838
variable "target_pass" {
39-
type = string
39+
type = string
4040
description = "Password used to connect to the target_host"
41-
default = null
41+
default = null
4242
}
4343

4444
variable "ssh_private_key" {
@@ -66,8 +66,8 @@ variable "extra_files_script" {
6666
}
6767

6868
variable "disk_encryption_key_scripts" {
69-
type = list(object({
70-
path = string
69+
type = list(object({
70+
path = string
7171
script = string
7272
}))
7373
description = "Each script will be executed locally. Output of each will be created at the given path to disko during installation. The keys will be not copied to the final system"

terraform/nix-build/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ locals {
44
})
55
}
66
data "external" "nix-build" {
7-
program = [ "${path.module}/nix-build.sh" ]
7+
program = ["${path.module}/nix-build.sh"]
88
query = {
9-
attribute = var.attribute
10-
file = var.file
11-
nix_options = local.nix_options
9+
attribute = var.attribute
10+
file = var.file
11+
nix_options = local.nix_options
1212
special_args = jsonencode(var.special_args)
1313
}
1414
}

terraform/nix-build/variables.tf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
variable "attribute" {
2-
type = string
2+
type = string
33
description = "the attribute to build, can also be a flake"
44
}
55

66
variable "file" {
7-
type = string
7+
type = string
88
description = "the nix file to evaluate, if not run in flake mode"
9-
default = null
9+
default = null
1010
}
1111

1212
variable "nix_options" {
13-
type = map(string)
13+
type = map(string)
1414
description = "the options of nix"
15-
default = {}
15+
default = {}
1616
}
1717

1818
variable "special_args" {
19-
type = any
20-
default = {}
19+
type = any
20+
default = {}
2121
description = "A map exposed as NixOS's `specialArgs` thru a file."
2222
}

terraform/nixos-rebuild/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ variable "ssh_private_key" {
2727
}
2828

2929
variable "ignore_systemd_errors" {
30-
type = bool
30+
type = bool
3131
description = "Ignore systemd errors happening during deploy"
32-
default = false
32+
default = false
3333
}
3434

3535
variable "install_bootloader" {
36-
type = bool
36+
type = bool
3737
description = "Install/re-install the bootloader"
38-
default = false
38+
default = false
3939
}

treefmt/flake-module.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
programs.nixpkgs-fmt.enable = true;
1010
programs.shellcheck.enable = true;
1111
programs.shfmt.enable = true;
12+
programs.terraform.enable = true;
1213
programs.deno.enable = !pkgs.deno.meta.broken;
1314
settings.formatter.shellcheck.options = [ "-s" "bash" ];
1415
};

0 commit comments

Comments
 (0)