Skip to content

Commit 2b9a5f9

Browse files
authored
chore: use opentofu instead of terraform (#399)
Avoids the unfree shenanigans
1 parent 8da3985 commit 2b9a5f9

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

config/config_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ func TestReadConfigFile(t *testing.T) {
125125
as.Equal([]string{"*.sh"}, shfmt.Includes)
126126
as.Nil(shfmt.Excludes)
127127

128-
// terraform
129-
terraform, ok := cfg.Formatters["terraform"]
130-
as.True(ok, "terraform formatter not found")
131-
as.Equal("terraform", terraform.Command)
132-
as.Equal([]string{"fmt"}, terraform.Options)
133-
as.Equal([]string{"*.tf"}, terraform.Includes)
134-
as.Nil(terraform.Excludes)
128+
// opentofu
129+
opentofu, ok := cfg.Formatters["opentofu"]
130+
as.True(ok, "opentofu formatter not found")
131+
as.Equal("tofu", opentofu.Command)
132+
as.Equal([]string{"fmt"}, opentofu.Options)
133+
as.Equal([]string{"*.tf"}, opentofu.Includes)
134+
as.Nil(opentofu.Excludes)
135135

136136
// missing
137137
foo, ok := cfg.Formatters["foo-fmt"]

flake.nix

+1-6
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,9 @@
2424
};
2525
};
2626

27-
outputs = inputs: let
28-
inherit (inputs.nixpkgs) lib;
29-
in
27+
outputs = inputs:
3028
inputs.blueprint {
3129
inherit inputs;
3230
prefix = "nix/";
33-
nixpkgs.config = {
34-
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) ["terraform"];
35-
};
3631
};
3732
}

nix/packages/treefmt/formatters.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ with pkgs; [
1515
shfmt
1616
statix
1717
deadnix
18-
terraform
18+
opentofu
1919
dos2unix
2020
yamlfmt
2121
# util for unit testing

test/examples/treefmt.toml

+2-4
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ options = ["-i", "2", "-s", "-w"]
8080
includes = ["*.sh"]
8181
priority = 2
8282

83-
[formatter.terraform]
84-
# Careful, only terraform 1.3.0 or later accept a list of files.
85-
# see https://github.com/numtide/treefmt/issues/97
86-
command = "terraform"
83+
[formatter.opentofu]
84+
command = "tofu"
8785
options = ["fmt"]
8886
includes = ["*.tf"]
8987

0 commit comments

Comments
 (0)