Heroku/Pulumi cloud option
tiagob opened this issue · 1 comments
tiagob commented
RDS & Fargate replacement
- https://devcenter.heroku.com/articles/using-terraform-with-heroku
- https://www.pulumi.com/docs/guides/adopting/from_terraform/
Cloud Front replacement
gjolund commented
it might just be easiest to call the hasura pro cli directly from ts using shelljs?
//#region Global Imports
import * as shell from 'shelljs';
//#endregion Global Imports
//#region Local Imports
import {
ShellExecResponse,
ShellExecSuccess,
ShellExecError,
ShellExecTimeoutError,
ShellExecNotFoundError,
} from './Responses';
import { ShellExecOptions } from '@Modules/shell-utils/Interfaces';
//#endregion Local Imports
export const SHELL_DEFAULT_SETTINGS: ShellExecOptions = {
silent: true,
simple: true,
};
/*eslint complexity: ["error", 9]*/
export const handleShellResponse = (
code: number | null,
stdout: string | null,
stderr: string | null,
command: string,
settings: ShellExecOptions,
resolve: (value?: ShellExecSuccess) => void,
reject: (value?: ShellExecError) => void,
): void => {
switch (code) {
case 0: // success
return resolve(
new ShellExecSuccess(code, stdout, stderr, command, settings),
);
// If there is an error then reject
case null: // timeout
return reject(
new ShellExecTimeoutError(code, stdout, stderr, command, settings),
);
case 127: // not-found
return reject(
new ShellExecNotFoundError(code, stdout, stderr, command, settings),
);
case 1: // Catch-all
case 2: // Misuse of shell builtins (according to Bash documentation)
case 126: // Command invoked cannot execute
case 128: // Invalid argument to exit
case 130: // Script terminated by Control-C
default:
return reject(
new ShellExecError(code, stdout, stderr, command, settings),
);
}
};
export const shellExec = async (
command: string,
settings: ShellExecOptions = SHELL_DEFAULT_SETTINGS,
): Promise<ShellExecResponse> => {
return new Promise((resolve, reject) => {
shell.exec(
command,
settings,
(code: number | null, stdout: string | null, stderr: string | null) => {
handleShellResponse(
code,
stdout,
stderr,
command,
settings,
resolve,
reject,
);
},
);
});
};