Skip to content

Commit 024db2b

Browse files
authored
Merge pull request #197 from input-output-hk/zt
misc: monitoring update, token ttl adjustments, tf transit gateway
2 parents 43f92fc + d552ba0 commit 024db2b

File tree

10 files changed

+368
-32
lines changed

10 files changed

+368
-32
lines changed

lib/security-group-rules.nix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,28 @@ in {
9090
protocols = ["tcp" "udp"];
9191
cidrs = global;
9292
};
93+
94+
ziti-controller-rest = {
95+
port = 1280;
96+
protocols = ["tcp"];
97+
cidrs = global;
98+
};
99+
100+
ziti-controller-mgmt = {
101+
port = 6262;
102+
protocols = ["tcp"];
103+
cidrs = global;
104+
};
105+
106+
ziti-router-edge = {
107+
port = 3022;
108+
protocols = ["tcp"];
109+
cidrs = global;
110+
};
111+
112+
ziti-router-fabric = {
113+
port = 10080;
114+
protocols = ["tcp"];
115+
cidrs = global;
116+
};
93117
}

lib/terralib.nix

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,37 @@ in rec {
3333
nullRoute = nullRoute' // {destination_ipv6_cidr_block = null;};
3434

3535
aws = {
36+
# asgVpcs returns a vpc attr struct when provided config.cluster.
37+
# Example attr struct:
38+
# [
39+
# {
40+
# "cidr": "10.24.0.0/16",
41+
# "id": "${data.aws_vpc.bitte-world-eu-central-1-asgs.id}",
42+
# "name": "bitte-world-eu-central-1-asgs",
43+
# "region": "eu-central-1",
44+
# "subnets": {
45+
# "a": {
46+
# "availabilityZone": "${element(module.instance_types_to_azs_eu-central-1.availability_zones, 0)}",
47+
# "cidr": "10.24.0.0/18",
48+
# "id": "${aws_subnet.a.id}",
49+
# "name": "a"
50+
# },
51+
# "b": {
52+
# "availabilityZone": "${element(module.instance_types_to_azs_eu-central-1.availability_zones, 1)}",
53+
# "cidr": "10.24.64.0/18",
54+
# "id": "${aws_subnet.b.id}",
55+
# "name": "b"
56+
# },
57+
# "c": {
58+
# "availabilityZone": "${element(module.instance_types_to_azs_eu-central-1.availability_zones, 2)}",
59+
# "cidr": "10.24.128.0/18",
60+
# "id": "${aws_subnet.c.id}",
61+
# "name": "c"
62+
# }
63+
# }
64+
# },
65+
# ...
66+
# ]
3667
asgVpcs = cluster:
3768
lib.forEach (builtins.attrValues cluster.awsAutoScalingGroups) (asg: asg.vpc);
3869

modules/monitoring.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,14 +522,14 @@ in {
522522
httpListenAddr = "0.0.0.0:8880";
523523
externalUrl = "https://monitoring.${domain}";
524524
httpPathPrefix = "/vmalert-vm";
525-
externalAlertSource = ''explore?left=%%7B%%22datasource%%22:%%22VictoriaMetrics%%22,%%22queries%%22:%%5B%%7B%%22refId%%22:%%22A%%22,%%22expr%%22:%%22{{$expr|quotesEscape|crlfEscape|pathEscape}}%%22,%%22range%%22:true,%%22editorMode%%22:%%22code%%22%%7D%%5D,%%22range%%22:%%7B%%22from%%22:%%22now-1h%%22,%%22to%%22:%%22now%%22%%7D%%7D&orgId=1'';
525+
externalAlertSource = ''explore?left=%%7B%%22datasource%%22:%%22VictoriaMetrics%%22,%%22queries%%22:%%5B%%7B%%22refId%%22:%%22A%%22,%%22expr%%22:%%22{{$expr|quotesEscape|pathEscape}}%%22,%%22range%%22:true,%%22editorMode%%22:%%22code%%22%%7D%%5D,%%22range%%22:%%7B%%22from%%22:%%22now-1h%%22,%%22to%%22:%%22now%%22%%7D%%7D&orgId=1'';
526526
};
527527
loki = {
528528
datasourceUrl = "http://127.0.0.1:3100/loki";
529529
httpListenAddr = "0.0.0.0:8881";
530530
externalUrl = "https://monitoring.${domain}";
531531
httpPathPrefix = "/vmalert-loki";
532-
externalAlertSource = ''explore?left=%%7B%%22datasource%%22:%%22Loki%%22,%%22queries%%22:%%5B%%7B%%22refId%%22:%%22A%%22,%%22expr%%22:%%22{{$expr|quotesEscape|crlfEscape|pathEscape}}%%22,%%22range%%22:true,%%22editorMode%%22:%%22code%%22%%7D%%5D,%%22range%%22:%%7B%%22from%%22:%%22now-1h%%22,%%22to%%22:%%22now%%22%%7D%%7D&orgId=1'';
532+
externalAlertSource = ''explore?left=%%7B%%22datasource%%22:%%22Loki%%22,%%22queries%%22:%%5B%%7B%%22refId%%22:%%22A%%22,%%22expr%%22:%%22{{$expr|quotesEscape|pathEscape}}%%22,%%22range%%22:true,%%22editorMode%%22:%%22code%%22%%7D%%5D,%%22range%%22:%%7B%%22from%%22:%%22now-1h%%22,%%22to%%22:%%22now%%22%%7D%%7D&orgId=1'';
533533
# Loki uses PromQL type queries that do not strictly comply with PromQL
534534
# Ref: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/780
535535
ruleValidateExpressions = false;

modules/terraform.nix

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,51 @@
482482
self.inputs;
483483
};
484484

485+
transitGateway = lib.mkOption {
486+
type = with lib.types;
487+
submodule ({name, ...} @ this: {
488+
options = {
489+
enable = lib.mkOption {
490+
type = with lib.types; bool;
491+
default = false;
492+
description = ''
493+
Whether to enable a star topology transit gateway network to allow custom packet routing
494+
through a multi-region cluster. Applicable to zero-trust tunneling in a ZTNA model.
495+
See the transitGateway description for more detail.
496+
'';
497+
};
498+
499+
transitRoutes = lib.mkOption {
500+
type = with lib.types; addCheck (listOf attrs) (x: x != []);
501+
default = [];
502+
description = ''
503+
A list containing elements of attrs with attribute gatewayCoreNodeName and cidrRange.
504+
Each CIDR range forwards to the respective gatewayCoreNode for zero trust tunneling
505+
in the core VPC.
506+
507+
Note that the CIDR ranges cannot overlap with existing VPC, subnet CIDRs or themselves.
508+
Note also that the listed gatewayCoreNode machines must already exist.
509+
510+
Example:
511+
[
512+
{ gatewayCoreNodeName = "zt1"; cidrRange = "10.10.0.0/24"; }
513+
{ gatewayCoreNodeName = "zt2"; cidrRange = "10.11.0.0/24"; }
514+
]
515+
'';
516+
};
517+
};
518+
});
519+
default = {};
520+
description = ''
521+
Declaring config.cluster.transitGateway options and plan/applying the terraform clients
522+
workspace will provision and configure AWS resources for a peered transit gateway in a star
523+
topology with the core VPC at the center and the asg VPCs at the edge.
524+
525+
This enables routing traffic intended for ZT tunneling across the VPCs in private network
526+
CIDRs that are outside the configured VPC CIDR ranges to the core VPC.
527+
'';
528+
};
529+
485530
vaultBackend = lib.mkOption {
486531
type = with lib.types; str;
487532
default = "https://vault.infra.aws.iohkdev.io";
@@ -1012,6 +1057,11 @@
10121057
default = {};
10131058
};
10141059

1060+
sourceDestCheck = lib.mkOption {
1061+
type = with lib.types; bool;
1062+
default = true;
1063+
};
1064+
10151065
initialVaultSecrets = lib.mkOption {
10161066
type = with lib.types; initialVaultSecretsType;
10171067
default = {};

0 commit comments

Comments
 (0)