@friggframework/devtools 2.0.0--canary.398.dd443c7.0 → 2.0.0--canary.402.d2f4ae6.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.
- package/frigg-cli/.eslintrc.js +141 -0
- package/frigg-cli/__tests__/jest.config.js +102 -0
- package/frigg-cli/__tests__/unit/commands/build.test.js +483 -0
- package/frigg-cli/__tests__/unit/commands/install.test.js +418 -0
- package/frigg-cli/__tests__/unit/commands/ui.test.js +592 -0
- package/frigg-cli/__tests__/utils/command-tester.js +170 -0
- package/frigg-cli/__tests__/utils/mock-factory.js +270 -0
- package/frigg-cli/__tests__/utils/test-fixtures.js +463 -0
- package/frigg-cli/__tests__/utils/test-setup.js +286 -0
- package/frigg-cli/generate-command/__tests__/generate-command.test.js +312 -0
- package/frigg-cli/generate-command/azure-generator.js +43 -0
- package/frigg-cli/generate-command/gcp-generator.js +47 -0
- package/frigg-cli/generate-command/index.js +332 -0
- package/frigg-cli/generate-command/terraform-generator.js +555 -0
- package/frigg-cli/index.js +19 -1
- package/frigg-cli/init-command/backend-first-handler.js +756 -0
- package/frigg-cli/init-command/index.js +93 -0
- package/frigg-cli/init-command/template-handler.js +143 -0
- package/frigg-cli/package.json +51 -0
- package/frigg-cli/test/init-command.test.js +180 -0
- package/frigg-cli/test/npm-registry.test.js +319 -0
- package/frigg-cli/ui-command/index.js +154 -0
- package/frigg-cli/utils/app-resolver.js +319 -0
- package/frigg-cli/utils/backend-path.js +25 -0
- package/frigg-cli/utils/npm-registry.js +167 -0
- package/frigg-cli/utils/process-manager.js +199 -0
- package/frigg-cli/utils/repo-detection.js +405 -0
- package/infrastructure/serverless-template.js +177 -292
- package/management-ui/.eslintrc.js +22 -0
- package/management-ui/README.md +203 -0
- package/management-ui/components.json +21 -0
- package/management-ui/docs/phase2-integration-guide.md +320 -0
- package/management-ui/{dist/index.html → index.html} +1 -2
- package/management-ui/package-lock.json +16517 -0
- package/management-ui/package.json +76 -0
- package/management-ui/packages/devtools/frigg-cli/ui-command/index.js +302 -0
- package/management-ui/postcss.config.js +6 -0
- package/management-ui/server/api/backend.js +256 -0
- package/management-ui/server/api/cli.js +315 -0
- package/management-ui/server/api/codegen.js +663 -0
- package/management-ui/server/api/connections.js +857 -0
- package/management-ui/server/api/discovery.js +185 -0
- package/management-ui/server/api/environment/index.js +1 -0
- package/management-ui/server/api/environment/router.js +378 -0
- package/management-ui/server/api/environment.js +328 -0
- package/management-ui/server/api/integrations.js +876 -0
- package/management-ui/server/api/logs.js +248 -0
- package/management-ui/server/api/monitoring.js +282 -0
- package/management-ui/server/api/open-ide.js +31 -0
- package/management-ui/server/api/project.js +1029 -0
- package/management-ui/server/api/users/sessions.js +371 -0
- package/management-ui/server/api/users/simulation.js +254 -0
- package/management-ui/server/api/users.js +362 -0
- package/management-ui/server/api-contract.md +275 -0
- package/management-ui/server/index.js +873 -0
- package/management-ui/server/middleware/errorHandler.js +93 -0
- package/management-ui/server/middleware/security.js +32 -0
- package/management-ui/server/processManager.js +296 -0
- package/management-ui/server/server.js +346 -0
- package/management-ui/server/services/aws-monitor.js +413 -0
- package/management-ui/server/services/npm-registry.js +347 -0
- package/management-ui/server/services/template-engine.js +538 -0
- package/management-ui/server/utils/cliIntegration.js +220 -0
- package/management-ui/server/utils/environment/auditLogger.js +471 -0
- package/management-ui/server/utils/environment/awsParameterStore.js +264 -0
- package/management-ui/server/utils/environment/encryption.js +278 -0
- package/management-ui/server/utils/environment/envFileManager.js +286 -0
- package/management-ui/server/utils/import-commonjs.js +28 -0
- package/management-ui/server/utils/response.js +83 -0
- package/management-ui/server/websocket/handler.js +325 -0
- package/management-ui/src/App.jsx +109 -0
- package/management-ui/src/components/AppRouter.jsx +65 -0
- package/management-ui/src/components/Button.jsx +70 -0
- package/management-ui/src/components/Card.jsx +97 -0
- package/management-ui/src/components/EnvironmentCompare.jsx +400 -0
- package/management-ui/src/components/EnvironmentEditor.jsx +372 -0
- package/management-ui/src/components/EnvironmentImportExport.jsx +469 -0
- package/management-ui/src/components/EnvironmentSchema.jsx +491 -0
- package/management-ui/src/components/EnvironmentSecurity.jsx +463 -0
- package/management-ui/src/components/ErrorBoundary.jsx +73 -0
- package/management-ui/src/components/IntegrationCard.jsx +481 -0
- package/management-ui/src/components/IntegrationCardEnhanced.jsx +770 -0
- package/management-ui/src/components/IntegrationExplorer.jsx +379 -0
- package/management-ui/src/components/IntegrationStatus.jsx +336 -0
- package/management-ui/src/components/Layout.jsx +716 -0
- package/management-ui/src/components/LoadingSpinner.jsx +113 -0
- package/management-ui/src/components/RepositoryPicker.jsx +248 -0
- package/management-ui/src/components/SessionMonitor.jsx +350 -0
- package/management-ui/src/components/StatusBadge.jsx +208 -0
- package/management-ui/src/components/UserContextSwitcher.jsx +212 -0
- package/management-ui/src/components/UserSimulation.jsx +327 -0
- package/management-ui/src/components/Welcome.jsx +434 -0
- package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +637 -0
- package/management-ui/src/components/codegen/APIModuleSelector.jsx +227 -0
- package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +247 -0
- package/management-ui/src/components/codegen/CodePreviewEditor.jsx +316 -0
- package/management-ui/src/components/codegen/DynamicModuleForm.jsx +271 -0
- package/management-ui/src/components/codegen/FormBuilder.jsx +737 -0
- package/management-ui/src/components/codegen/IntegrationGenerator.jsx +855 -0
- package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +797 -0
- package/management-ui/src/components/codegen/SchemaBuilder.jsx +303 -0
- package/management-ui/src/components/codegen/TemplateSelector.jsx +586 -0
- package/management-ui/src/components/codegen/index.js +10 -0
- package/management-ui/src/components/connections/ConnectionConfigForm.jsx +362 -0
- package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +182 -0
- package/management-ui/src/components/connections/ConnectionTester.jsx +200 -0
- package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +292 -0
- package/management-ui/src/components/connections/OAuthFlow.jsx +204 -0
- package/management-ui/src/components/connections/index.js +5 -0
- package/management-ui/src/components/index.js +21 -0
- package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +222 -0
- package/management-ui/src/components/monitoring/LambdaMetrics.jsx +169 -0
- package/management-ui/src/components/monitoring/MetricsChart.jsx +197 -0
- package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +393 -0
- package/management-ui/src/components/monitoring/SQSMetrics.jsx +246 -0
- package/management-ui/src/components/monitoring/index.js +6 -0
- package/management-ui/src/components/monitoring/monitoring.css +218 -0
- package/management-ui/src/components/theme-provider.jsx +52 -0
- package/management-ui/src/components/theme-toggle.jsx +39 -0
- package/management-ui/src/components/ui/badge.tsx +36 -0
- package/management-ui/src/components/ui/button.test.jsx +56 -0
- package/management-ui/src/components/ui/button.tsx +57 -0
- package/management-ui/src/components/ui/card.tsx +76 -0
- package/management-ui/src/components/ui/dropdown-menu.tsx +199 -0
- package/management-ui/src/components/ui/select.tsx +157 -0
- package/management-ui/src/components/ui/skeleton.jsx +15 -0
- package/management-ui/src/hooks/useFrigg.jsx +601 -0
- package/management-ui/src/hooks/useSocket.jsx +58 -0
- package/management-ui/src/index.css +193 -0
- package/management-ui/src/lib/utils.ts +6 -0
- package/management-ui/src/main.jsx +10 -0
- package/management-ui/src/pages/CodeGeneration.jsx +14 -0
- package/management-ui/src/pages/Connections.jsx +252 -0
- package/management-ui/src/pages/ConnectionsEnhanced.jsx +633 -0
- package/management-ui/src/pages/Dashboard.jsx +311 -0
- package/management-ui/src/pages/Environment.jsx +314 -0
- package/management-ui/src/pages/IntegrationConfigure.jsx +669 -0
- package/management-ui/src/pages/IntegrationDiscovery.jsx +567 -0
- package/management-ui/src/pages/IntegrationTest.jsx +742 -0
- package/management-ui/src/pages/Integrations.jsx +253 -0
- package/management-ui/src/pages/Monitoring.jsx +17 -0
- package/management-ui/src/pages/Simulation.jsx +155 -0
- package/management-ui/src/pages/Users.jsx +492 -0
- package/management-ui/src/services/api.js +41 -0
- package/management-ui/src/services/apiModuleService.js +193 -0
- package/management-ui/src/services/websocket-handlers.js +120 -0
- package/management-ui/src/test/api/project.test.js +273 -0
- package/management-ui/src/test/components/Welcome.test.jsx +378 -0
- package/management-ui/src/test/mocks/server.js +178 -0
- package/management-ui/src/test/setup.js +61 -0
- package/management-ui/src/test/utils/test-utils.jsx +134 -0
- package/management-ui/src/utils/repository.js +98 -0
- package/management-ui/src/utils/repository.test.js +118 -0
- package/management-ui/src/workflows/phase2-integration-workflows.js +884 -0
- package/management-ui/tailwind.config.js +63 -0
- package/management-ui/tsconfig.json +37 -0
- package/management-ui/tsconfig.node.json +10 -0
- package/management-ui/vite.config.js +26 -0
- package/management-ui/vitest.config.js +38 -0
- package/package.json +5 -5
- package/management-ui/dist/assets/index-BA21WgFa.js +0 -1221
- package/management-ui/dist/assets/index-CbM64Oba.js +0 -1221
- package/management-ui/dist/assets/index-CkvseXTC.css +0 -1
- /package/management-ui/{dist/assets/FriggLogo-B7Xx8ZW1.svg → src/assets/FriggLogo.svg} +0 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const { findNearestBackendPackageJson } = require('../utils/backend-path');
|
|
4
|
+
const { select } = require('@inquirer/prompts');
|
|
5
|
+
|
|
6
|
+
// Import generators for different formats
|
|
7
|
+
const { generateCloudFormationTemplate } = require('../../infrastructure/iam-generator');
|
|
8
|
+
const { generateTerraformTemplate } = require('./terraform-generator');
|
|
9
|
+
const { generateAzureARMTemplate, generateAzureTerraformTemplate } = require('./azure-generator');
|
|
10
|
+
const { generateGCPDeploymentManagerTemplate, generateGCPTerraformTemplate } = require('./gcp-generator');
|
|
11
|
+
|
|
12
|
+
async function generateCommand(options = {}) {
|
|
13
|
+
// Set up graceful exit handler
|
|
14
|
+
process.on('SIGINT', () => {
|
|
15
|
+
console.log('\n✖ Command cancelled by user');
|
|
16
|
+
process.exit(0);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
// Interactive mode: ask for cloud provider and format if not provided
|
|
21
|
+
if (!options.provider) {
|
|
22
|
+
try {
|
|
23
|
+
options.provider = await select({
|
|
24
|
+
message: 'Select cloud provider:',
|
|
25
|
+
choices: [
|
|
26
|
+
{ name: 'AWS', value: 'aws' },
|
|
27
|
+
{ name: 'Azure', value: 'azure' },
|
|
28
|
+
{ name: 'Google Cloud Platform', value: 'gcp' }
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (error.name === 'ExitPromptError') {
|
|
33
|
+
console.log('\n✖ Command cancelled by user');
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!options.format) {
|
|
41
|
+
// Determine format choices based on provider
|
|
42
|
+
let formatChoices;
|
|
43
|
+
let defaultFormat;
|
|
44
|
+
if (options.provider === 'aws') {
|
|
45
|
+
formatChoices = [
|
|
46
|
+
{ name: 'CloudFormation', value: 'cloudformation' },
|
|
47
|
+
{ name: 'Terraform', value: 'terraform' },
|
|
48
|
+
{ name: 'Pulumi', value: 'pulumi' }
|
|
49
|
+
];
|
|
50
|
+
defaultFormat = 'cloudformation';
|
|
51
|
+
} else if (options.provider === 'azure') {
|
|
52
|
+
formatChoices = [
|
|
53
|
+
{ name: 'ARM Template', value: 'arm' },
|
|
54
|
+
{ name: 'Terraform', value: 'terraform' },
|
|
55
|
+
{ name: 'Pulumi', value: 'pulumi' }
|
|
56
|
+
];
|
|
57
|
+
defaultFormat = 'arm';
|
|
58
|
+
} else if (options.provider === 'gcp') {
|
|
59
|
+
formatChoices = [
|
|
60
|
+
{ name: 'Deployment Manager', value: 'deployment-manager' },
|
|
61
|
+
{ name: 'Terraform', value: 'terraform' },
|
|
62
|
+
{ name: 'Pulumi', value: 'pulumi' }
|
|
63
|
+
];
|
|
64
|
+
defaultFormat = 'deployment-manager';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
options.format = await select({
|
|
69
|
+
message: 'Select output format:',
|
|
70
|
+
choices: formatChoices
|
|
71
|
+
});
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (error.name === 'ExitPromptError') {
|
|
74
|
+
console.log('\n✖ Command cancelled by user');
|
|
75
|
+
process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Find the Frigg application
|
|
82
|
+
const nearestBackendPackageJson = await findNearestBackendPackageJson();
|
|
83
|
+
if (!nearestBackendPackageJson) {
|
|
84
|
+
throw new Error('Could not find a Frigg application. Make sure you are in a Frigg project directory.');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const backendDir = path.dirname(nearestBackendPackageJson);
|
|
88
|
+
const backendPackageJsonFile = JSON.parse(fs.readFileSync(nearestBackendPackageJson, 'utf8'));
|
|
89
|
+
const appName = backendPackageJsonFile.name || 'frigg-app';
|
|
90
|
+
|
|
91
|
+
if (options.verbose) {
|
|
92
|
+
console.log('Current directory:', process.cwd());
|
|
93
|
+
console.log('Backend package.json found at:', nearestBackendPackageJson);
|
|
94
|
+
console.log('Backend directory:', backendDir);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Load app definition
|
|
98
|
+
const appDefinitionPath = path.join(backendDir, 'index.js');
|
|
99
|
+
if (!fs.existsSync(appDefinitionPath)) {
|
|
100
|
+
throw new Error(`App definition not found at ${appDefinitionPath}`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Analyze the app definition
|
|
104
|
+
const appModule = require(appDefinitionPath);
|
|
105
|
+
const appDefinition = appModule.Definition || appModule;
|
|
106
|
+
const features = analyzeAppFeatures(appDefinition);
|
|
107
|
+
|
|
108
|
+
if (options.verbose) {
|
|
109
|
+
console.log('Detected features:', features);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Generate based on provider and format
|
|
113
|
+
let template;
|
|
114
|
+
let fileExtension;
|
|
115
|
+
let deploymentInstructions;
|
|
116
|
+
|
|
117
|
+
if (options.provider === 'aws') {
|
|
118
|
+
if (options.format === 'cloudformation') {
|
|
119
|
+
template = await generateCloudFormationTemplate({
|
|
120
|
+
appName,
|
|
121
|
+
features,
|
|
122
|
+
userPrefix: options.user || 'frigg-deployment-user',
|
|
123
|
+
stackName: options.stackName || 'frigg-deployment-iam'
|
|
124
|
+
});
|
|
125
|
+
fileExtension = 'yaml';
|
|
126
|
+
deploymentInstructions = generateCloudFormationInstructions(options);
|
|
127
|
+
} else if (options.format === 'terraform') {
|
|
128
|
+
template = await generateTerraformTemplate({
|
|
129
|
+
appName,
|
|
130
|
+
features,
|
|
131
|
+
userPrefix: options.user || 'frigg-deployment-user'
|
|
132
|
+
});
|
|
133
|
+
fileExtension = 'tf';
|
|
134
|
+
deploymentInstructions = generateTerraformInstructions(options);
|
|
135
|
+
} else if (options.format === 'pulumi') {
|
|
136
|
+
throw new Error('Pulumi support is not yet implemented');
|
|
137
|
+
}
|
|
138
|
+
} else if (options.provider === 'azure') {
|
|
139
|
+
if (options.format === 'arm') {
|
|
140
|
+
template = await generateAzureARMTemplate({
|
|
141
|
+
appName,
|
|
142
|
+
features,
|
|
143
|
+
userPrefix: options.user || 'frigg-deployment-user'
|
|
144
|
+
});
|
|
145
|
+
fileExtension = 'json';
|
|
146
|
+
deploymentInstructions = generateAzureInstructions(options);
|
|
147
|
+
} else if (options.format === 'terraform') {
|
|
148
|
+
template = await generateAzureTerraformTemplate({
|
|
149
|
+
appName,
|
|
150
|
+
features,
|
|
151
|
+
userPrefix: options.user || 'frigg-deployment-user'
|
|
152
|
+
});
|
|
153
|
+
fileExtension = 'tf';
|
|
154
|
+
deploymentInstructions = generateTerraformInstructions(options);
|
|
155
|
+
} else if (options.format === 'pulumi') {
|
|
156
|
+
throw new Error('Pulumi support for Azure is not yet implemented');
|
|
157
|
+
}
|
|
158
|
+
} else if (options.provider === 'gcp') {
|
|
159
|
+
if (options.format === 'deployment-manager') {
|
|
160
|
+
template = await generateGCPDeploymentManagerTemplate({
|
|
161
|
+
appName,
|
|
162
|
+
features,
|
|
163
|
+
userPrefix: options.user || 'frigg-deployment-user'
|
|
164
|
+
});
|
|
165
|
+
fileExtension = 'yaml';
|
|
166
|
+
deploymentInstructions = generateGCPInstructions(options);
|
|
167
|
+
} else if (options.format === 'terraform') {
|
|
168
|
+
template = await generateGCPTerraformTemplate({
|
|
169
|
+
appName,
|
|
170
|
+
features,
|
|
171
|
+
userPrefix: options.user || 'frigg-deployment-user'
|
|
172
|
+
});
|
|
173
|
+
fileExtension = 'tf';
|
|
174
|
+
deploymentInstructions = generateTerraformInstructions(options);
|
|
175
|
+
} else if (options.format === 'pulumi') {
|
|
176
|
+
throw new Error('Pulumi support for GCP is not yet implemented');
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
throw new Error(`Provider ${options.provider} is not yet implemented`);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Ensure output directory exists - smart path detection
|
|
183
|
+
let outputDir;
|
|
184
|
+
if (options.output) {
|
|
185
|
+
// If user specified output, use it as-is
|
|
186
|
+
outputDir = path.resolve(options.output);
|
|
187
|
+
} else {
|
|
188
|
+
// Smart default: put infrastructure in the backend directory we found
|
|
189
|
+
outputDir = path.join(backendDir, 'infrastructure');
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (options.verbose) {
|
|
193
|
+
console.log('Output directory will be:', outputDir);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (!fs.existsSync(outputDir)) {
|
|
197
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Write the template
|
|
201
|
+
const outputFileName = `frigg-deployment-${options.provider}-${options.format}.${fileExtension}`;
|
|
202
|
+
const outputPath = path.join(outputDir, outputFileName);
|
|
203
|
+
fs.writeFileSync(outputPath, template);
|
|
204
|
+
|
|
205
|
+
// Generate relative path for instructions
|
|
206
|
+
const relativeOutputDir = path.relative(process.cwd(), outputDir);
|
|
207
|
+
const relativeOutputPath = path.join(relativeOutputDir, outputFileName);
|
|
208
|
+
|
|
209
|
+
console.log(`\n✅ Generated ${options.format} template for ${options.provider}`);
|
|
210
|
+
console.log(`📄 Template saved to: ${outputPath}`);
|
|
211
|
+
// Update deployment instructions with actual paths
|
|
212
|
+
if (deploymentInstructions) {
|
|
213
|
+
deploymentInstructions = deploymentInstructions
|
|
214
|
+
.replace(/backend\/infrastructure/g, relativeOutputDir)
|
|
215
|
+
.replace(/file:\/\/backend\/infrastructure/g, `file://${relativeOutputDir}`);
|
|
216
|
+
}
|
|
217
|
+
console.log('\n' + deploymentInstructions);
|
|
218
|
+
|
|
219
|
+
} catch (error) {
|
|
220
|
+
console.error('Error generating deployment credentials:', error.message);
|
|
221
|
+
if (options.verbose && error.stack) {
|
|
222
|
+
console.error(error.stack);
|
|
223
|
+
}
|
|
224
|
+
process.exit(1);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function analyzeAppFeatures(appDefinition) {
|
|
229
|
+
const features = {
|
|
230
|
+
vpc: appDefinition.vpc?.enable === true,
|
|
231
|
+
kms: appDefinition.encryption?.useDefaultKMSForFieldLevelEncryption === true,
|
|
232
|
+
ssm: appDefinition.ssm?.enable === true,
|
|
233
|
+
websockets: appDefinition.websockets?.enable === true,
|
|
234
|
+
// Add more feature detection as needed
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
return features;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function generateCloudFormationInstructions(options) {
|
|
241
|
+
const stackName = options.stackName || 'frigg-deployment-iam';
|
|
242
|
+
return `
|
|
243
|
+
📋 Deployment Instructions (CloudFormation):
|
|
244
|
+
|
|
245
|
+
1. Deploy the CloudFormation stack:
|
|
246
|
+
aws cloudformation create-stack \\
|
|
247
|
+
--stack-name ${stackName} \\
|
|
248
|
+
--template-body file://${options.output || 'backend/infrastructure'}/frigg-deployment-aws-cloudformation.yaml \\
|
|
249
|
+
--capabilities CAPABILITY_NAMED_IAM
|
|
250
|
+
|
|
251
|
+
2. Wait for stack creation to complete:
|
|
252
|
+
aws cloudformation wait stack-create-complete --stack-name ${stackName}
|
|
253
|
+
|
|
254
|
+
3. Retrieve the created user ARN:
|
|
255
|
+
aws cloudformation describe-stacks \\
|
|
256
|
+
--stack-name ${stackName} \\
|
|
257
|
+
--query 'Stacks[0].Outputs[?OutputKey==\`UserArn\`].OutputValue' \\
|
|
258
|
+
--output text
|
|
259
|
+
|
|
260
|
+
4. Retrieve the access key ID:
|
|
261
|
+
aws cloudformation describe-stacks \\
|
|
262
|
+
--stack-name ${stackName} \\
|
|
263
|
+
--query 'Stacks[0].Outputs[?OutputKey==\`AccessKeyId\`].OutputValue' \\
|
|
264
|
+
--output text
|
|
265
|
+
|
|
266
|
+
5. Retrieve the secret access key from Secrets Manager:
|
|
267
|
+
SECRET_NAME=$(aws cloudformation describe-stacks \\
|
|
268
|
+
--stack-name ${stackName} \\
|
|
269
|
+
--query 'Stacks[0].Outputs[?OutputKey==\`SecretName\`].OutputValue' \\
|
|
270
|
+
--output text)
|
|
271
|
+
|
|
272
|
+
aws secretsmanager get-secret-value \\
|
|
273
|
+
--secret-id $SECRET_NAME \\
|
|
274
|
+
--query 'SecretString' \\
|
|
275
|
+
--output text
|
|
276
|
+
`;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function generateTerraformInstructions(options) {
|
|
280
|
+
return `
|
|
281
|
+
📋 Deployment Instructions (Terraform):
|
|
282
|
+
|
|
283
|
+
1. Initialize Terraform:
|
|
284
|
+
cd ${options.output || 'backend/infrastructure'}
|
|
285
|
+
terraform init
|
|
286
|
+
|
|
287
|
+
2. Review the plan:
|
|
288
|
+
terraform plan
|
|
289
|
+
|
|
290
|
+
3. Apply the configuration:
|
|
291
|
+
terraform apply
|
|
292
|
+
|
|
293
|
+
4. Retrieve the outputs:
|
|
294
|
+
terraform output -json
|
|
295
|
+
|
|
296
|
+
5. The access key ID and secret will be displayed in the outputs.
|
|
297
|
+
Store them securely and use them for your CI/CD pipeline.
|
|
298
|
+
|
|
299
|
+
⚠️ Security Note: The secret access key is sensitive. Consider using:
|
|
300
|
+
- terraform output -raw secret_access_key | pbcopy # Copy to clipboard
|
|
301
|
+
- Store in your CI/CD secret management system
|
|
302
|
+
- Delete local state file if not using remote state
|
|
303
|
+
`;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function generateAzureInstructions(options) {
|
|
307
|
+
return `
|
|
308
|
+
📋 Deployment Instructions (Azure ARM):
|
|
309
|
+
|
|
310
|
+
Azure ARM template support is coming soon.
|
|
311
|
+
For now, please use Terraform for Azure deployments.
|
|
312
|
+
|
|
313
|
+
To use Terraform with Azure:
|
|
314
|
+
1. Run: frigg generate --provider azure --format terraform
|
|
315
|
+
2. Follow the Terraform deployment instructions
|
|
316
|
+
`;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function generateGCPInstructions(options) {
|
|
320
|
+
return `
|
|
321
|
+
📋 Deployment Instructions (GCP Deployment Manager):
|
|
322
|
+
|
|
323
|
+
GCP Deployment Manager support is coming soon.
|
|
324
|
+
For now, please use Terraform for GCP deployments.
|
|
325
|
+
|
|
326
|
+
To use Terraform with GCP:
|
|
327
|
+
1. Run: frigg generate --provider gcp --format terraform
|
|
328
|
+
2. Follow the Terraform deployment instructions
|
|
329
|
+
`;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
module.exports = generateCommand;
|