@friggframework/devtools 2.0.0--canary.461.637e5e4.0 → 2.0.0--canary.461.4e47399.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -384,6 +384,7 @@ class VpcBuilder extends InfrastructureBuilder {
|
|
|
384
384
|
// Private Subnet 1
|
|
385
385
|
result.resources.FriggPrivateSubnet1 = {
|
|
386
386
|
Type: 'AWS::EC2::Subnet',
|
|
387
|
+
DeletionPolicy: 'Retain',
|
|
387
388
|
Properties: {
|
|
388
389
|
VpcId: subnetVpcId,
|
|
389
390
|
CidrBlock: cidrs.private1,
|
|
@@ -399,6 +400,7 @@ class VpcBuilder extends InfrastructureBuilder {
|
|
|
399
400
|
// Private Subnet 2
|
|
400
401
|
result.resources.FriggPrivateSubnet2 = {
|
|
401
402
|
Type: 'AWS::EC2::Subnet',
|
|
403
|
+
DeletionPolicy: 'Retain',
|
|
402
404
|
Properties: {
|
|
403
405
|
VpcId: subnetVpcId,
|
|
404
406
|
CidrBlock: cidrs.private2,
|
|
@@ -612,6 +614,23 @@ class VpcBuilder extends InfrastructureBuilder {
|
|
|
612
614
|
},
|
|
613
615
|
};
|
|
614
616
|
|
|
617
|
+
// Associate route table with private subnets
|
|
618
|
+
result.resources.FriggPrivateSubnet1RouteTableAssociation = {
|
|
619
|
+
Type: 'AWS::EC2::SubnetRouteTableAssociation',
|
|
620
|
+
Properties: {
|
|
621
|
+
SubnetId: { Ref: 'FriggPrivateSubnet1' },
|
|
622
|
+
RouteTableId: { Ref: 'FriggLambdaRouteTable' },
|
|
623
|
+
},
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
result.resources.FriggPrivateSubnet2RouteTableAssociation = {
|
|
627
|
+
Type: 'AWS::EC2::SubnetRouteTableAssociation',
|
|
628
|
+
Properties: {
|
|
629
|
+
SubnetId: { Ref: 'FriggPrivateSubnet2' },
|
|
630
|
+
RouteTableId: { Ref: 'FriggLambdaRouteTable' },
|
|
631
|
+
},
|
|
632
|
+
};
|
|
633
|
+
|
|
615
634
|
console.log(' ✅ NAT Gateway infrastructure created');
|
|
616
635
|
}
|
|
617
636
|
|
|
@@ -543,6 +543,46 @@ describe('VpcBuilder', () => {
|
|
|
543
543
|
expect(result.resources.FriggNATGateway.Type).toBe('AWS::EC2::NatGateway');
|
|
544
544
|
});
|
|
545
545
|
|
|
546
|
+
it('should create route table associations for private subnets with NAT Gateway', async () => {
|
|
547
|
+
const appDefinition = {
|
|
548
|
+
vpc: {
|
|
549
|
+
enable: true,
|
|
550
|
+
management: 'discover',
|
|
551
|
+
subnets: { management: 'create' },
|
|
552
|
+
natGateway: {
|
|
553
|
+
management: 'createAndManage',
|
|
554
|
+
},
|
|
555
|
+
selfHeal: true,
|
|
556
|
+
},
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
const discoveredResources = {
|
|
560
|
+
defaultVpcId: 'vpc-123',
|
|
561
|
+
publicSubnetId: 'subnet-public',
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
const result = await vpcBuilder.build(appDefinition, discoveredResources);
|
|
565
|
+
|
|
566
|
+
// Verify route table is created
|
|
567
|
+
expect(result.resources.FriggLambdaRouteTable).toBeDefined();
|
|
568
|
+
expect(result.resources.FriggLambdaRouteTable.Type).toBe('AWS::EC2::RouteTable');
|
|
569
|
+
|
|
570
|
+
// Verify route to NAT Gateway
|
|
571
|
+
expect(result.resources.FriggPrivateRoute).toBeDefined();
|
|
572
|
+
expect(result.resources.FriggPrivateRoute.Properties.NatGatewayId).toEqual({ Ref: 'FriggNATGateway' });
|
|
573
|
+
|
|
574
|
+
// Verify subnet route table associations
|
|
575
|
+
expect(result.resources.FriggPrivateSubnet1RouteTableAssociation).toBeDefined();
|
|
576
|
+
expect(result.resources.FriggPrivateSubnet1RouteTableAssociation.Type).toBe('AWS::EC2::SubnetRouteTableAssociation');
|
|
577
|
+
expect(result.resources.FriggPrivateSubnet1RouteTableAssociation.Properties.SubnetId).toEqual({ Ref: 'FriggPrivateSubnet1' });
|
|
578
|
+
expect(result.resources.FriggPrivateSubnet1RouteTableAssociation.Properties.RouteTableId).toEqual({ Ref: 'FriggLambdaRouteTable' });
|
|
579
|
+
|
|
580
|
+
expect(result.resources.FriggPrivateSubnet2RouteTableAssociation).toBeDefined();
|
|
581
|
+
expect(result.resources.FriggPrivateSubnet2RouteTableAssociation.Type).toBe('AWS::EC2::SubnetRouteTableAssociation');
|
|
582
|
+
expect(result.resources.FriggPrivateSubnet2RouteTableAssociation.Properties.SubnetId).toEqual({ Ref: 'FriggPrivateSubnet2' });
|
|
583
|
+
expect(result.resources.FriggPrivateSubnet2RouteTableAssociation.Properties.RouteTableId).toEqual({ Ref: 'FriggLambdaRouteTable' });
|
|
584
|
+
});
|
|
585
|
+
|
|
546
586
|
it('should not create NAT when existing NAT is properly placed', async () => {
|
|
547
587
|
const appDefinition = {
|
|
548
588
|
vpc: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.461.
|
|
4
|
+
"version": "2.0.0--canary.461.4e47399.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-ec2": "^3.835.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.835.0",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"@babel/eslint-parser": "^7.18.9",
|
|
12
12
|
"@babel/parser": "^7.25.3",
|
|
13
13
|
"@babel/traverse": "^7.25.3",
|
|
14
|
-
"@friggframework/schemas": "2.0.0--canary.461.
|
|
15
|
-
"@friggframework/test": "2.0.0--canary.461.
|
|
14
|
+
"@friggframework/schemas": "2.0.0--canary.461.4e47399.0",
|
|
15
|
+
"@friggframework/test": "2.0.0--canary.461.4e47399.0",
|
|
16
16
|
"@hapi/boom": "^10.0.1",
|
|
17
17
|
"@inquirer/prompts": "^5.3.8",
|
|
18
18
|
"axios": "^1.7.2",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"serverless-http": "^2.7.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@friggframework/eslint-config": "2.0.0--canary.461.
|
|
38
|
-
"@friggframework/prettier-config": "2.0.0--canary.461.
|
|
37
|
+
"@friggframework/eslint-config": "2.0.0--canary.461.4e47399.0",
|
|
38
|
+
"@friggframework/prettier-config": "2.0.0--canary.461.4e47399.0",
|
|
39
39
|
"aws-sdk-client-mock": "^4.1.0",
|
|
40
40
|
"aws-sdk-client-mock-jest": "^4.1.0",
|
|
41
41
|
"jest": "^30.1.3",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "4e4739922e59468d0c85a3f2c15df25b240082d9"
|
|
74
74
|
}
|