terranix
terranix copied to clipboard
multiple aws provider clash with already defined attributes
Hi, I'm trying to port a configuration from an terraform project to terranix and I think I'll not be able to do it (maybe I'm wrong)
so for a bit of context this is my config.nix
{lib, config}:
let
region = "eu-west-1";
profile = "\${}";
# ...
in {
# ...
provider.aws = {
inherit profile region;
};
provider.aws = {
alias = "central";
region = "eu-central-1";
inherit profile;
};
}
and then I get this error (which make sense to me)
error: attribute 'region' already defined at .../config.nix:37:7
at .../config.nix:33:14:
32| provider.aws = {
33| inherit profile region;
| ^
34| };
So is there already a way to do that ?
Thanks in advance
Found the solution, I'll put it here if needed by other. just need to read a bit the documentation of terraform json: https://www.terraform.io/language/syntax/json#provider-blocks
so you can do that with
{
provider.aws = [{
inherit region profile;
} {
alias = "central";
region = "eu-central-1";
inherit profile;
}];
}
Good point, and the solution is correct. I reopened the ticket to document this approach. But it will take a wile till I find the time for it.
Thx @Westixy
Added documentation issue - https://github.com/terranix/terranix-website/issues/15