@friggframework/devtools 2.0.0--canary.461.05cdcd5.0 → 2.0.0--canary.461.a5281ce.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.
@@ -558,6 +558,9 @@ class VpcBuilder extends InfrastructureBuilder {
558
558
  if (discoveredResources.existingNatGatewayId && !discoveredResources.natGatewayInPrivateSubnet) {
559
559
  console.log(` Reusing discovered NAT Gateway: ${discoveredResources.existingNatGatewayId}`);
560
560
  result.natGatewayId = discoveredResources.existingNatGatewayId;
561
+
562
+ // Still need to create route table and associations for discovered NAT
563
+ this.createNatGatewayRouting(appDefinition, discoveredResources, result, discoveredResources.existingNatGatewayId);
561
564
  return;
562
565
  }
563
566
 
@@ -593,32 +596,48 @@ class VpcBuilder extends InfrastructureBuilder {
593
596
  },
594
597
  };
595
598
 
599
+ // Create routing for the new NAT Gateway
600
+ this.createNatGatewayRouting(appDefinition, discoveredResources, result, { Ref: 'FriggNATGateway' });
601
+
602
+ console.log(' ✅ NAT Gateway infrastructure created');
603
+ }
604
+
605
+ /**
606
+ * Create route table and associations for NAT Gateway
607
+ */
608
+ createNatGatewayRouting(appDefinition, discoveredResources, result, natGatewayId) {
596
609
  // Private route table with NAT Gateway route
597
- result.resources.FriggLambdaRouteTable = {
598
- Type: 'AWS::EC2::RouteTable',
599
- Properties: {
600
- VpcId: result.vpcId,
601
- Tags: [
602
- { Key: 'Name', Value: '${self:service}-${self:provider.stage}-lambda-rt' },
603
- { Key: 'ManagedBy', Value: 'Frigg' },
604
- ],
605
- },
606
- };
610
+ if (!result.resources.FriggLambdaRouteTable) {
611
+ result.resources.FriggLambdaRouteTable = {
612
+ Type: 'AWS::EC2::RouteTable',
613
+ Properties: {
614
+ VpcId: result.vpcId,
615
+ Tags: [
616
+ { Key: 'Name', Value: '${self:service}-${self:provider.stage}-lambda-rt' },
617
+ { Key: 'ManagedBy', Value: 'Frigg' },
618
+ ],
619
+ },
620
+ };
621
+ }
607
622
 
608
623
  result.resources.FriggPrivateRoute = {
609
624
  Type: 'AWS::EC2::Route',
610
625
  Properties: {
611
626
  RouteTableId: { Ref: 'FriggLambdaRouteTable' },
612
627
  DestinationCidrBlock: '0.0.0.0/0',
613
- NatGatewayId: { Ref: 'FriggNATGateway' },
628
+ NatGatewayId: natGatewayId,
614
629
  },
615
630
  };
616
631
 
617
632
  // Associate route table with private subnets
633
+ // Use discovered subnet IDs or CloudFormation references
634
+ const subnet1Id = discoveredResources.privateSubnetId1 || { Ref: 'FriggPrivateSubnet1' };
635
+ const subnet2Id = discoveredResources.privateSubnetId2 || { Ref: 'FriggPrivateSubnet2' };
636
+
618
637
  result.resources.FriggPrivateSubnet1RouteTableAssociation = {
619
638
  Type: 'AWS::EC2::SubnetRouteTableAssociation',
620
639
  Properties: {
621
- SubnetId: { Ref: 'FriggPrivateSubnet1' },
640
+ SubnetId: subnet1Id,
622
641
  RouteTableId: { Ref: 'FriggLambdaRouteTable' },
623
642
  },
624
643
  };
@@ -626,12 +645,12 @@ class VpcBuilder extends InfrastructureBuilder {
626
645
  result.resources.FriggPrivateSubnet2RouteTableAssociation = {
627
646
  Type: 'AWS::EC2::SubnetRouteTableAssociation',
628
647
  Properties: {
629
- SubnetId: { Ref: 'FriggPrivateSubnet2' },
648
+ SubnetId: subnet2Id,
630
649
  RouteTableId: { Ref: 'FriggLambdaRouteTable' },
631
650
  },
632
651
  };
633
652
 
634
- console.log(' ✅ NAT Gateway infrastructure created');
653
+ console.log(' ✅ Route table and subnet associations created');
635
654
  }
636
655
 
637
656
  /**
@@ -85,6 +85,7 @@ function getAppEnvironmentVars(appDefinition) {
85
85
  function buildEnvironment(appEnvironmentVars, discoveredResources) {
86
86
  const environment = {
87
87
  ...appEnvironmentVars,
88
+ STAGE: '${self:provider.stage}', // Used by encryption bypass logic
88
89
  FRIGG_STACK: '${self:service}',
89
90
  FRIGG_STAGE: '${self:provider.stage}',
90
91
  FRIGG_REGION: '${self:provider.region}',
@@ -118,6 +118,7 @@ describe('Environment Builder', () => {
118
118
  const result = buildEnvironment(appEnvironmentVars, discoveredResources);
119
119
 
120
120
  expect(result.API_KEY).toBe("${env:API_KEY, ''}");
121
+ expect(result.STAGE).toBe('${self:provider.stage}');
121
122
  expect(result.FRIGG_STACK).toBe('${self:service}');
122
123
  expect(result.FRIGG_STAGE).toBe('${self:provider.stage}');
123
124
  expect(result.FRIGG_REGION).toBe('${self:provider.region}');
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.05cdcd5.0",
4
+ "version": "2.0.0--canary.461.a5281ce.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.05cdcd5.0",
15
- "@friggframework/test": "2.0.0--canary.461.05cdcd5.0",
14
+ "@friggframework/schemas": "2.0.0--canary.461.a5281ce.0",
15
+ "@friggframework/test": "2.0.0--canary.461.a5281ce.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.05cdcd5.0",
38
- "@friggframework/prettier-config": "2.0.0--canary.461.05cdcd5.0",
37
+ "@friggframework/eslint-config": "2.0.0--canary.461.a5281ce.0",
38
+ "@friggframework/prettier-config": "2.0.0--canary.461.a5281ce.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": "05cdcd50575f815cc79e9686993cf272a24005b8"
73
+ "gitHead": "a5281ced43fde23f359098090034ef3bddb234ac"
74
74
  }