-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Initial support for Terraform 1.9 versions (#83)
- Loading branch information
Showing
7 changed files
with
102 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
{ pkgs, pkgs-unstable, version, hash, vendorHash, silenceWarnings ? false }: | ||
{ pkgs-1_0, pkgs-1_6, pkgs-1_9, version, hash, vendorHash, silenceWarnings ? false }: | ||
# https://www.hashicorp.com/blog/hashicorp-adopts-business-source-license | ||
if builtins.compareVersions version "1.6.0" >= 0 | ||
if builtins.compareVersions version "1.9.0" >= 0 | ||
then | ||
# https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/applications/networking/cluster/terraform/default.nix | ||
(pkgs.lib.warnIf (! silenceWarnings) ("allowUnfree is enabled to build version " + version) pkgs-unstable.mkTerraform | ||
(pkgs-1_9.lib.warnIf (! silenceWarnings) ("allowUnfree is enabled to build version " + version) pkgs-1_9.mkTerraform | ||
{ | ||
inherit version hash vendorHash; | ||
patches = [ ../patches/provider-path-1_9.patch ]; | ||
}) | ||
else if builtins.compareVersions version "1.6.0" >= 0 | ||
then | ||
(pkgs-1_6.lib.warnIf (! silenceWarnings) ("allowUnfree is enabled to build version " + version) pkgs-1_6.mkTerraform | ||
{ | ||
inherit version hash vendorHash; | ||
patches = [ ../patches/provider-path-0_15.patch ]; | ||
}) | ||
else | ||
# https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/applications/networking/cluster/terraform/default.nix | ||
(pkgs.mkTerraform { | ||
(pkgs-1_0.mkTerraform { | ||
inherit version hash vendorHash; | ||
patches = [ ../patches/provider-path-0_15.patch ]; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ custom-lib, pkgs, pkgs-unstable, releases, silenceWarnings }: | ||
{ custom-lib, pkgs-1_0, pkgs-1_6, pkgs-1_9, releases, silenceWarnings }: | ||
builtins.mapAttrs | ||
(version: { hash, vendorHash }: custom-lib.buildTerraform { | ||
inherit pkgs pkgs-unstable version hash vendorHash silenceWarnings; | ||
inherit pkgs-1_0 pkgs-1_6 pkgs-1_9 version hash vendorHash silenceWarnings; | ||
}) | ||
releases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
diff -Naur terraform.old/internal/command/init.go terraform.new/internal/command/init.go | ||
--- terraform.old/internal/command/init.go | ||
+++ terraform.new/internal/command/init.go | ||
@@ -7,6 +7,7 @@ | ||
"context" | ||
"errors" | ||
"fmt" | ||
+ "os" | ||
"log" | ||
"reflect" | ||
"sort" | ||
@@ -77,6 +78,11 @@ | ||
// -force-copy implies -migrate-state | ||
if c.forceInitCopy { | ||
c.migrateState = true | ||
+ } | ||
+ | ||
+ val, ok := os.LookupEnv("NIX_TERRAFORM_PLUGIN_DIR") | ||
+ if ok { | ||
+ initArgs.PluginPath = append(initArgs.PluginPath, val) | ||
} | ||
|
||
if len(initArgs.PluginPath) > 0 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters