@friggframework/devtools 2.0.0--canary.425.06986ff.0 → 2.0.0--canary.425.1dfec23.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.
- package/infrastructure/__tests__/fixtures/mock-aws-resources.js +2 -2
- package/infrastructure/build-time-discovery.js +1 -1
- package/infrastructure/integration.test.js +3 -3
- package/infrastructure/serverless-template.js +11 -2
- package/infrastructure/serverless-template.test.js +3 -2
- package/package.json +6 -6
|
@@ -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) {
|
|
@@ -998,6 +997,16 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
998
997
|
'${env:AWS_DISCOVERY_KMS_KEY_ID}',
|
|
999
998
|
};
|
|
1000
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
|
+
// Use the discovered value directly when available (from in-process discovery)
|
|
1005
|
+
// Otherwise fall back to environment variable (from separate discovery process)
|
|
1006
|
+
definition.provider.environment.KMS_KEY_ARN =
|
|
1007
|
+
discoveredResources.defaultKmsKeyId ||
|
|
1008
|
+
'${env:AWS_DISCOVERY_KMS_KEY_ID}';
|
|
1009
|
+
}
|
|
1001
1010
|
}
|
|
1002
1011
|
|
|
1003
1012
|
// VPC Configuration based on App Definition
|
|
@@ -291,8 +291,9 @@ describe('composeServerlessDefinition', () => {
|
|
|
291
291
|
expect(result.plugins).toContain('serverless-kms-grants');
|
|
292
292
|
|
|
293
293
|
// Check custom configuration
|
|
294
|
+
// When creating a new key, it should reference the CloudFormation resource
|
|
294
295
|
expect(result.custom.kmsGrants).toEqual({
|
|
295
|
-
kmsKeyId: '
|
|
296
|
+
kmsKeyId: { 'Fn::GetAtt': ['FriggKMSKey', 'Arn'] }
|
|
296
297
|
});
|
|
297
298
|
});
|
|
298
299
|
|
|
@@ -545,7 +546,7 @@ describe('composeServerlessDefinition', () => {
|
|
|
545
546
|
|
|
546
547
|
// VPC
|
|
547
548
|
expect(result.provider.vpc).toBeDefined();
|
|
548
|
-
|
|
549
|
+
// custom.vpc doesn't exist in the serverless template
|
|
549
550
|
expect(result.resources.Resources.VPCEndpointS3).toBeDefined();
|
|
550
551
|
|
|
551
552
|
// KMS
|
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.1dfec23.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.1dfec23.0",
|
|
13
|
+
"@friggframework/test": "2.0.0--canary.425.1dfec23.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.1dfec23.0",
|
|
36
|
+
"@friggframework/prettier-config": "2.0.0--canary.425.1dfec23.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": "1dfec23b99101cc38c651a6e2dff99c67b346b72"
|
|
70
70
|
}
|