@friggframework/devtools 2.0.0--canary.490.6e556a4.0 → 2.0.0--canary.490.b61914a.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.
|
@@ -300,9 +300,16 @@ class VpcResourceResolver extends BaseResourceResolver {
|
|
|
300
300
|
const encryptionMethod = appDefinition.encryption?.fieldLevelEncryptionMethod;
|
|
301
301
|
const needsKms = encryptionMethod === 'kms';
|
|
302
302
|
|
|
303
|
+
// DynamoDB endpoint only needed if using DynamoDB (not MongoDB or PostgreSQL)
|
|
304
|
+
// Currently framework only supports MongoDB (via Prisma) and PostgreSQL (via Aurora)
|
|
305
|
+
// If not using DynamoDB, skip the endpoint (CloudFormation will delete if it exists)
|
|
306
|
+
const usesDynamoDB = appDefinition.database?.dynamodb?.enable === true;
|
|
307
|
+
|
|
303
308
|
const endpoints = {
|
|
304
309
|
s3: this._resolveEndpoint('FriggS3VPCEndpoint', 's3', userIntent, appDefinition, discovery),
|
|
305
|
-
dynamodb:
|
|
310
|
+
dynamodb: usesDynamoDB
|
|
311
|
+
? this._resolveEndpoint('FriggDynamoDBVPCEndpoint', 'dynamodb', userIntent, appDefinition, discovery)
|
|
312
|
+
: { ownership: null, reason: 'DynamoDB endpoint not needed (application uses MongoDB/PostgreSQL, not DynamoDB)' },
|
|
306
313
|
kms: needsKms
|
|
307
314
|
? this._resolveEndpoint('FriggKMSVPCEndpoint', 'kms', userIntent, appDefinition, discovery)
|
|
308
315
|
: { ownership: null, reason: 'KMS endpoint not needed (encryption method is not KMS)' },
|
|
@@ -340,13 +347,27 @@ class VpcResourceResolver extends BaseResourceResolver {
|
|
|
340
347
|
);
|
|
341
348
|
}
|
|
342
349
|
|
|
343
|
-
// Auto-decide
|
|
344
|
-
|
|
350
|
+
// Auto-decide - check if in stack first for more informative logging
|
|
351
|
+
const inStack = this.isInStack(logicalId, discovery);
|
|
352
|
+
const stackResource = inStack ? this.findInStack(logicalId, discovery) : null;
|
|
353
|
+
|
|
354
|
+
const decision = this.resolveResourceOwnership(
|
|
345
355
|
'auto',
|
|
346
356
|
logicalId,
|
|
347
357
|
'AWS::EC2::VPCEndpoint',
|
|
348
358
|
discovery
|
|
349
359
|
);
|
|
360
|
+
|
|
361
|
+
// Override reason with more detailed explanation
|
|
362
|
+
if (decision.ownership === 'stack' && decision.physicalId) {
|
|
363
|
+
decision.reason = `Found in CloudFormation stack (must keep in template to avoid deletion)`;
|
|
364
|
+
} else if (decision.ownership === 'stack' && !decision.physicalId) {
|
|
365
|
+
decision.reason = `No existing ${endpointType} endpoint found - will create in stack`;
|
|
366
|
+
} else if (decision.ownership === 'external') {
|
|
367
|
+
decision.reason = `Found external ${endpointType} endpoint via discovery`;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return decision;
|
|
350
371
|
}
|
|
351
372
|
|
|
352
373
|
/**
|
|
@@ -300,6 +300,82 @@ describe('VpcResourceResolver', () => {
|
|
|
300
300
|
});
|
|
301
301
|
|
|
302
302
|
describe('resolveVpcEndpoints', () => {
|
|
303
|
+
it('should skip DynamoDB endpoint when application uses MongoDB', () => {
|
|
304
|
+
const appDefinition = {
|
|
305
|
+
vpc: { ownership: { vpcEndpoints: 'auto' } },
|
|
306
|
+
database: { mongoDB: { enable: true } }, // Using MongoDB, not DynamoDB
|
|
307
|
+
encryption: { fieldLevelEncryptionMethod: 'kms' }
|
|
308
|
+
};
|
|
309
|
+
const discovery = {
|
|
310
|
+
stackManaged: [],
|
|
311
|
+
external: [],
|
|
312
|
+
fromCloudFormation: false
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const decisions = resolver.resolveVpcEndpoints(appDefinition, discovery);
|
|
316
|
+
|
|
317
|
+
expect(decisions.s3.ownership).toBe('stack'); // S3 always needed
|
|
318
|
+
expect(decisions.dynamodb.ownership).toBeNull(); // DynamoDB NOT needed
|
|
319
|
+
expect(decisions.dynamodb.reason).toContain('MongoDB/PostgreSQL');
|
|
320
|
+
expect(decisions.kms.ownership).toBe('stack'); // KMS needed (encryption enabled)
|
|
321
|
+
expect(decisions.secretsManager.ownership).toBe('stack'); // SM always needed
|
|
322
|
+
expect(decisions.sqs.ownership).toBe('stack'); // SQS always needed
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
it('should skip DynamoDB endpoint when application uses PostgreSQL', () => {
|
|
326
|
+
const appDefinition = {
|
|
327
|
+
vpc: { ownership: { vpcEndpoints: 'auto' } },
|
|
328
|
+
database: { postgres: { enable: true } }, // Using PostgreSQL, not DynamoDB
|
|
329
|
+
};
|
|
330
|
+
const discovery = {
|
|
331
|
+
stackManaged: [],
|
|
332
|
+
external: [],
|
|
333
|
+
fromCloudFormation: false
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const decisions = resolver.resolveVpcEndpoints(appDefinition, discovery);
|
|
337
|
+
|
|
338
|
+
expect(decisions.dynamodb.ownership).toBeNull();
|
|
339
|
+
expect(decisions.dynamodb.reason).toContain('MongoDB/PostgreSQL');
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
it('should create DynamoDB endpoint when explicitly enabled', () => {
|
|
343
|
+
const appDefinition = {
|
|
344
|
+
vpc: { ownership: { vpcEndpoints: 'auto' } },
|
|
345
|
+
database: { dynamodb: { enable: true } }, // Explicitly using DynamoDB
|
|
346
|
+
};
|
|
347
|
+
const discovery = {
|
|
348
|
+
stackManaged: [],
|
|
349
|
+
external: [],
|
|
350
|
+
fromCloudFormation: false
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const decisions = resolver.resolveVpcEndpoints(appDefinition, discovery);
|
|
354
|
+
|
|
355
|
+
expect(decisions.dynamodb.ownership).toBe('stack'); // DynamoDB needed
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
it('should allow deletion of DynamoDB endpoint when not needed', () => {
|
|
359
|
+
const appDefinition = {
|
|
360
|
+
vpc: { ownership: { vpcEndpoints: 'auto' } },
|
|
361
|
+
database: { mongoDB: { enable: true } }, // Using MongoDB (DynamoDB not needed)
|
|
362
|
+
};
|
|
363
|
+
const discovery = {
|
|
364
|
+
stackManaged: [
|
|
365
|
+
{ logicalId: 'FriggDynamoDBVPCEndpoint', physicalId: 'vpce-ddb-legacy', resourceType: 'AWS::EC2::VPCEndpoint' }
|
|
366
|
+
],
|
|
367
|
+
external: [],
|
|
368
|
+
fromCloudFormation: true
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
const decisions = resolver.resolveVpcEndpoints(appDefinition, discovery);
|
|
372
|
+
|
|
373
|
+
// Should return null (allow CloudFormation to delete it since not needed)
|
|
374
|
+
expect(decisions.dynamodb.ownership).toBeNull();
|
|
375
|
+
expect(decisions.dynamodb.reason).toContain('MongoDB/PostgreSQL');
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
|
|
303
379
|
it('should return null decisions when endpoints disabled', () => {
|
|
304
380
|
const appDefinition = {
|
|
305
381
|
vpc: {
|
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.b61914a.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.b61914a.0",
|
|
20
|
+
"@friggframework/schemas": "2.0.0--canary.490.b61914a.0",
|
|
21
|
+
"@friggframework/test": "2.0.0--canary.490.b61914a.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.b61914a.0",
|
|
50
|
+
"@friggframework/prettier-config": "2.0.0--canary.490.b61914a.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": "b61914aa96566c50e35642e1384a60c5b09800c9"
|
|
83
83
|
}
|