@friggframework/devtools 2.0.0--canary.398.90b58c8.0 → 2.0.0--canary.398.53eac55.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.
|
@@ -473,8 +473,8 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
473
473
|
if (discoveredResources.defaultVpcId) {
|
|
474
474
|
console.log(` VPC: ${discoveredResources.defaultVpcId}`);
|
|
475
475
|
}
|
|
476
|
-
if (discoveredResources.
|
|
477
|
-
console.log(` Subnets: ${discoveredResources.
|
|
476
|
+
if (discoveredResources.privateSubnetId1 && discoveredResources.privateSubnetId2) {
|
|
477
|
+
console.log(` Subnets: ${discoveredResources.privateSubnetId1}, ${discoveredResources.privateSubnetId2}`);
|
|
478
478
|
}
|
|
479
479
|
if (discoveredResources.defaultSecurityGroupId) {
|
|
480
480
|
console.log(` Security Group: ${discoveredResources.defaultSecurityGroupId}`);
|
|
@@ -508,8 +508,8 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
508
508
|
// Add discovered resources to environment if available
|
|
509
509
|
...(discoveredResources.defaultVpcId && { AWS_DISCOVERY_VPC_ID: discoveredResources.defaultVpcId }),
|
|
510
510
|
...(discoveredResources.defaultSecurityGroupId && { AWS_DISCOVERY_SECURITY_GROUP_ID: discoveredResources.defaultSecurityGroupId }),
|
|
511
|
-
...(discoveredResources.
|
|
512
|
-
...(discoveredResources.
|
|
511
|
+
...(discoveredResources.privateSubnetId1 && { AWS_DISCOVERY_SUBNET_ID_1: discoveredResources.privateSubnetId1 }),
|
|
512
|
+
...(discoveredResources.privateSubnetId2 && { AWS_DISCOVERY_SUBNET_ID_2: discoveredResources.privateSubnetId2 }),
|
|
513
513
|
...(discoveredResources.publicSubnetId && { AWS_DISCOVERY_PUBLIC_SUBNET_ID: discoveredResources.publicSubnetId }),
|
|
514
514
|
...(discoveredResources.defaultRouteTableId && { AWS_DISCOVERY_ROUTE_TABLE_ID: discoveredResources.defaultRouteTableId }),
|
|
515
515
|
...(discoveredResources.defaultKmsKeyId && { AWS_DISCOVERY_KMS_KEY_ID: discoveredResources.defaultKmsKeyId }),
|
|
@@ -777,52 +777,53 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
777
777
|
// VPC configuration using discovered or explicitly provided resources
|
|
778
778
|
const vpcConfig = {
|
|
779
779
|
securityGroupIds: AppDefinition.vpc.securityGroupIds ||
|
|
780
|
-
(discoveredResources.defaultSecurityGroupId ? [discoveredResources.defaultSecurityGroupId] : [
|
|
780
|
+
(discoveredResources.defaultSecurityGroupId ? [discoveredResources.defaultSecurityGroupId] : []),
|
|
781
781
|
subnetIds: AppDefinition.vpc.subnetIds ||
|
|
782
|
-
(discoveredResources.
|
|
783
|
-
[discoveredResources.
|
|
784
|
-
[
|
|
782
|
+
(discoveredResources.privateSubnetId1 && discoveredResources.privateSubnetId2 ?
|
|
783
|
+
[discoveredResources.privateSubnetId1, discoveredResources.privateSubnetId2] :
|
|
784
|
+
[])
|
|
785
785
|
};
|
|
786
786
|
|
|
787
|
-
// Set VPC config for Lambda functions
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
787
|
+
// Set VPC config for Lambda functions only if we have valid subnet IDs
|
|
788
|
+
if (vpcConfig.subnetIds.length >= 2 && vpcConfig.securityGroupIds.length > 0) {
|
|
789
|
+
definition.provider.vpc = vpcConfig;
|
|
790
|
+
|
|
791
|
+
// Always create NAT Gateway for Lambda internet access
|
|
792
|
+
// Default VPCs don't have NAT gateways, so we need to create them
|
|
793
|
+
definition.resources.Resources.FriggNATGatewayEIP = {
|
|
794
|
+
Type: 'AWS::EC2::EIP',
|
|
795
|
+
Properties: {
|
|
796
|
+
Domain: 'vpc',
|
|
797
|
+
Tags: [
|
|
798
|
+
{ Key: 'Name', Value: '${self:service}-${self:provider.stage}-nat-eip' }
|
|
799
|
+
]
|
|
800
|
+
}
|
|
801
|
+
};
|
|
801
802
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
803
|
+
definition.resources.Resources.FriggNATGateway = {
|
|
804
|
+
Type: 'AWS::EC2::NatGateway',
|
|
805
|
+
Properties: {
|
|
806
|
+
AllocationId: { 'Fn::GetAtt': ['FriggNATGatewayEIP', 'AllocationId'] },
|
|
807
|
+
SubnetId: discoveredResources.publicSubnetId || discoveredResources.privateSubnetId1, // Use first discovered subnet if no public subnet found
|
|
808
|
+
Tags: [
|
|
809
|
+
{ Key: 'Name', Value: '${self:service}-${self:provider.stage}-nat-gateway' }
|
|
810
|
+
]
|
|
811
|
+
}
|
|
812
|
+
};
|
|
812
813
|
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
814
|
+
// Create route table for Lambda subnets to use NAT Gateway
|
|
815
|
+
definition.resources.Resources.FriggLambdaRouteTable = {
|
|
816
|
+
Type: 'AWS::EC2::RouteTable',
|
|
817
|
+
Properties: {
|
|
818
|
+
VpcId: discoveredResources.defaultVpcId || { Ref: 'FriggVPC' },
|
|
819
|
+
Tags: [
|
|
820
|
+
{ Key: 'Name', Value: '${self:service}-${self:provider.stage}-lambda-rt' }
|
|
821
|
+
]
|
|
822
|
+
}
|
|
823
|
+
};
|
|
823
824
|
|
|
824
|
-
|
|
825
|
-
|
|
825
|
+
definition.resources.Resources.FriggNATRoute = {
|
|
826
|
+
Type: 'AWS::EC2::Route',
|
|
826
827
|
Properties: {
|
|
827
828
|
RouteTableId: { Ref: 'FriggLambdaRouteTable' },
|
|
828
829
|
DestinationCidrBlock: '0.0.0.0/0',
|
|
@@ -830,44 +831,45 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
830
831
|
}
|
|
831
832
|
};
|
|
832
833
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
834
|
+
// Associate Lambda subnets with NAT Gateway route table
|
|
835
|
+
definition.resources.Resources.FriggSubnet1RouteAssociation = {
|
|
836
|
+
Type: 'AWS::EC2::SubnetRouteTableAssociation',
|
|
836
837
|
Properties: {
|
|
837
|
-
SubnetId:
|
|
838
|
+
SubnetId: vpcConfig.subnetIds[0],
|
|
838
839
|
RouteTableId: { Ref: 'FriggLambdaRouteTable' }
|
|
839
840
|
}
|
|
840
841
|
};
|
|
841
842
|
|
|
842
|
-
|
|
843
|
-
|
|
843
|
+
definition.resources.Resources.FriggSubnet2RouteAssociation = {
|
|
844
|
+
Type: 'AWS::EC2::SubnetRouteTableAssociation',
|
|
844
845
|
Properties: {
|
|
845
|
-
SubnetId:
|
|
846
|
+
SubnetId: vpcConfig.subnetIds[1],
|
|
846
847
|
RouteTableId: { Ref: 'FriggLambdaRouteTable' }
|
|
847
848
|
}
|
|
848
849
|
};
|
|
849
850
|
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
851
|
+
// Add VPC endpoints for AWS service optimization (optional but recommended)
|
|
852
|
+
if (AppDefinition.vpc.enableVPCEndpoints !== false) {
|
|
853
|
+
definition.resources.Resources.VPCEndpointS3 = {
|
|
853
854
|
Type: 'AWS::EC2::VPCEndpoint',
|
|
854
855
|
Properties: {
|
|
855
|
-
VpcId: discoveredResources.defaultVpcId
|
|
856
|
+
VpcId: discoveredResources.defaultVpcId,
|
|
856
857
|
ServiceName: 'com.amazonaws.${self:provider.region}.s3',
|
|
857
858
|
VpcEndpointType: 'Gateway',
|
|
858
859
|
RouteTableIds: [{ Ref: 'FriggLambdaRouteTable' }]
|
|
859
860
|
}
|
|
860
861
|
};
|
|
861
862
|
|
|
862
|
-
|
|
863
|
+
definition.resources.Resources.VPCEndpointDynamoDB = {
|
|
863
864
|
Type: 'AWS::EC2::VPCEndpoint',
|
|
864
865
|
Properties: {
|
|
865
|
-
VpcId: discoveredResources.defaultVpcId
|
|
866
|
+
VpcId: discoveredResources.defaultVpcId,
|
|
866
867
|
ServiceName: 'com.amazonaws.${self:provider.region}.dynamodb',
|
|
867
868
|
VpcEndpointType: 'Gateway',
|
|
868
869
|
RouteTableIds: [{ Ref: 'FriggLambdaRouteTable' }]
|
|
869
870
|
}
|
|
870
871
|
};
|
|
872
|
+
}
|
|
871
873
|
}
|
|
872
874
|
}
|
|
873
875
|
}
|
|
@@ -962,28 +964,8 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
962
964
|
definition.custom[queueReference] = queueName;
|
|
963
965
|
}
|
|
964
966
|
|
|
965
|
-
//
|
|
966
|
-
|
|
967
|
-
AppDefinition.encryption?.useDefaultKMSForFieldLevelEncryption ||
|
|
968
|
-
AppDefinition.ssm?.enable;
|
|
969
|
-
|
|
970
|
-
if (needsDiscovery && !process.env.AWS_DISCOVERY_VPC_ID) {
|
|
971
|
-
console.error('❌ AWS discovery environment variables not found');
|
|
972
|
-
console.error('');
|
|
973
|
-
console.error('🚨 Your AppDefinition requires AWS discovery but variables are missing:');
|
|
974
|
-
if (AppDefinition.vpc?.enable) console.error(' ❌ VPC support (vpc.enable: true)');
|
|
975
|
-
if (AppDefinition.encryption?.useDefaultKMSForFieldLevelEncryption) console.error(' ❌ KMS encryption (encryption.useDefaultKMSForFieldLevelEncryption: true)');
|
|
976
|
-
if (AppDefinition.ssm?.enable) console.error(' ❌ SSM parameters (ssm.enable: true)');
|
|
977
|
-
console.error('');
|
|
978
|
-
console.error('💡 Run AWS discovery before building:');
|
|
979
|
-
console.error(' node node_modules/@friggframework/devtools/infrastructure/run-discovery.js');
|
|
980
|
-
console.error('');
|
|
981
|
-
console.error('🔧 Or use the build command which runs discovery automatically:');
|
|
982
|
-
console.error(' npx frigg build');
|
|
983
|
-
|
|
984
|
-
// Exit the process instead of throwing to avoid serverless circular reference issues
|
|
985
|
-
process.exit(1);
|
|
986
|
-
}
|
|
967
|
+
// Discovery has already run successfully at this point if needed
|
|
968
|
+
// The discoveredResources object contains all the necessary AWS resources
|
|
987
969
|
|
|
988
970
|
// Add websocket function if enabled
|
|
989
971
|
if (AppDefinition.websockets?.enable === true) {
|
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.398.
|
|
4
|
+
"version": "2.0.0--canary.398.53eac55.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-ec2": "^3.835.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.835.0",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@babel/eslint-parser": "^7.18.9",
|
|
10
10
|
"@babel/parser": "^7.25.3",
|
|
11
11
|
"@babel/traverse": "^7.25.3",
|
|
12
|
-
"@friggframework/test": "2.0.0--canary.398.
|
|
12
|
+
"@friggframework/test": "2.0.0--canary.398.53eac55.0",
|
|
13
13
|
"@hapi/boom": "^10.0.1",
|
|
14
14
|
"@inquirer/prompts": "^5.3.8",
|
|
15
15
|
"axios": "^1.7.2",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"serverless-http": "^2.7.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@friggframework/eslint-config": "2.0.0--canary.398.
|
|
35
|
-
"@friggframework/prettier-config": "2.0.0--canary.398.
|
|
34
|
+
"@friggframework/eslint-config": "2.0.0--canary.398.53eac55.0",
|
|
35
|
+
"@friggframework/prettier-config": "2.0.0--canary.398.53eac55.0",
|
|
36
36
|
"prettier": "^2.7.1",
|
|
37
37
|
"serverless": "3.39.0",
|
|
38
38
|
"serverless-dotenv-plugin": "^6.0.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "53eac553535657eaeb3110634f14870418fbbeda"
|
|
68
68
|
}
|