cloudy-sky-software / pulumi-render

A Pulumi provider for Render based on Render's OpenAPI spec. https://render.com
Apache License 2.0
8 stars 1 forks source link

fix: `fatal: a failure has occurred: unexpected schema type render:services:WebServiceDetailsCreateRuntime ` #367

Closed VladimirCreator closed 1 month ago

VladimirCreator commented 1 month ago

The error occurred after I executed the following command:

pulumi import render:services:WebService thewebsrcive srv-xxxxxxx

It also printed the following:

Your resource has been imported into Pulumi state, but there was an error generating the import code.
VladimirCreator commented 1 month ago

@praneetloke I now cannot update my infrastructure because it did not generate the code and now Pulumi thinks I deleted the resource and it tries to remove it 🫠

praneetloke commented 1 month ago

@VladimirCreator I suggest you temporarily remove the imported web service from your state with pulumi state delete <urn> -s <stack name>. You can get the URN with pulumi stack --show-urns -s <stack name>.

praneetloke commented 1 month ago

@VladimirCreator I had a suspicion that it was because the Render API for "Retrieve Service" does not return the runtime property and yet it is a required input for "Create Service", so Pulumi tries to use an empty string which ends up failing because runtime is an enum and it can't use an empty string for it. I proved this to be the case by hacking a local version of the provider where runtime is not an enum and Pulumi was able to generate the import code successfully.

Note the value of the runtime property in the screenshot.

image

I have posted a question in their community forum but I am not sure if they'll fix their API. In the meantime, the only workaround that I can think of (aside from committing my hack where I change the type of runtime from an enum string to a regular string) is that you use this generated code from my import and adjust it to the values from your state after you run the import. I don't know how complex your web service configuration is though?

generated code ```ts const myWebService = new render.services.WebService("myWebService", { autoDeploy: render.services.ServiceCreateAutoDeploy.Yes, branch: "main", name: "express-hello-world", ownerId: "usr-XXXXXXXXXXXX", repo: "https://github.com/render-examples/express-hello-world", rootDir: "", serviceDetails: { env: render.services.WebServiceDetailsCreateEnv.Node, envSpecificDetails: { buildCommand: "yarn --frozen-lockfile install", startCommand: "node app.js", }, healthCheckPath: "", numInstances: 1, plan: render.services.WebServiceDetailsCreatePlan["free"], pullRequestPreviewsEnabled: render.services.WebServiceDetailsCreatePullRequestPreviewsEnabled.No, region: render.services.WebServiceDetailsCreateRegion.Oregon, runtime: "", <----this is what the CLI generated but you should fill this in with the value from the `env` property above. }, type: "web_service", }, { protect: true, }); ```
praneetloke commented 1 month ago

@VladimirCreator this should now be fixed with v0.3.12.