Hi guys, it seems that pulumi is unable to read fi...
# getting-started
Hi guys, it seems that pulumi is unable to read file outside the parent folder. Both public key is on chmod 777
let pubKey: string = fs.readFileSync(path.join(__dirname,'/../pulumi/id_rsa.pub')).toString()
works though, able to read file within its pulumi directory.
let pubKey: string = fs.readFileSync(path.join(__dirname,'/../secret/id_rsa.pub')).toString()
doesn't work. Unable to find file outside pulumi directory.
That's odd. Let me try.
Ok, so it works for me @nutritious-church-27230 Here is my code
Copy code
import * as fs from "fs";
import * as path from "path";

let pubKey: string = fs.readFileSync(path.join(__dirname,'/../secret/id_rsa.pub')).toString();
When you call
pulumi up
you should get an exception over multiple lines. Do you mind to paste them here please ?
By the way, I initially made a mistake and the exception showed me the full path to my id_rsa.pub Doing a
ls -l "full file path"
revealed my actual mistake.
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
const fs = require("fs");
const path = require("path");
let pubKey: string = fs.readFileSync(path.join(__dirname,'/../secret/id_rsa.pub')).toString();
const masterInstance = new linode.Instance("nanode-master", {
group: "masters",
type: "g6-nanode-1",
region: "ap-south",
image: "linode/alpine3.13",
authorizedKeys: [ pubKey ],
rootPass: "rootPass123!",
tags: ["master node"],
watchdogEnabled: true
it works fine if you use console or in express folder. but it pops error when using pubKey as value for authorizedKeys under new instance.
'/../secret/' errors:
error: Running program '/pulumi' failed with an unhandled exception:
Error: ENOENT: no such file or directory, open '/secret/id_rsa.pub'
'/../pulumi/' : No errors, it proceeds to ask if I want to create instance. Both pubKey under pulumi & secret folder are at chmod 777 permission.