@friggframework/devtools 2.0.0--canary.490.4043720.0 → 2.0.0--canary.490.c5ad260.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.
|
@@ -23,6 +23,7 @@ class VpcResourceResolver extends BaseResourceResolver {
|
|
|
23
23
|
*/
|
|
24
24
|
resolveVpc(appDefinition, discovery) {
|
|
25
25
|
const userIntent = appDefinition.vpc?.ownership?.vpc || 'auto';
|
|
26
|
+
const vpcManagement = appDefinition.vpc?.management; // Legacy config
|
|
26
27
|
|
|
27
28
|
// Explicit external
|
|
28
29
|
if (userIntent === 'external') {
|
|
@@ -43,12 +44,26 @@ class VpcResourceResolver extends BaseResourceResolver {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
// Auto-decide
|
|
46
|
-
|
|
47
|
+
const decision = this.resolveResourceOwnership(
|
|
47
48
|
'auto',
|
|
48
49
|
'FriggVPC',
|
|
49
50
|
'AWS::EC2::VPC',
|
|
50
51
|
discovery
|
|
51
52
|
);
|
|
53
|
+
|
|
54
|
+
// CRITICAL: If auto-resolution wants to create a VPC but management mode is 'discover' (or undefined),
|
|
55
|
+
// throw an error instead. Creating a VPC is expensive and should be explicit.
|
|
56
|
+
if (decision.ownership === ResourceOwnership.STACK &&
|
|
57
|
+
!decision.physicalId &&
|
|
58
|
+
vpcManagement !== 'create-new' &&
|
|
59
|
+
userIntent === 'auto') {
|
|
60
|
+
throw new Error(
|
|
61
|
+
'VPC discovery failed: No VPC found. ' +
|
|
62
|
+
'Either set vpc.management to "create-new" or provide vpc.vpcId with vpc.management "use-existing".'
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return decision;
|
|
52
67
|
}
|
|
53
68
|
|
|
54
69
|
/**
|
|
@@ -109,6 +109,46 @@ describe('VpcResourceResolver', () => {
|
|
|
109
109
|
expect(decision.physicalId).toBeUndefined();
|
|
110
110
|
expect(decision.reason).toContain('No existing resource found');
|
|
111
111
|
});
|
|
112
|
+
|
|
113
|
+
it('should throw error when auto mode finds no VPC and management is not create-new', () => {
|
|
114
|
+
const appDefinition = {
|
|
115
|
+
vpc: {
|
|
116
|
+
enable: true,
|
|
117
|
+
// No management specified - defaults to discover
|
|
118
|
+
// No ownership specified - defaults to auto
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const discovery = {
|
|
122
|
+
stackManaged: [],
|
|
123
|
+
external: [],
|
|
124
|
+
fromCloudFormation: false
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// Should throw error instead of trying to create VPC
|
|
128
|
+
expect(() => resolver.resolveVpc(appDefinition, discovery)).toThrow(
|
|
129
|
+
'VPC discovery failed: No VPC found'
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('should allow creating VPC when management is create-new', () => {
|
|
134
|
+
const appDefinition = {
|
|
135
|
+
vpc: {
|
|
136
|
+
enable: true,
|
|
137
|
+
management: 'create-new'
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const discovery = {
|
|
141
|
+
stackManaged: [],
|
|
142
|
+
external: [],
|
|
143
|
+
fromCloudFormation: false
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// Should NOT throw - create-new explicitly allows VPC creation
|
|
147
|
+
const decision = resolver.resolveVpc(appDefinition, discovery);
|
|
148
|
+
|
|
149
|
+
expect(decision.ownership).toBe(ResourceOwnership.STACK);
|
|
150
|
+
expect(decision.physicalId).toBeNull();
|
|
151
|
+
});
|
|
112
152
|
});
|
|
113
153
|
|
|
114
154
|
describe('resolveSecurityGroup', () => {
|
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.c5ad260.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.c5ad260.0",
|
|
20
|
+
"@friggframework/schemas": "2.0.0--canary.490.c5ad260.0",
|
|
21
|
+
"@friggframework/test": "2.0.0--canary.490.c5ad260.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.c5ad260.0",
|
|
50
|
+
"@friggframework/prettier-config": "2.0.0--canary.490.c5ad260.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": "c5ad26056632a30d7ce772e3af8209e0b2d2014e"
|
|
83
83
|
}
|