Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type mismatch between server.id and serverID #63

Open
kevinpapst opened this issue May 9, 2021 · 12 comments
Open

Type mismatch between server.id and serverID #63

kevinpapst opened this issue May 9, 2021 · 12 comments
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec

Comments

@kevinpapst
Copy link

Output Server.id returns a string but Input Rdns.serverId expects a number (several other places that expect a serverId as well, also want a number).

Expected behavior

Passing in the server.id should work without conversion:

const xyz = new hcloud.Server("xyz", {
...
}, {
    protect: true,
});

const rdns = new hcloud.Rdns("mydomain.de", {
    serverId: xyz.id,
    ipAddress: xyz.ipv4Address,
    dnsPtr: "mydomain.de",
});

According to https://docs.hetzner.cloud/#servers-get-a-server I believe that ID should be an int/number?

Current behavior

Compile error.

Steps to reproduce

Run the Typescript example from the official docs: https://www.pulumi.com/docs/reference/pkg/hcloud/rdns/#inputs

Affected feature

Just installed Pulumi 3.2.1 on MacOS with @pulumi/hcloud 1.0.0, so I assume latest lib versions.

@kevinpapst kevinpapst added the kind/bug Some behavior is incorrect or out of spec label May 9, 2021
@lblackstone lblackstone added kind/bug Some behavior is incorrect or out of spec and removed kind/bug Some behavior is incorrect or out of spec labels May 11, 2021
@lukehoban
Copy link

Note that you can convert the string to an int with: serverId: server.id.apply(parseInt).

That said - ideally you should not need this ceremony.

Pulumi id properties are always strings today - but it looks like for Hetzner, we'll need to expose the ID also as a number, as many inputs expect it as an int. Alternatively - we may need to change all places where ids are accepted as inputs to accept strings - to be more consistent with typical provider behaviour.

@lukehoban
Copy link

Looks like #46 and #52 are also tracking this same issue.

@stack72
Copy link
Contributor

stack72 commented May 12, 2021

I'll get a fix tested this morning for this

Paul

@kevinpapst
Copy link
Author

kevinpapst commented May 12, 2021

Hm, I tried parseInt(server.id) before, but that prevented me from using the preview.
Obviously a little problem that I never used Typescript before 😁 your solution works, thanks!

If you leave a hint how to install your patch (once it is there), I 'd be happy to provide end-user feedback.

Edit: being consistent sounds good. Hetzer seems to use an int in their API, so the question is: do you want to be string consistent in the Pulumi API or do you want to expose the Hetzer internals? There is a good reason for both ways.
But from my view, it shouldn't be the end-users task to typecast these IDs depending on the used object.

@sebandgo
Copy link

sebandgo commented Jun 7, 2021

@stack72 Any update on this?

Don't want to be rude, but pretty much everything / basic functionality relies on the resource.id bit.
IMO, atm the hcloud module it's basically dead in the water.

PS: So far I found a resource that works, hcloud.SshKey works. Firewall, Netowrk, Subnets and Volumes are failing...

@stack72 stack72 removed their assignment Jul 23, 2021
@flexwie
Copy link

flexwie commented Nov 22, 2021

@lukehoban @stack72 Do you have any updates or wold you accept a PR for this?
This issue is making me consider switching back to Terraform for my use case.

@kevinpapst
Copy link
Author

Pulumi might be working good with the largest cloud provider, but I guess Hetzner is absolutely not on the priority list (check commit history of this repo).
So many other tools out there to provide the same functionality...

@sebandgo
Copy link

You're right, by the look of it this isn't a priority.
What's been reported here so far it's about bugs, not feature requests.
These critical bugs makes Pulumi useless / unusable and I had to carry on with Terraform and to explore their CDK.

@jabbrwcky
Copy link

Basically anything with Id in the hcloud provider exhibits the same behaviour: Return IDs as Strings and expect Numbers as input.

@AaronFriel AaronFriel added the awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). label Feb 13, 2023
@AaronFriel AaronFriel self-assigned this Feb 13, 2023
@djmaze
Copy link

djmaze commented Sep 30, 2023

This is still broken and/or wrongly documented.

@srhb
Copy link

srhb commented Oct 20, 2023

@AaronFriel Do you have a link to the upstream issue that needs fixing? :)

@ryands17
Copy link

Is there an update to this one or a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests