@friggframework/devtools 2.0.0--canary.425.dd575ef.0 → 2.0.0--canary.425.29ee443.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.
|
@@ -281,7 +281,7 @@ const mockEnvironmentVariables = {
|
|
|
281
281
|
AWS_DISCOVERY_SUBNET_ID_1: mockSubnets[0].SubnetId,
|
|
282
282
|
AWS_DISCOVERY_SUBNET_ID_2: mockSubnets[1].SubnetId,
|
|
283
283
|
AWS_DISCOVERY_ROUTE_TABLE_ID: mockRouteTables[0].RouteTableId,
|
|
284
|
-
AWS_DISCOVERY_KMS_KEY_ID:
|
|
284
|
+
AWS_DISCOVERY_KMS_KEY_ID:mockKmsKeyMetadata.Arn
|
|
285
285
|
};
|
|
286
286
|
|
|
287
287
|
// Fallback environment variables for error scenarios
|
|
@@ -291,7 +291,7 @@ const mockFallbackEnvironmentVariables = {
|
|
|
291
291
|
AWS_DISCOVERY_SUBNET_ID_1: 'subnet-fallback-1',
|
|
292
292
|
AWS_DISCOVERY_SUBNET_ID_2: 'subnet-fallback-2',
|
|
293
293
|
AWS_DISCOVERY_ROUTE_TABLE_ID: 'rtb-fallback',
|
|
294
|
-
AWS_DISCOVERY_KMS_KEY_ID:
|
|
294
|
+
AWS_DISCOVERY_KMS_KEY_ID:'arn:aws:kms:*:*:key/*'
|
|
295
295
|
};
|
|
296
296
|
|
|
297
297
|
// Mock AWS SDK responses
|
|
@@ -159,7 +159,7 @@ class BuildTimeDiscovery {
|
|
|
159
159
|
AWS_DISCOVERY_SUBNET_ID_2: resources.privateSubnetId2,
|
|
160
160
|
AWS_DISCOVERY_PUBLIC_SUBNET_ID: resources.publicSubnetId,
|
|
161
161
|
AWS_DISCOVERY_ROUTE_TABLE_ID: resources.privateRouteTableId,
|
|
162
|
-
AWS_DISCOVERY_KMS_KEY_ID: resources.defaultKmsKeyId
|
|
162
|
+
AWS_DISCOVERY_KMS_KEY_ID: resources.defaultKmsKeyId // Keep consistent naming convention (even though it's an ARN)
|
|
163
163
|
};
|
|
164
164
|
|
|
165
165
|
// Set environment variables for serverless to use
|
|
@@ -67,7 +67,7 @@ describe('VPC/KMS/SSM Integration Tests', () => {
|
|
|
67
67
|
process.env.AWS_DISCOVERY_SUBNET_ID_1 = discoveredResources.privateSubnetId1;
|
|
68
68
|
process.env.AWS_DISCOVERY_SUBNET_ID_2 = discoveredResources.privateSubnetId2;
|
|
69
69
|
process.env.AWS_DISCOVERY_ROUTE_TABLE_ID = discoveredResources.privateRouteTableId;
|
|
70
|
-
process.env.AWS_DISCOVERY_KMS_KEY_ID =
|
|
70
|
+
process.env.AWS_DISCOVERY_KMS_KEY_ID =discoveredResources.defaultKmsKeyId;
|
|
71
71
|
|
|
72
72
|
// Generate serverless configuration
|
|
73
73
|
const serverlessConfig = composeServerlessDefinition(appDefinition);
|
|
@@ -177,7 +177,7 @@ describe('VPC/KMS/SSM Integration Tests', () => {
|
|
|
177
177
|
integrations: []
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
process.env.AWS_DISCOVERY_KMS_KEY_ID =
|
|
180
|
+
process.env.AWS_DISCOVERY_KMS_KEY_ID =mockAWSResources.defaultKmsKeyId;
|
|
181
181
|
|
|
182
182
|
const serverlessConfig = composeServerlessDefinition(appDefinition);
|
|
183
183
|
|
|
@@ -302,7 +302,7 @@ describe('VPC/KMS/SSM Integration Tests', () => {
|
|
|
302
302
|
process.env.AWS_DISCOVERY_SECURITY_GROUP_ID = mockAWSResources.defaultSecurityGroupId;
|
|
303
303
|
process.env.AWS_DISCOVERY_SUBNET_ID_1 = mockAWSResources.privateSubnetId1;
|
|
304
304
|
process.env.AWS_DISCOVERY_SUBNET_ID_2 = mockAWSResources.privateSubnetId2;
|
|
305
|
-
process.env.AWS_DISCOVERY_KMS_KEY_ID =
|
|
305
|
+
process.env.AWS_DISCOVERY_KMS_KEY_ID =mockAWSResources.defaultKmsKeyId;
|
|
306
306
|
|
|
307
307
|
// In a real deployment, serverless framework would resolve these environment variables
|
|
308
308
|
// For testing, we can verify the placeholders are correctly formatted
|
|
@@ -901,8 +901,7 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
901
901
|
Resource: [discoveredResources.defaultKmsKeyId],
|
|
902
902
|
});
|
|
903
903
|
|
|
904
|
-
|
|
905
|
-
discoveredResources.defaultKmsKeyId;
|
|
904
|
+
// KMS_KEY_ARN will be set later from custom.kmsGrants for consistency
|
|
906
905
|
} else {
|
|
907
906
|
// No existing key found - check if we should create one or error
|
|
908
907
|
if (AppDefinition.encryption?.createResourceIfNoneFound === true) {
|
|
@@ -974,6 +973,11 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
974
973
|
definition.provider.environment.KMS_KEY_ARN = {
|
|
975
974
|
'Fn::GetAtt': ['FriggKMSKey', 'Arn'],
|
|
976
975
|
};
|
|
976
|
+
|
|
977
|
+
// Configure KMS grants to reference the created key
|
|
978
|
+
definition.custom.kmsGrants = {
|
|
979
|
+
kmsKeyId: { 'Fn::GetAtt': ['FriggKMSKey', 'Arn'] }
|
|
980
|
+
};
|
|
977
981
|
} else {
|
|
978
982
|
// No key found and createIfNoneFound is not enabled - error
|
|
979
983
|
throw new Error(
|
|
@@ -985,12 +989,20 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
985
989
|
|
|
986
990
|
definition.plugins.push('serverless-kms-grants');
|
|
987
991
|
|
|
988
|
-
// Configure KMS grants
|
|
989
|
-
definition.custom.kmsGrants
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
992
|
+
// Configure KMS grants if not already set (when using existing key)
|
|
993
|
+
if (!definition.custom.kmsGrants) {
|
|
994
|
+
definition.custom.kmsGrants = {
|
|
995
|
+
kmsKeyId:
|
|
996
|
+
discoveredResources.defaultKmsKeyId ||
|
|
997
|
+
'${env:AWS_DISCOVERY_KMS_KEY_ID}',
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// Always set KMS_KEY_ARN from custom.kmsGrants for consistency
|
|
1002
|
+
// This translates AWS_DISCOVERY_KMS_KEY_ID to the runtime variable KMS_KEY_ARN
|
|
1003
|
+
if (!definition.provider.environment.KMS_KEY_ARN) {
|
|
1004
|
+
definition.provider.environment.KMS_KEY_ARN = '${self:custom.kmsGrants.kmsKeyId}';
|
|
1005
|
+
}
|
|
994
1006
|
}
|
|
995
1007
|
|
|
996
1008
|
// VPC Configuration based on App Definition
|
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.425.
|
|
4
|
+
"version": "2.0.0--canary.425.29ee443.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.425.
|
|
13
|
-
"@friggframework/test": "2.0.0--canary.425.
|
|
12
|
+
"@friggframework/schemas": "2.0.0--canary.425.29ee443.0",
|
|
13
|
+
"@friggframework/test": "2.0.0--canary.425.29ee443.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.425.
|
|
36
|
-
"@friggframework/prettier-config": "2.0.0--canary.425.
|
|
35
|
+
"@friggframework/eslint-config": "2.0.0--canary.425.29ee443.0",
|
|
36
|
+
"@friggframework/prettier-config": "2.0.0--canary.425.29ee443.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": "29ee443b5bd48e5b110352428c097e6f0c27941f"
|
|
70
70
|
}
|