Skip to content

Commit

Permalink
De-hardcode number of cores
Browse files Browse the repository at this point in the history
  • Loading branch information
Shay Bergmann committed May 17, 2022
1 parent 3a26246 commit 2e04369
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion modules/terraform.nix
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ let
inherit cidr;
inherit (cfg) region;

subnets = lib.pipe 3 [
subnets = lib.pipe (builtins.length (builtins.attrNames cfg.coreNodes)) [
(builtins.genList lib.id)
(map (idx: lib.nameValuePair "core-${toString (idx+1)}" {
cidr = net.cidr.subnet 8 idx cidr;
Expand Down
6 changes: 1 addition & 5 deletions modules/terraform/aws_policies.nix
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,7 @@ in {

assumeRole = {
effect = "Allow";
resources = [
config.cluster.coreNodes.core-1.iam.instanceProfile.tfArn
config.cluster.coreNodes.core-2.iam.instanceProfile.tfArn
config.cluster.coreNodes.core-3.iam.instanceProfile.tfArn
];
resources = lib.mapAttrsToList (_: attrs: attrs.iam.instanceProfile.tfArn) config.cluster.coreNodes;
actions = [ "sts:AssumeRole" ];
};

Expand Down

0 comments on commit 2e04369

Please sign in to comment.