@friggframework/devtools 2.0.0--canary.428.3bab734.0 → 2.0.0--canary.428.4fa6f20.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.
|
@@ -60,15 +60,13 @@ const getAppEnvironmentVars = (AppDefinition) => {
|
|
|
60
60
|
|
|
61
61
|
if (envKeys.length > 0) {
|
|
62
62
|
console.log(
|
|
63
|
-
` Found ${
|
|
64
|
-
envKeys.length
|
|
63
|
+
` Found ${envKeys.length
|
|
65
64
|
} environment variables: ${envKeys.join(', ')}`
|
|
66
65
|
);
|
|
67
66
|
}
|
|
68
67
|
if (skippedKeys.length > 0) {
|
|
69
68
|
console.log(
|
|
70
|
-
` ⚠️ Skipped ${
|
|
71
|
-
skippedKeys.length
|
|
69
|
+
` ⚠️ Skipped ${skippedKeys.length
|
|
72
70
|
} reserved AWS Lambda variables: ${skippedKeys.join(', ')}`
|
|
73
71
|
);
|
|
74
72
|
}
|
|
@@ -572,6 +570,7 @@ const createVPCInfrastructure = (AppDefinition) => {
|
|
|
572
570
|
* @returns {Object} Complete serverless framework configuration
|
|
573
571
|
*/
|
|
574
572
|
const composeServerlessDefinition = async (AppDefinition) => {
|
|
573
|
+
console.log('composeServerlessDefinition', AppDefinition);
|
|
575
574
|
// Store discovered resources
|
|
576
575
|
let discoveredResources = {};
|
|
577
576
|
|
|
@@ -942,10 +941,9 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
942
941
|
Resource: '*',
|
|
943
942
|
Condition: {
|
|
944
943
|
StringEquals: {
|
|
945
|
-
'kms:ViaService': `lambda.${
|
|
946
|
-
process.env.AWS_REGION ||
|
|
944
|
+
'kms:ViaService': `lambda.${process.env.AWS_REGION ||
|
|
947
945
|
'us-east-1'
|
|
948
|
-
|
|
946
|
+
}.amazonaws.com`,
|
|
949
947
|
},
|
|
950
948
|
},
|
|
951
949
|
},
|
|
@@ -982,7 +980,7 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
982
980
|
// No key found and createIfNoneFound is not enabled - error
|
|
983
981
|
throw new Error(
|
|
984
982
|
'KMS field-level encryption is enabled but no KMS key was found. ' +
|
|
985
|
-
|
|
983
|
+
'Either provide an existing KMS key or set encryption.createResourceIfNoneFound to true to create a new key.'
|
|
986
984
|
);
|
|
987
985
|
}
|
|
988
986
|
}
|
|
@@ -1068,11 +1066,11 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
1068
1066
|
subnetIds:
|
|
1069
1067
|
AppDefinition.vpc.subnetIds ||
|
|
1070
1068
|
(discoveredResources.privateSubnetId1 &&
|
|
1071
|
-
|
|
1069
|
+
discoveredResources.privateSubnetId2
|
|
1072
1070
|
? [
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1071
|
+
discoveredResources.privateSubnetId1,
|
|
1072
|
+
discoveredResources.privateSubnetId2,
|
|
1073
|
+
]
|
|
1076
1074
|
: []),
|
|
1077
1075
|
};
|
|
1078
1076
|
|
|
@@ -1086,11 +1084,15 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
1086
1084
|
// ALWAYS manage NAT Gateway through CloudFormation for self-healing
|
|
1087
1085
|
// This ensures NAT Gateway is always in the correct subnet with proper configuration
|
|
1088
1086
|
|
|
1087
|
+
console.log('AppDefinition.vpc.natGateway', AppDefinition.vpc.natGateway);
|
|
1089
1088
|
const natGatewayMethod =
|
|
1090
1089
|
AppDefinition.vpc.natGateway?.method || 'useExisting';
|
|
1090
|
+
console.log('natGatewayMethod', natGatewayMethod);
|
|
1091
1091
|
const needsNewNatGateway =
|
|
1092
1092
|
natGatewayMethod === 'createAndManage';
|
|
1093
1093
|
|
|
1094
|
+
console.log('needsNewNatGateway', needsNewNatGateway);
|
|
1095
|
+
|
|
1094
1096
|
// Helper function to validate discovered public subnet
|
|
1095
1097
|
const isValidPublicSubnet = (subnetId, discoveredResources) => {
|
|
1096
1098
|
// Basic validation - in production, AWSDiscovery should check route tables for IGW routes
|
|
@@ -1128,28 +1130,28 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
1128
1130
|
// Check if Internet Gateway exists or create one
|
|
1129
1131
|
if (!discoveredResources.internetGatewayId) {
|
|
1130
1132
|
definition.resources.Resources.FriggInternetGateway =
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1133
|
+
{
|
|
1134
|
+
Type: 'AWS::EC2::InternetGateway',
|
|
1135
|
+
Properties: {
|
|
1136
|
+
Tags: [
|
|
1137
|
+
{
|
|
1138
|
+
Key: 'Name',
|
|
1139
|
+
Value: '${self:service}-${self:provider.stage}-igw',
|
|
1140
|
+
},
|
|
1141
|
+
],
|
|
1142
|
+
},
|
|
1143
|
+
};
|
|
1142
1144
|
|
|
1143
1145
|
definition.resources.Resources.FriggIGWAttachment =
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
},
|
|
1146
|
+
{
|
|
1147
|
+
Type: 'AWS::EC2::VPCGatewayAttachment',
|
|
1148
|
+
Properties: {
|
|
1149
|
+
VpcId: discoveredResources.defaultVpcId,
|
|
1150
|
+
InternetGatewayId: {
|
|
1151
|
+
Ref: 'FriggInternetGateway',
|
|
1151
1152
|
},
|
|
1152
|
-
}
|
|
1153
|
+
},
|
|
1154
|
+
};
|
|
1153
1155
|
}
|
|
1154
1156
|
|
|
1155
1157
|
// Create a small public subnet for NAT Gateway
|
|
@@ -1209,15 +1211,15 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
1209
1211
|
|
|
1210
1212
|
// Associate public subnet with public route table
|
|
1211
1213
|
definition.resources.Resources.FriggPublicSubnetRouteTableAssociation =
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
},
|
|
1214
|
+
{
|
|
1215
|
+
Type: 'AWS::EC2::SubnetRouteTableAssociation',
|
|
1216
|
+
Properties: {
|
|
1217
|
+
SubnetId: { Ref: 'FriggPublicSubnet' },
|
|
1218
|
+
RouteTableId: {
|
|
1219
|
+
Ref: 'FriggPublicRouteTable',
|
|
1219
1220
|
},
|
|
1220
|
-
}
|
|
1221
|
+
},
|
|
1222
|
+
};
|
|
1221
1223
|
}
|
|
1222
1224
|
|
|
1223
1225
|
// Create NAT Gateway using the new resources
|
|
@@ -1246,6 +1248,7 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
1246
1248
|
},
|
|
1247
1249
|
};
|
|
1248
1250
|
} else if (discoveredResources.existingNatGatewayId) {
|
|
1251
|
+
console.log('discoveredResources.existingNatGatewayId', discoveredResources.existingNatGatewayId);
|
|
1249
1252
|
// Reuse mode: Use existing NAT, but validate first
|
|
1250
1253
|
if (
|
|
1251
1254
|
discoveredResources.publicSubnetId &&
|
|
@@ -1363,30 +1366,30 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
1363
1366
|
.VPCEndpointSecurityGroup
|
|
1364
1367
|
) {
|
|
1365
1368
|
definition.resources.Resources.VPCEndpointSecurityGroup =
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1369
|
+
{
|
|
1370
|
+
Type: 'AWS::EC2::SecurityGroup',
|
|
1371
|
+
Properties: {
|
|
1372
|
+
GroupDescription:
|
|
1373
|
+
'Security group for VPC endpoints',
|
|
1374
|
+
VpcId: discoveredResources.defaultVpcId,
|
|
1375
|
+
SecurityGroupIngress: [
|
|
1376
|
+
{
|
|
1377
|
+
IpProtocol: 'tcp',
|
|
1378
|
+
FromPort: 443,
|
|
1379
|
+
ToPort: 443,
|
|
1380
|
+
CidrIp:
|
|
1381
|
+
discoveredResources.vpcCidr ||
|
|
1382
|
+
'10.0.0.0/16', // Dynamic VPC CIDR
|
|
1383
|
+
},
|
|
1384
|
+
],
|
|
1385
|
+
Tags: [
|
|
1386
|
+
{
|
|
1387
|
+
Key: 'Name',
|
|
1388
|
+
Value: '${self:service}-${self:provider.stage}-vpc-endpoints-sg',
|
|
1389
|
+
},
|
|
1390
|
+
],
|
|
1391
|
+
},
|
|
1392
|
+
};
|
|
1390
1393
|
}
|
|
1391
1394
|
|
|
1392
1395
|
definition.resources.Resources.VPCEndpointKMS = {
|
|
@@ -1407,20 +1410,20 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
1407
1410
|
// Also add Secrets Manager endpoint if using Secrets Manager
|
|
1408
1411
|
if (AppDefinition.secretsManager?.enable === true) {
|
|
1409
1412
|
definition.resources.Resources.VPCEndpointSecretsManager =
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1413
|
+
{
|
|
1414
|
+
Type: 'AWS::EC2::VPCEndpoint',
|
|
1415
|
+
Properties: {
|
|
1416
|
+
VpcId: discoveredResources.defaultVpcId,
|
|
1417
|
+
ServiceName:
|
|
1418
|
+
'com.amazonaws.${self:provider.region}.secretsmanager',
|
|
1419
|
+
VpcEndpointType: 'Interface',
|
|
1420
|
+
SubnetIds: vpcConfig.subnetIds,
|
|
1421
|
+
SecurityGroupIds: [
|
|
1422
|
+
{ Ref: 'VPCEndpointSecurityGroup' },
|
|
1423
|
+
],
|
|
1424
|
+
PrivateDnsEnabled: true,
|
|
1425
|
+
},
|
|
1426
|
+
};
|
|
1424
1427
|
}
|
|
1425
1428
|
}
|
|
1426
1429
|
}
|
|
@@ -1483,10 +1486,9 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
1483
1486
|
};
|
|
1484
1487
|
|
|
1485
1488
|
// Add SQS Queue for the integration
|
|
1486
|
-
const queueReference = `${
|
|
1487
|
-
integrationName.charAt(0).toUpperCase() +
|
|
1489
|
+
const queueReference = `${integrationName.charAt(0).toUpperCase() +
|
|
1488
1490
|
integrationName.slice(1)
|
|
1489
|
-
|
|
1491
|
+
}Queue`;
|
|
1490
1492
|
const queueName = `\${self:service}--\${self:provider.stage}-${queueReference}`;
|
|
1491
1493
|
definition.resources.Resources[queueReference] = {
|
|
1492
1494
|
Type: 'AWS::SQS::Queue',
|
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.
|
|
4
|
+
"version": "2.0.0--canary.428.4fa6f20.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.
|
|
13
|
-
"@friggframework/test": "2.0.0--canary.428.
|
|
12
|
+
"@friggframework/schemas": "2.0.0--canary.428.4fa6f20.0",
|
|
13
|
+
"@friggframework/test": "2.0.0--canary.428.4fa6f20.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.
|
|
36
|
-
"@friggframework/prettier-config": "2.0.0--canary.428.
|
|
35
|
+
"@friggframework/eslint-config": "2.0.0--canary.428.4fa6f20.0",
|
|
36
|
+
"@friggframework/prettier-config": "2.0.0--canary.428.4fa6f20.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": "
|
|
69
|
+
"gitHead": "4fa6f20b9371677cb86a8035ac9736af726ffa82"
|
|
70
70
|
}
|