terraform-iam: import devshell as flake module into the main module
also switch to opentofu to avoid unfree package evaluation
Jörg Thalheim committed
Aug 18, 2024 at 07:27 UTC
7adb39f483256b108fdbed1fed5b4bc560b14ae3
5 files changed
+31
-57
flake.nix
+1
@@ -17,6 +17,7 @@
17
];
18
imports = [
19
./formatter/flake-module.nix
20
+ ./terraform-iam/flake-module.nix
21
];
22
};
23
terraform-iam/.envrc
+1
-1
@@ -1,4 +1,4 @@
1
-use flake
1
+use flake .#terraform-iam
2
3
export AWS_CONFIG_FILE=$PWD/aws-config
4
export AWS_PROFILE=nixos-prod
terraform-iam/flake-module.nix
new
+29
@@ -0,0 +1,29 @@
1
+let
2
+ convert2Tofu =
3
+ provider:
4
+ provider.override (prev: {
5
+ homepage = builtins.replaceStrings [ "registry.terraform.io/providers" ] [
6
+ "registry.opentofu.org"
7
+ ] prev.homepage;
8
+ });
9
+in
10
+{
11
+ perSystem =
12
+ { pkgs, ... }:
13
+ {
14
+ devShells.terraform-iam = pkgs.mkShellNoCC {
15
+ packages = [
16
+ pkgs.awscli2
17
+ (pkgs.opentofu.withPlugins (
18
+ p:
19
+ builtins.map convert2Tofu [
20
+ p.aws
21
+ p.fastly
22
+ p.netlify
23
+ p.secret
24
+ ]
25
+ ))
26
+ ];
27
+ };
28
+ };
29
+}
terraform-iam/flake.lock
deleted
-26
@@ -1,26 +0,0 @@
1
-{
2
- "nodes": {
3
- "nixpkgs": {
4
- "locked": {
5
- "lastModified": 1694092552,
6
- "narHash": "sha256-kEb8kyIFTKt1RLRfsKVVuBG+EY29zp6kWLOtdK9Bcu4=",
7
- "owner": "NixOS",
8
- "repo": "nixpkgs",
9
- "rev": "319a44b173a6467859b6c8e60d96e2287526f685",
10
- "type": "github"
11
- },
12
- "original": {
13
- "id": "nixpkgs",
14
- "ref": "master",
15
- "type": "indirect"
16
- }
17
- },
18
- "root": {
19
- "inputs": {
20
- "nixpkgs": "nixpkgs"
21
- }
22
- }
23
- },
24
- "root": "root",
25
- "version": 7
26
-}
terraform-iam/flake.nix
deleted
-30
@@ -1,30 +0,0 @@
1
-{
2
- inputs.nixpkgs.url = "nixpkgs/master";
3
-
4
- outputs =
5
- { nixpkgs }:
6
- {
7
-
8
- devShell.x86_64-linux =
9
- with import nixpkgs { system = "x86_64-linux"; };
10
- mkShell {
11
- packages = [
12
- awscli2
13
- (terraform.withPlugins (
14
- p: with p; [
15
- aws
16
- fastly
17
- netlify
18
- secret
19
- ]
20
- ))
21
- ];
22
-
23
- shellHook = ''
24
- alias tf=terraform
25
- '';
26
- };
27
-
28
- };
29
-
30
-}