-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to pass arguments to a hermetic configuration if it's a function #54
base: master
Are you sure you want to change the base?
Conversation
8d095e9
to
caa6191
Compare
In my configuration I solved this by using a templated file, but this method seems much better. I'll test out your PR |
This worked great on my configuration! I would recommend merging this |
I made a simpler similar branch that does this here. I can then do |
@@ -81,6 +81,12 @@ variable "triggers" { | |||
default = {} | |||
} | |||
|
|||
variable "arguments" { | |||
type = map(any) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type = map(any) | |
type = any |
According to https://www.terraform.io/language/expressions/type-constraints (and testing), map(any)
requires that all values be of the same type. This will (for example) coerce boolean values to strings, if any of the values are strings.
I am using this to manage production systems now. It is nicer than what I was doing before which involved interpolating a JSON string into a Nix template file with Terrraform's template feature and then calling out to another Nix source file (so that most of the Nix is kept safe from the Terraform templating system). Is there anything I can do to help get this merged? |
I have my fork of this which allows passing arguments to flakes and impure configurations too: https://github.com/abbradar/terraform-nixos/tree/passing-arguments. |
It adds a variable
arguments
which is passed to the result ofimport configuration
(requireshermetic
) if it's a function. So we can write a configuration like the following.with
serverA.nix
such as