@friggframework/devtools 2.0.0--canary.490.e3e31cf.0 → 2.0.0--canary.490.cb533fb.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.
@@ -220,16 +220,6 @@ class CloudFormationDiscovery {
220
220
  discovered.existingLogicalIds = [];
221
221
  }
222
222
 
223
- // DEBUG: Log all VPC-related resources CloudFormation returns
224
- console.log(' DEBUG: VPC-related resources from CloudFormation:');
225
- resources.filter(r =>
226
- r.LogicalResourceId.includes('VPCEndpoint') ||
227
- r.LogicalResourceId.includes('Route') ||
228
- r.LogicalResourceId.includes('RouteTable')
229
- ).forEach(r => {
230
- console.log(` - ${r.LogicalResourceId} (${r.ResourceType}): ${r.PhysicalResourceId}`);
231
- });
232
-
233
223
  for (const resource of resources) {
234
224
  const { LogicalResourceId, PhysicalResourceId, ResourceType } = resource;
235
225
 
@@ -239,9 +229,6 @@ class CloudFormationDiscovery {
239
229
  LogicalResourceId.includes('Migration') ||
240
230
  LogicalResourceId.startsWith('VPCEndpoint')) {
241
231
  discovered.existingLogicalIds.push(LogicalResourceId);
242
- if (LogicalResourceId.includes('Route') || LogicalResourceId.includes('VPCEndpoint')) {
243
- console.log(` DEBUG: Added to existingLogicalIds: ${LogicalResourceId}`);
244
- }
245
232
  }
246
233
 
247
234
  // Debug Aurora detection
@@ -558,6 +545,66 @@ class CloudFormationDiscovery {
558
545
  }
559
546
  }
560
547
 
548
+ // Extract subnet IDs from route table associations (if route table query didn't populate them)
549
+ // Query EC2 to describe the association and get the subnet ID
550
+ console.log(` DEBUG: Checking subnet association extraction - _subnet1AssociationId: ${discovered._subnet1AssociationId}, _subnet2AssociationId: ${discovered._subnet2AssociationId}`);
551
+
552
+ if (!discovered.privateSubnetId1 && discovered._subnet1AssociationId && this.provider && this.provider.getEC2Client) {
553
+ try {
554
+ console.log(` Querying EC2 for subnet from association ${discovered._subnet1AssociationId}...`);
555
+ const { DescribeRouteTablesCommand } = require('@aws-sdk/client-ec2');
556
+ const ec2 = this.provider.getEC2Client();
557
+
558
+ // Query route table by association ID to get subnet
559
+ const rtResponse = await ec2.send(new DescribeRouteTablesCommand({
560
+ Filters: [
561
+ { Name: 'association.association-id', Values: [discovered._subnet1AssociationId] }
562
+ ]
563
+ }));
564
+
565
+ if (rtResponse.RouteTables && rtResponse.RouteTables[0]) {
566
+ const assoc = rtResponse.RouteTables[0].Associations.find(a =>
567
+ a.RouteTableAssociationId === discovered._subnet1AssociationId
568
+ );
569
+ if (assoc && assoc.SubnetId) {
570
+ discovered.privateSubnetId1 = assoc.SubnetId;
571
+ console.log(` ✓ Extracted private subnet 1 from association query: ${assoc.SubnetId}`);
572
+ }
573
+ }
574
+ } catch (error) {
575
+ console.warn(` ⚠️ Could not query subnet from association: ${error.message}`);
576
+ }
577
+ }
578
+
579
+ if (!discovered.privateSubnetId2 && discovered._subnet2AssociationId && this.provider && this.provider.getEC2Client) {
580
+ try {
581
+ const { DescribeRouteTablesCommand } = require('@aws-sdk/client-ec2');
582
+ const ec2 = this.provider.getEC2Client();
583
+
584
+ const rtResponse = await ec2.send(new DescribeRouteTablesCommand({
585
+ Filters: [
586
+ { Name: 'association.association-id', Values: [discovered._subnet2AssociationId] }
587
+ ]
588
+ }));
589
+
590
+ if (rtResponse.RouteTables && rtResponse.RouteTables[0]) {
591
+ const assoc = rtResponse.RouteTables[0].Associations.find(a =>
592
+ a.RouteTableAssociationId === discovered._subnet2AssociationId
593
+ );
594
+ if (assoc && assoc.SubnetId) {
595
+ discovered.privateSubnetId2 = assoc.SubnetId;
596
+ console.log(` ✓ Extracted private subnet 2 from association query: ${assoc.SubnetId}`);
597
+ }
598
+ }
599
+ } catch (error) {
600
+ console.warn(` ⚠️ Could not query subnet from association: ${error.message}`);
601
+ }
602
+ }
603
+
604
+ // Clean up temporary association IDs
605
+ delete discovered._subnet1AssociationId;
606
+ delete discovered._subnet2AssociationId;
607
+
561
608
  // Check for KMS key alias via AWS API if not found in stack resources
562
609
  // This handles cases where the alias was created outside CloudFormation
563
610
  if (!discovered.defaultKmsKeyId && !discovered.kmsKeyAlias &&
@@ -872,5 +872,14 @@ describe('CloudFormationDiscovery', () => {
872
872
  expect(result.existingLogicalIds).not.toContain('VPCEndpointS3');
873
873
  });
874
874
  });
875
+
876
+ describe('Subnet extraction from route table associations', () => {
877
+ it.skip('should extract subnet IDs from route table associations when route table Associations array is empty', async () => {
878
+ // TODO: This test needs proper mock setup for EC2 client
879
+ // The code already exists (lines 563-608 in cloudformation-discovery.js)
880
+ // Skipping until we can properly mock the EC2 client chain
881
+ });
882
+
883
+ });
875
884
  });
876
885
 
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.490.e3e31cf.0",
4
+ "version": "2.0.0--canary.490.cb533fb.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
@@ -16,9 +16,9 @@
16
16
  "@babel/eslint-parser": "^7.18.9",
17
17
  "@babel/parser": "^7.25.3",
18
18
  "@babel/traverse": "^7.25.3",
19
- "@friggframework/core": "2.0.0--canary.490.e3e31cf.0",
20
- "@friggframework/schemas": "2.0.0--canary.490.e3e31cf.0",
21
- "@friggframework/test": "2.0.0--canary.490.e3e31cf.0",
19
+ "@friggframework/core": "2.0.0--canary.490.cb533fb.0",
20
+ "@friggframework/schemas": "2.0.0--canary.490.cb533fb.0",
21
+ "@friggframework/test": "2.0.0--canary.490.cb533fb.0",
22
22
  "@hapi/boom": "^10.0.1",
23
23
  "@inquirer/prompts": "^5.3.8",
24
24
  "axios": "^1.7.2",
@@ -46,8 +46,8 @@
46
46
  "validate-npm-package-name": "^5.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@friggframework/eslint-config": "2.0.0--canary.490.e3e31cf.0",
50
- "@friggframework/prettier-config": "2.0.0--canary.490.e3e31cf.0",
49
+ "@friggframework/eslint-config": "2.0.0--canary.490.cb533fb.0",
50
+ "@friggframework/prettier-config": "2.0.0--canary.490.cb533fb.0",
51
51
  "aws-sdk-client-mock": "^4.1.0",
52
52
  "aws-sdk-client-mock-jest": "^4.1.0",
53
53
  "jest": "^30.1.3",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "e3e31cf34e6195098c2b8fec081c4d81db52cdda"
82
+ "gitHead": "cb533fb53e9fbf7c67a9336d36ad60eb27c3cbdc"
83
83
  }