pulumi-azure icon indicating copy to clipboard operation
pulumi-azure copied to clipboard

not able to recover pulumi source code resources

Open eduwebmonster opened this issue 4 years ago • 15 comments

Hello, Have created the pulumi azure typescript project and somehow lost the source code (files like index.ts etc.) . By searching the doc, have found the following steps to recover the configuration.

Recovering Configuration Deleting this stack or this stack's resources requires that you have a Pulumi.yaml file in the same directory.

# Pulumi.yaml
echo "name: azure_cloud_proj" > Pulumi.yaml
echo "runtime: nodejs" >> Pulumi.yaml

# Pulumi.dev.yaml
pulumi stack select azure_cloud_infra/azure_cloud_proj/dev
pulumi config refresh


the issue is , the doc is not bit clear. should we create the same directory as previous and run above commands OR any directory would do ?

further, just created the same directory as previous and ran the command . got the following error : please suggest


C:\azure_cloud_infra>pulumi stack select azure_cloud_infra/azure_cloud_proj/dev
error: could not get cloud url: could not load current project: yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `name: a...` into workspace.Project

C:\azure_cloud_infra>

eduwebmonster avatar Jun 26 '21 14:06 eduwebmonster

please suggest

eduwebmonster avatar Jun 28 '21 07:06 eduwebmonster

@joeduffy : can you please suggest ?

eduwebmonster avatar Jun 28 '21 16:06 eduwebmonster

Any directory should do. I agree this is a bit unfortunate, I think we have a bug tracking the idea of being able to destroy without a working directory, but that would require slight changes to the way configuration works. @justinvp Is that right?

As to the latest error, it appears there's a problem with the YAML unmarshaling, and that the Pulumi.yaml file contains invalid YAML. Provided there isn't anything sensitive in there, would you mind sharing the contents of the file?

joeduffy avatar Jun 28 '21 16:06 joeduffy

Thanks. this is what we have in pulumi.yaml. please suggest

"name: azure_cloud_proj" 
"runtime: nodejs" 

eduwebmonster avatar Jun 28 '21 17:06 eduwebmonster

@joeduffy : please suggest

eduwebmonster avatar Jun 29 '21 05:06 eduwebmonster

I think you can remove the quotes and it should work:

name: azure_cloud_proj
runtime: nodejs

Can you give this a try?

If so, and assuming you found those echo instructions that led to the quotes on our website, could you share a link to it so we can fix the problem with the documentation?

joeduffy avatar Jun 29 '21 15:06 joeduffy

@joeduffy : Thanks . it worked. however, pulumi up command is not working. following is the error we are getting.

C:\azure_cloud_infra>pulumi up Previewing update (azure_cloud_infra/dev)

View Live: https://app.pulumi.com/azure_cloud_infra/azure_cloud_proj/dev/previews/f059b778-9587-4d46-ba52-b1989356677a

 Type                 Name                  Plan     Info
 pulumi:pulumi:Stack  azure_cloud_proj-dev           1 message

Diagnostics: pulumi:pulumi:Stack (azure_cloud_proj-dev): error: could not find node on the $PATH: exec: "node": executable file not found in %PATH%

error: failed to load language plugin nodejs: could not read plugin [C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin\pulumi-language-nodejs.exe] stdout: EOF

C:\azure_cloud_infra>

is this expected ? if so, what is the recommended steps to recover all typescripts files along with state so that we can run "pulumi up" command. Thanks

eduwebmonster avatar Jun 29 '21 16:06 eduwebmonster

@joeduffy : any update ?

eduwebmonster avatar Jun 30 '21 16:06 eduwebmonster

@joeduffy : any update please ? this is blocker for us . if you are busy , can you assign any one of your engineer to work on this ? I feel it is very simple but unnecessary getting streched.

eduwebmonster avatar Jul 02 '21 17:07 eduwebmonster

It looks like Node.js might not be installed? That is a required dependency for Pulumi projects that use Node.js as the language runtime. Instructions for how to install are available at https://www.pulumi.com/docs/get-started/azure/begin/#install-language-runtime

joeduffy avatar Jul 02 '21 18:07 joeduffy

@joeduffy : after installing node.js , now complaining for some pulumi SDK

C:\azure_cloud_infra>pulumi up Previewing update (azure_cloud_infra/dev)

View Live: https://app.pulumi.com/azure_cloud_infra/azure_cloud_proj/dev/previews/0810ca6d-adc0-4bd6-817a-d2104c9893d1

 Type                 Name                  Plan     Info
 pulumi:pulumi:Stack  azure_cloud_proj-dev           1 message

Diagnostics: pulumi:pulumi:Stack (azure_cloud_proj-dev): error: It looks like the Pulumi SDK has not been installed. Have you run npm install or yarn install?

warning: A new version of Pulumi is available. To upgrade from version '3.5.1' to '3.6.0', visit https://pulumi.com/docs/reference/install/ for manual instructions and release notes. error: failed to load language plugin nodejs: could not read plugin [C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin\pulumi-language-nodejs.exe] stdout: EOF

after googling , haven't found any good link which says how to install pulumi SDK

eduwebmonster avatar Jul 05 '21 08:07 eduwebmonster

Installation instructions are here: https://www.pulumi.com/docs/get-started/install/. You would need to npm install @pulumi/pulumi to get the SDK. However, I thought you were just trying to destroy a stack -- if you don't have the source code, pulumi up isn't going to work. To destroy, you can run pulumi destroy, which shouldn't require the SDK.

joeduffy avatar Jul 05 '21 19:07 joeduffy

@joeduffy : the sole purpose of this ticket is to : "how to recover the deleted source code of pulumi resources"

I am not just trying to destroy the stack but trying to understand how to recover all typescripts source code which got deleted accidently.

please suggest

eduwebmonster avatar Jul 06 '21 07:07 eduwebmonster

@joeduffy : please suggest

eduwebmonster avatar Jul 07 '21 17:07 eduwebmonster

@joeduffy : any update please ? this is blocker

eduwebmonster avatar Jul 13 '21 15:07 eduwebmonster