@friggframework/devtools 2.0.0--canary.490.7d57f02.0 → 2.0.0--canary.490.56e2519.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.
|
@@ -54,9 +54,10 @@ class VpcResourceResolver extends BaseResourceResolver {
|
|
|
54
54
|
/**
|
|
55
55
|
* Resolve Security Group ownership
|
|
56
56
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* Logic:
|
|
58
|
+
* - If FriggLambdaSecurityGroup exists in stack → STACK (keep it)
|
|
59
|
+
* - If default SG discovered from VPC → EXTERNAL (use it)
|
|
60
|
+
* - Otherwise → STACK (create FriggLambdaSecurityGroup)
|
|
60
61
|
*
|
|
61
62
|
* @param {Object} appDefinition - App definition
|
|
62
63
|
* @param {Object} discovery - Discovery result
|
|
@@ -65,7 +66,7 @@ class VpcResourceResolver extends BaseResourceResolver {
|
|
|
65
66
|
resolveSecurityGroup(appDefinition, discovery) {
|
|
66
67
|
const userIntent = appDefinition.vpc?.ownership?.securityGroup || 'auto';
|
|
67
68
|
|
|
68
|
-
// Explicit external -
|
|
69
|
+
// Explicit external - use provided SG IDs
|
|
69
70
|
if (userIntent === 'external') {
|
|
70
71
|
this.requireExternalIds(
|
|
71
72
|
appDefinition.vpc?.external?.securityGroupIds,
|
|
@@ -77,21 +78,42 @@ class VpcResourceResolver extends BaseResourceResolver {
|
|
|
77
78
|
);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
//
|
|
81
|
-
|
|
81
|
+
// Explicit stack - always create FriggLambdaSecurityGroup
|
|
82
|
+
if (userIntent === 'stack') {
|
|
83
|
+
const inStack = this.findInStack('FriggLambdaSecurityGroup', discovery);
|
|
84
|
+
return this.createStackDecision(
|
|
85
|
+
inStack?.physicalId,
|
|
86
|
+
inStack
|
|
87
|
+
? 'Found FriggLambdaSecurityGroup in CloudFormation stack'
|
|
88
|
+
: 'User specified ownership=stack - will create FriggLambdaSecurityGroup'
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Auto mode: Check stack first, then check for discovered default SG
|
|
82
93
|
const inStack = this.findInStack('FriggLambdaSecurityGroup', discovery);
|
|
83
94
|
|
|
84
95
|
if (inStack) {
|
|
85
96
|
return this.createStackDecision(
|
|
86
97
|
inStack.physicalId,
|
|
87
|
-
'Found FriggLambdaSecurityGroup in CloudFormation stack'
|
|
98
|
+
'Found FriggLambdaSecurityGroup in CloudFormation stack - must keep in template'
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Check for discovered default security group (from old canary pattern)
|
|
103
|
+
const structured = discovery._structured || discovery;
|
|
104
|
+
const defaultSgId = structured.defaultSecurityGroupId || discovery.defaultSecurityGroupId;
|
|
105
|
+
|
|
106
|
+
if (defaultSgId) {
|
|
107
|
+
return this.createExternalDecision(
|
|
108
|
+
[defaultSgId],
|
|
109
|
+
'Found default security group via discovery - will reuse (matches canary behavior)'
|
|
88
110
|
);
|
|
89
111
|
}
|
|
90
112
|
|
|
91
|
-
//
|
|
113
|
+
// No SG found anywhere - create new FriggLambdaSecurityGroup
|
|
92
114
|
return this.createStackDecision(
|
|
93
115
|
null,
|
|
94
|
-
'No
|
|
116
|
+
'No security group found - will create FriggLambdaSecurityGroup in stack'
|
|
95
117
|
);
|
|
96
118
|
}
|
|
97
119
|
|
|
@@ -169,6 +169,26 @@ class CloudFormationDiscovery {
|
|
|
169
169
|
discovered.privateSubnetId2 = subnetAssociations[1].SubnetId;
|
|
170
170
|
console.log(` ✓ Extracted private subnet 2 from associations: ${subnetAssociations[1].SubnetId}`);
|
|
171
171
|
}
|
|
172
|
+
|
|
173
|
+
// Query for default security group in the VPC (matches canary behavior)
|
|
174
|
+
if (routeTable.VpcId && !discovered.defaultSecurityGroupId) {
|
|
175
|
+
try {
|
|
176
|
+
const { DescribeSecurityGroupsCommand } = require('@aws-sdk/client-ec2');
|
|
177
|
+
const sgResponse = await ec2.send(new DescribeSecurityGroupsCommand({
|
|
178
|
+
Filters: [
|
|
179
|
+
{ Name: 'vpc-id', Values: [routeTable.VpcId] },
|
|
180
|
+
{ Name: 'group-name', Values: ['default'] }
|
|
181
|
+
]
|
|
182
|
+
}));
|
|
183
|
+
|
|
184
|
+
if (sgResponse.SecurityGroups && sgResponse.SecurityGroups.length > 0) {
|
|
185
|
+
discovered.defaultSecurityGroupId = sgResponse.SecurityGroups[0].GroupId;
|
|
186
|
+
console.log(` ✓ Extracted default security group: ${discovered.defaultSecurityGroupId}`);
|
|
187
|
+
}
|
|
188
|
+
} catch (error) {
|
|
189
|
+
console.warn(` ⚠️ Could not query default security group: ${error.message}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
172
192
|
}
|
|
173
193
|
} catch (error) {
|
|
174
194
|
console.warn(` ⚠️ Could not query route table for external references: ${error.message}`);
|
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.56e2519.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.56e2519.0",
|
|
20
|
+
"@friggframework/schemas": "2.0.0--canary.490.56e2519.0",
|
|
21
|
+
"@friggframework/test": "2.0.0--canary.490.56e2519.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.56e2519.0",
|
|
50
|
+
"@friggframework/prettier-config": "2.0.0--canary.490.56e2519.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": "56e2519bb620b497d18bb354b8905e8a6c343a58"
|
|
83
83
|
}
|