terruvim-cli 0.1.2 ā 0.1.4
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.
- package/README.md +4 -4
- package/dist/commands/create.js +39 -7
- package/dist/commands/setup.js +1 -1
- package/dist/commands/up.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g terruvim-cli
|
|
|
20
20
|
$ terruvim COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ terruvim (--version)
|
|
23
|
-
terruvim-cli/0.1.
|
|
23
|
+
terruvim-cli/0.1.4 linux-x64 node-v24.13.0
|
|
24
24
|
$ terruvim --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ terruvim COMMAND
|
|
@@ -62,7 +62,7 @@ DESCRIPTION
|
|
|
62
62
|
Scaffold a new Terruvim project via Interactive Wizard
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
_See code: [src/commands/create.ts](https://github.com/vlad-vorobei/terruvim-cli/blob/v0.1.
|
|
65
|
+
_See code: [src/commands/create.ts](https://github.com/vlad-vorobei/terruvim-cli/blob/v0.1.4/src/commands/create.ts)_
|
|
66
66
|
|
|
67
67
|
## `terruvim help [COMMAND]`
|
|
68
68
|
|
|
@@ -386,7 +386,7 @@ DESCRIPTION
|
|
|
386
386
|
Initialize Pulumi stacks based on environment configs
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
-
_See code: [src/commands/setup.ts](https://github.com/vlad-vorobei/terruvim-cli/blob/v0.1.
|
|
389
|
+
_See code: [src/commands/setup.ts](https://github.com/vlad-vorobei/terruvim-cli/blob/v0.1.4/src/commands/setup.ts)_
|
|
390
390
|
|
|
391
391
|
## `terruvim up`
|
|
392
392
|
|
|
@@ -400,5 +400,5 @@ DESCRIPTION
|
|
|
400
400
|
Deploy Terruvim infrastructure (Auto-bootstrapping secrets)
|
|
401
401
|
```
|
|
402
402
|
|
|
403
|
-
_See code: [src/commands/up.ts](https://github.com/vlad-vorobei/terruvim-cli/blob/v0.1.
|
|
403
|
+
_See code: [src/commands/up.ts](https://github.com/vlad-vorobei/terruvim-cli/blob/v0.1.4/src/commands/up.ts)_
|
|
404
404
|
<!-- commandsstop -->
|
package/dist/commands/create.js
CHANGED
|
@@ -155,7 +155,20 @@ export default class Create extends Command {
|
|
|
155
155
|
}
|
|
156
156
|
const envsDir = path.join(projectDir, 'envs');
|
|
157
157
|
const knownEnvs = ['dev', 'stage', 'prod'];
|
|
158
|
+
const awsRegion = answers.awsRegion;
|
|
158
159
|
if (await fs.pathExists(envsDir)) {
|
|
160
|
+
const dockerPath = path.join(projectDir, 'assets', 'docker');
|
|
161
|
+
const infraJsonPath = path.join(envsDir, 'infrastructure.json');
|
|
162
|
+
const infraJson = await fs.readJson(infraJsonPath);
|
|
163
|
+
infraJson.meta.variables.project = projectName;
|
|
164
|
+
infraJson.meta.variables.region = awsRegion;
|
|
165
|
+
infraJson.meta.variables.DOCKER_CONTEXT = dockerPath;
|
|
166
|
+
infraJson.meta.variables.DOCKERFILE = dockerPath;
|
|
167
|
+
infraJson.meta.providers.root = {
|
|
168
|
+
id: "provider-root",
|
|
169
|
+
region: awsRegion,
|
|
170
|
+
profile: `${projectName}-root`
|
|
171
|
+
};
|
|
159
172
|
for (const env of knownEnvs) {
|
|
160
173
|
if (!answers.environments.includes(env)) {
|
|
161
174
|
const fileToRemove = path.join(envsDir, `infrastructure.${env}.json`);
|
|
@@ -163,7 +176,20 @@ export default class Create extends Command {
|
|
|
163
176
|
await fs.remove(fileToRemove);
|
|
164
177
|
}
|
|
165
178
|
}
|
|
179
|
+
else {
|
|
180
|
+
infraJson.meta.providers[env] = {
|
|
181
|
+
id: `provider-${env}`,
|
|
182
|
+
region: awsRegion,
|
|
183
|
+
profile: `${projectName}-${env}`
|
|
184
|
+
};
|
|
185
|
+
infraJson.meta.providers[`${env}-${awsRegion}`] = {
|
|
186
|
+
id: `provider-${env}-${awsRegion}`,
|
|
187
|
+
region: awsRegion,
|
|
188
|
+
profile: `${projectName}-${env}`
|
|
189
|
+
};
|
|
190
|
+
}
|
|
166
191
|
}
|
|
192
|
+
await fs.writeJson(infraJsonPath, infraJson, { spaces: 2 });
|
|
167
193
|
}
|
|
168
194
|
const readmePath = path.join(projectDir, 'AWS-README.md');
|
|
169
195
|
if (await fs.pathExists(readmePath)) {
|
|
@@ -216,19 +242,17 @@ export default class Create extends Command {
|
|
|
216
242
|
this.log(`š Project Location: ${projectDir}\n`);
|
|
217
243
|
this.log('š Next Steps:\n');
|
|
218
244
|
this.log(`1. Navigate to project:\n $ cd ${projectName}\n`);
|
|
245
|
+
let step = 2;
|
|
219
246
|
if (!answers.installDependencies) {
|
|
220
|
-
this.log(
|
|
247
|
+
this.log(`${step}. Install dependencies:\n $ npm install\n`);
|
|
248
|
+
step++;
|
|
221
249
|
}
|
|
222
250
|
this.log('š³ Docker Requirement:');
|
|
223
251
|
this.log(' Ensure Docker is running! It is required for initial local builds.\n');
|
|
224
|
-
this.log('2. Setup Infrastructure Stacks:');
|
|
225
|
-
this.log(' Run this command inside the project to initialize Pulumi stacks:');
|
|
226
|
-
this.log(' $ terruvim setup\n');
|
|
227
252
|
if (answers.providerName === 'aws') {
|
|
228
253
|
this.log('āļø AWS Configuration:');
|
|
229
254
|
this.log(' You need an AWS Account and IAM User credentials with infrastructure access.');
|
|
230
|
-
this.log('
|
|
231
|
-
this.log('š Configure your ~/.aws/credentials file with the following profiles:\n');
|
|
255
|
+
this.log(' Please configure your ~/.aws/credentials file with the following profiles:\n');
|
|
232
256
|
this.log(` [${projectName}-root]`);
|
|
233
257
|
this.log(' aws_access_key_id=<YOUR_ACCESS_KEY>');
|
|
234
258
|
this.log(' aws_secret_access_key=<YOUR_SECRET_KEY>\n');
|
|
@@ -237,8 +261,16 @@ export default class Create extends Command {
|
|
|
237
261
|
this.log(' aws_access_key_id=<YOUR_ACCESS_KEY>');
|
|
238
262
|
this.log(' aws_secret_access_key=<YOUR_SECRET_KEY>\n');
|
|
239
263
|
});
|
|
264
|
+
this.log(' (Tip: You can reuse the same credentials for all profiles if needed)\n');
|
|
240
265
|
}
|
|
241
|
-
this.log(
|
|
266
|
+
this.log(`${step}. Initialize Infrastructure Stacks:`);
|
|
267
|
+
this.log(' Run this command inside the project to initialize Pulumi stacks:\n');
|
|
268
|
+
this.log(' $ terruvim setup\n');
|
|
269
|
+
step++;
|
|
270
|
+
this.log(`${step}. Deploy Infrastructure:`);
|
|
271
|
+
this.log(' Run this command to deploy your infrastructure:\n');
|
|
272
|
+
this.log(' $ terruvim up\n');
|
|
273
|
+
this.log('š Happy coding & easy deploying!');
|
|
242
274
|
return this.exit(0);
|
|
243
275
|
}
|
|
244
276
|
}
|
package/dist/commands/setup.js
CHANGED
package/dist/commands/up.js
CHANGED
|
@@ -25,7 +25,7 @@ export default class Up extends Command {
|
|
|
25
25
|
const resourcesPath = path.join(projectDir, 'envs', 'resources.json');
|
|
26
26
|
const infrastructurePath = path.join(projectDir, 'envs', `infrastructure.${env}.json`);
|
|
27
27
|
// const secretId = `${projectName}/${env}/global-secret-base`; // TODO: Implement envs
|
|
28
|
-
const secretId = `${projectName}/global-
|
|
28
|
+
const secretId = `${projectName}/global-secrets-base`;
|
|
29
29
|
const awsSpinner = ora(`Checking AWS Secret Manager: ${secretId}...`).start();
|
|
30
30
|
let secretExists = false;
|
|
31
31
|
try {
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "terruvim-cli",
|
|
3
3
|
"description": "CLI tool to scaffold and deploy Terruvim infrastructure on AWS using Pulumi",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"author": "Vlad Vorobei <vladyslavvorobei@gmail.com>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"terruvim-cli": "./bin/run.js"
|