@friggframework/devtools 2.0.0--canary.490.de9ed00.0 → 2.0.0--canary.490.71c435d.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.
@@ -398,19 +398,33 @@ describe('VpcBuilder', () => {
398
398
  expect(result.resources.FriggS3VPCEndpoint.Properties.VpcId).toBe('vpc-123');
399
399
  });
400
400
 
401
- it('should reuse stack-managed VPC endpoints without creating CloudFormation resources', async () => {
401
+ it('should add stack-managed VPC endpoints back to template to prevent deletion', async () => {
402
402
  const appDefinition = {
403
- vpc: { enable: true, enableVPCEndpoints: true },
403
+ vpc: { enable: true },
404
404
  encryption: { fieldLevelEncryptionMethod: 'kms' },
405
- database: { postgres: { enable: true } },
406
405
  };
406
+
407
+ // Structured discovery from CloudFormation
407
408
  const discoveredResources = {
409
+ fromCloudFormationStack: true,
410
+ stackName: 'test-stack',
411
+ existingLogicalIds: [
412
+ 'FriggLambdaSecurityGroup',
413
+ 'FriggLambdaRouteTable',
414
+ 'FriggS3VPCEndpoint',
415
+ 'FriggDynamoDBVPCEndpoint',
416
+ 'FriggKMSVPCEndpoint',
417
+ 'FriggSecretsManagerVPCEndpoint',
418
+ 'FriggSQSVPCEndpoint'
419
+ ],
408
420
  defaultVpcId: 'vpc-123',
409
421
  privateSubnetId1: 'subnet-1',
410
422
  privateSubnetId2: 'subnet-2',
411
- // VPC endpoints from CloudFormation stack (string IDs)
423
+ routeTableId: 'rtb-123',
424
+ lambdaSecurityGroupId: 'sg-123',
425
+ // VPC endpoints discovered in stack
412
426
  s3VpcEndpointId: 'vpce-s3-stack',
413
- dynamoDbVpcEndpointId: 'vpce-ddb-stack',
427
+ dynamodbVpcEndpointId: 'vpce-ddb-stack',
414
428
  kmsVpcEndpointId: 'vpce-kms-stack',
415
429
  secretsManagerVpcEndpointId: 'vpce-sm-stack',
416
430
  sqsVpcEndpointId: 'vpce-sqs-stack',
@@ -418,15 +432,30 @@ describe('VpcBuilder', () => {
418
432
 
419
433
  const result = await vpcBuilder.build(appDefinition, discoveredResources);
420
434
 
421
- // Should NOT create CloudFormation resources (reuse stack endpoints)
422
- expect(result.resources.FriggS3VPCEndpoint).toBeUndefined();
423
- expect(result.resources.FriggDynamoDBVPCEndpoint).toBeUndefined();
424
- expect(result.resources.FriggKMSVPCEndpoint).toBeUndefined();
425
- expect(result.resources.FriggSecretsManagerVPCEndpoint).toBeUndefined();
426
- expect(result.resources.FriggSQSVPCEndpoint).toBeUndefined();
435
+ // CRITICAL: Must RE-ADD stack-managed endpoints to template or CloudFormation will DELETE them
436
+ expect(result.resources.FriggS3VPCEndpoint).toBeDefined();
437
+ expect(result.resources.FriggS3VPCEndpoint.Type).toBe('AWS::EC2::VPCEndpoint');
438
+ expect(result.resources.FriggS3VPCEndpoint.Properties.VpcEndpointType).toBe('Gateway');
439
+
440
+ expect(result.resources.FriggDynamoDBVPCEndpoint).toBeDefined();
441
+ expect(result.resources.FriggDynamoDBVPCEndpoint.Type).toBe('AWS::EC2::VPCEndpoint');
442
+ expect(result.resources.FriggDynamoDBVPCEndpoint.Properties.VpcEndpointType).toBe('Gateway');
443
+
444
+ expect(result.resources.FriggKMSVPCEndpoint).toBeDefined();
445
+ expect(result.resources.FriggKMSVPCEndpoint.Type).toBe('AWS::EC2::VPCEndpoint');
446
+ expect(result.resources.FriggKMSVPCEndpoint.Properties.VpcEndpointType).toBe('Interface');
447
+
448
+ expect(result.resources.FriggSecretsManagerVPCEndpoint).toBeDefined();
449
+ expect(result.resources.FriggSecretsManagerVPCEndpoint.Type).toBe('AWS::EC2::VPCEndpoint');
450
+ expect(result.resources.FriggSecretsManagerVPCEndpoint.Properties.VpcEndpointType).toBe('Interface');
451
+
452
+ expect(result.resources.FriggSQSVPCEndpoint).toBeDefined();
453
+ expect(result.resources.FriggSQSVPCEndpoint.Type).toBe('AWS::EC2::VPCEndpoint');
454
+ expect(result.resources.FriggSQSVPCEndpoint.Properties.VpcEndpointType).toBe('Interface');
427
455
 
428
- // Should still NOT create VPC Endpoint Security Group
429
- expect(result.resources.FriggVPCEndpointSecurityGroup).toBeUndefined();
456
+ // Should create VPC Endpoint Security Group for interface endpoints
457
+ expect(result.resources.FriggVPCEndpointSecurityGroup).toBeDefined();
458
+ expect(result.resources.FriggVPCEndpointSecurityGroup.Type).toBe('AWS::EC2::SecurityGroup');
430
459
  });
431
460
 
432
461
  it('should create VPC endpoints when discovered from AWS but not stack', async () => {
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.de9ed00.0",
4
+ "version": "2.0.0--canary.490.71c435d.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.de9ed00.0",
20
- "@friggframework/schemas": "2.0.0--canary.490.de9ed00.0",
21
- "@friggframework/test": "2.0.0--canary.490.de9ed00.0",
19
+ "@friggframework/core": "2.0.0--canary.490.71c435d.0",
20
+ "@friggframework/schemas": "2.0.0--canary.490.71c435d.0",
21
+ "@friggframework/test": "2.0.0--canary.490.71c435d.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.de9ed00.0",
50
- "@friggframework/prettier-config": "2.0.0--canary.490.de9ed00.0",
49
+ "@friggframework/eslint-config": "2.0.0--canary.490.71c435d.0",
50
+ "@friggframework/prettier-config": "2.0.0--canary.490.71c435d.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": "de9ed004fd58650d6be0a619a3fcd02cc35b7c6d"
82
+ "gitHead": "71c435df870654de6b8f2594674ac35c32c2bd93"
83
83
  }