@friggframework/devtools 2.0.0--canary.490.9b2c8b2.0 → 2.0.0--canary.490.b93c127.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.
|
@@ -164,6 +164,7 @@ class CloudFormationDiscovery {
|
|
|
164
164
|
const subnetAssociations = associations.filter(a => a.SubnetId);
|
|
165
165
|
|
|
166
166
|
console.log(` DEBUG: Route table has ${associations.length} associations, ${subnetAssociations.length} with SubnetId`);
|
|
167
|
+
console.log(` DEBUG: Route table structure:`, JSON.stringify(routeTable, null, 2).substring(0, 500));
|
|
167
168
|
console.log(` DEBUG: discovered.privateSubnetId1 = ${discovered.privateSubnetId1}, discovered.privateSubnetId2 = ${discovered.privateSubnetId2}`);
|
|
168
169
|
|
|
169
170
|
if (subnetAssociations.length >= 1 && !discovered.privateSubnetId1) {
|
|
@@ -371,6 +372,18 @@ class CloudFormationDiscovery {
|
|
|
371
372
|
}
|
|
372
373
|
discovered.routeTableAssociations.push(PhysicalResourceId);
|
|
373
374
|
console.log(` ✓ Found route table association: ${LogicalResourceId}`);
|
|
375
|
+
|
|
376
|
+
// CRITICAL: Extract subnet ID from association physical ID by querying EC2
|
|
377
|
+
// Physical ID is the association ID (rtbassoc-xxx), need to query to get subnet
|
|
378
|
+
if (this.provider && this.provider.getEC2Client &&
|
|
379
|
+
(LogicalResourceId === 'FriggSubnet1RouteAssociation' || LogicalResourceId === 'FriggPrivateSubnet1RouteTableAssociation')) {
|
|
380
|
+
// Store association ID to query later (after loop)
|
|
381
|
+
discovered._subnet1AssociationId = PhysicalResourceId;
|
|
382
|
+
}
|
|
383
|
+
if (this.provider && this.provider.getEC2Client &&
|
|
384
|
+
(LogicalResourceId === 'FriggSubnet2RouteAssociation' || LogicalResourceId === 'FriggPrivateSubnet2RouteTableAssociation')) {
|
|
385
|
+
discovered._subnet2AssociationId = PhysicalResourceId;
|
|
386
|
+
}
|
|
374
387
|
}
|
|
375
388
|
|
|
376
389
|
// VPC - direct extraction (primary method)
|
|
@@ -545,6 +558,66 @@ class CloudFormationDiscovery {
|
|
|
545
558
|
}
|
|
546
559
|
}
|
|
547
560
|
|
|
561
|
+
// Extract subnet IDs from route table associations (if route table query didn't populate them)
|
|
562
|
+
// Query EC2 to describe the association and get the subnet ID
|
|
563
|
+
console.log(` DEBUG: Checking subnet association extraction - _subnet1AssociationId: ${discovered._subnet1AssociationId}, _subnet2AssociationId: ${discovered._subnet2AssociationId}`);
|
|
564
|
+
|
|
565
|
+
if (!discovered.privateSubnetId1 && discovered._subnet1AssociationId && this.provider && this.provider.getEC2Client) {
|
|
566
|
+
try {
|
|
567
|
+
console.log(` Querying EC2 for subnet from association ${discovered._subnet1AssociationId}...`);
|
|
568
|
+
const { DescribeRouteTablesCommand } = require('@aws-sdk/client-ec2');
|
|
569
|
+
const ec2 = this.provider.getEC2Client();
|
|
570
|
+
|
|
571
|
+
// Query route table by association ID to get subnet
|
|
572
|
+
const rtResponse = await ec2.send(new DescribeRouteTablesCommand({
|
|
573
|
+
Filters: [
|
|
574
|
+
{ Name: 'association.association-id', Values: [discovered._subnet1AssociationId] }
|
|
575
|
+
]
|
|
576
|
+
}));
|
|
577
|
+
|
|
578
|
+
if (rtResponse.RouteTables && rtResponse.RouteTables[0]) {
|
|
579
|
+
const assoc = rtResponse.RouteTables[0].Associations.find(a =>
|
|
580
|
+
a.RouteTableAssociationId === discovered._subnet1AssociationId
|
|
581
|
+
);
|
|
582
|
+
if (assoc && assoc.SubnetId) {
|
|
583
|
+
discovered.privateSubnetId1 = assoc.SubnetId;
|
|
584
|
+
console.log(` ✓ Extracted private subnet 1 from association query: ${assoc.SubnetId}`);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
} catch (error) {
|
|
588
|
+
console.warn(` ⚠️ Could not query subnet from association: ${error.message}`);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
if (!discovered.privateSubnetId2 && discovered._subnet2AssociationId && this.provider && this.provider.getEC2Client) {
|
|
593
|
+
try {
|
|
594
|
+
const { DescribeRouteTablesCommand } = require('@aws-sdk/client-ec2');
|
|
595
|
+
const ec2 = this.provider.getEC2Client();
|
|
596
|
+
|
|
597
|
+
const rtResponse = await ec2.send(new DescribeRouteTablesCommand({
|
|
598
|
+
Filters: [
|
|
599
|
+
{ Name: 'association.association-id', Values: [discovered._subnet2AssociationId] }
|
|
600
|
+
]
|
|
601
|
+
}));
|
|
602
|
+
|
|
603
|
+
if (rtResponse.RouteTables && rtResponse.RouteTables[0]) {
|
|
604
|
+
const assoc = rtResponse.RouteTables[0].Associations.find(a =>
|
|
605
|
+
a.RouteTableAssociationId === discovered._subnet2AssociationId
|
|
606
|
+
);
|
|
607
|
+
if (assoc && assoc.SubnetId) {
|
|
608
|
+
discovered.privateSubnetId2 = assoc.SubnetId;
|
|
609
|
+
console.log(` ✓ Extracted private subnet 2 from association query: ${assoc.SubnetId}`);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
} catch (error) {
|
|
613
|
+
console.warn(` ⚠️ Could not query subnet from association: ${error.message}`);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// Clean up temporary association IDs
|
|
618
|
+
delete discovered._subnet1AssociationId;
|
|
619
|
+
delete discovered._subnet2AssociationId;
|
|
620
|
+
|
|
548
621
|
// Check for KMS key alias via AWS API if not found in stack resources
|
|
549
622
|
// This handles cases where the alias was created outside CloudFormation
|
|
550
623
|
if (!discovered.defaultKmsKeyId && !discovered.kmsKeyAlias &&
|
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.
|
|
4
|
+
"version": "2.0.0--canary.490.b93c127.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.
|
|
20
|
-
"@friggframework/schemas": "2.0.0--canary.490.
|
|
21
|
-
"@friggframework/test": "2.0.0--canary.490.
|
|
19
|
+
"@friggframework/core": "2.0.0--canary.490.b93c127.0",
|
|
20
|
+
"@friggframework/schemas": "2.0.0--canary.490.b93c127.0",
|
|
21
|
+
"@friggframework/test": "2.0.0--canary.490.b93c127.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.
|
|
50
|
-
"@friggframework/prettier-config": "2.0.0--canary.490.
|
|
49
|
+
"@friggframework/eslint-config": "2.0.0--canary.490.b93c127.0",
|
|
50
|
+
"@friggframework/prettier-config": "2.0.0--canary.490.b93c127.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": "
|
|
82
|
+
"gitHead": "b93c1271110aaecf2fb36d5b9b39d35fad1c4dc5"
|
|
83
83
|
}
|