Skip to content

🎥 Make videos programmatically with React

use APIs from 'fs'

Jonny Burger6b358e47651e
diff --git a/packages/cloudrun/install.mjs b/packages/cloudrun/install.mjs
index 912af8b900..d28d494c46 100644
--- a/packages/cloudrun/install.mjs
+++ b/packages/cloudrun/install.mjs
@@ -1,5 +1,6 @@
// this will be executed with node
import {execSync} from 'child_process';
+import {existsSync, readFileSync} from 'fs';
import readline from 'readline';
/****************************************
@@ -158,23 +159,13 @@ function checkTerraformStateFile() {
* Check for existing Terraform State
****************************************/
- const dirFiles = execSync('ls -a', {
- stdio: ['inherit', 'pipe', 'pipe'],
- })
- .toString()
- .trim();
-
- if (dirFiles.includes('.tfstate') && !dirFiles.includes('.tfstate.backup')) {
+ if (existsSync('terraform.tfstate')) {
execSync(
'echo "Terraform State file exists. Checking it is for the current Remotion project...\n"',
{stdio: 'inherit'}
);
- const tfstate = JSON.parse(
- execSync('cat terraform.tfstate', {
- stdio: ['inherit', 'pipe', 'pipe'],
- }).toString()
- );
+ const tfstate = JSON.parse(readFileSync('terraform.tfstate', 'utf-8'));
const tfstateProject = tfstate.outputs?.remotion_project_id?.value;