@friggframework/devtools 2.0.0--canary.428.4dfa677.0 → 2.0.0--canary.428.95f8e10.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.
@@ -388,27 +388,44 @@ class AWSDiscovery {
388
388
  }
389
389
  ]
390
390
  });
391
-
391
+
392
392
  const response = await this.ec2Client.send(command);
393
-
393
+
394
394
  if (response.NatGateways && response.NatGateways.length > 0) {
395
- // Find a NAT Gateway tagged for Frigg first
396
- const friggNatGateway = response.NatGateways.find(nat =>
397
- nat.Tags && nat.Tags.some(tag =>
395
+ // Check each NAT Gateway to ensure it's in a public subnet
396
+ for (const natGateway of response.NatGateways) {
397
+ const subnetId = natGateway.SubnetId;
398
+ const isPrivate = await this.isSubnetPrivate(subnetId);
399
+
400
+ if (isPrivate) {
401
+ console.warn(`WARNING: NAT Gateway ${natGateway.NatGatewayId} is in private subnet ${subnetId} - this will not work!`);
402
+ console.warn('NAT Gateways MUST be placed in public subnets with Internet Gateway routes');
403
+ console.warn('Skipping this misconfigured NAT Gateway...');
404
+ continue; // Skip this NAT Gateway
405
+ }
406
+
407
+ // Check if it's a Frigg-tagged NAT Gateway
408
+ const isFriggNat = natGateway.Tags && natGateway.Tags.some(tag =>
398
409
  tag.Key === 'Name' && tag.Value.includes('frigg')
399
- )
400
- );
401
-
402
- if (friggNatGateway) {
403
- console.log(`Found existing Frigg NAT Gateway: ${friggNatGateway.NatGatewayId}`);
404
- return friggNatGateway;
410
+ );
411
+
412
+ if (isFriggNat) {
413
+ console.log(`Found existing Frigg NAT Gateway in public subnet: ${natGateway.NatGatewayId}`);
414
+ return natGateway;
415
+ }
416
+
417
+ // Keep track of first valid NAT Gateway as fallback
418
+ console.log(`Found existing NAT Gateway in public subnet: ${natGateway.NatGatewayId}`);
419
+ return natGateway; // Return first NAT Gateway that's in a public subnet
405
420
  }
406
-
407
- // Return first available NAT Gateway if no Frigg-specific one found
408
- console.log(`Found existing NAT Gateway: ${response.NatGateways[0].NatGatewayId}`);
409
- return response.NatGateways[0];
421
+
422
+ // All NAT Gateways are in private subnets - don't use any of them
423
+ console.error(`ERROR: Found ${response.NatGateways.length} NAT Gateway(s) but all are in private subnets!`);
424
+ console.error('These NAT Gateways will not provide internet connectivity');
425
+ console.error('A new NAT Gateway will be created in a public subnet');
426
+ return null; // Return null to trigger creation of new NAT Gateway
410
427
  }
411
-
428
+
412
429
  return null;
413
430
  } catch (error) {
414
431
  console.warn('Error finding existing NAT Gateway:', error.message);
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.428.4dfa677.0",
4
+ "version": "2.0.0--canary.428.95f8e10.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-ec2": "^3.835.0",
7
7
  "@aws-sdk/client-kms": "^3.835.0",
@@ -9,8 +9,8 @@
9
9
  "@babel/eslint-parser": "^7.18.9",
10
10
  "@babel/parser": "^7.25.3",
11
11
  "@babel/traverse": "^7.25.3",
12
- "@friggframework/schemas": "2.0.0--canary.428.4dfa677.0",
13
- "@friggframework/test": "2.0.0--canary.428.4dfa677.0",
12
+ "@friggframework/schemas": "2.0.0--canary.428.95f8e10.0",
13
+ "@friggframework/test": "2.0.0--canary.428.95f8e10.0",
14
14
  "@hapi/boom": "^10.0.1",
15
15
  "@inquirer/prompts": "^5.3.8",
16
16
  "axios": "^1.7.2",
@@ -32,8 +32,8 @@
32
32
  "serverless-http": "^2.7.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@friggframework/eslint-config": "2.0.0--canary.428.4dfa677.0",
36
- "@friggframework/prettier-config": "2.0.0--canary.428.4dfa677.0",
35
+ "@friggframework/eslint-config": "2.0.0--canary.428.95f8e10.0",
36
+ "@friggframework/prettier-config": "2.0.0--canary.428.95f8e10.0",
37
37
  "jest": "^30.1.3",
38
38
  "prettier": "^2.7.1",
39
39
  "serverless": "3.39.0",
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "4dfa6772d058ce8bb7a6ecc6313c070d57e4bc23"
69
+ "gitHead": "95f8e103995bc1c11331a44e49b232dfdd2e5604"
70
70
  }