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

digitalocean provider: type mismatches for 'dropletId' #4173

Closed
cr1st1p opened this issue Mar 25, 2020 · 2 comments
Closed

digitalocean provider: type mismatches for 'dropletId' #4173

cr1st1p opened this issue Mar 25, 2020 · 2 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue

Comments

@cr1st1p
Copy link

cr1st1p commented Mar 25, 2020

Short version:
Inside digitalocean component, field 'dropletId' is defined in some parts as number, in other parts as string !? But the the Droplet resource has it as Pulumi.ID (string). At least where defined as 'number' I can't use those resources.

Please let me know if there's a quick fix I could do until this gets sorted out.
Hardcoding it should be out of the question - I want to have both a production and staging environment based on the same codebase.

Details:

Maybe I'm missing something - I'm a new user, but I wanted to 'import' what I have in DigitalOcean, into Pulumi.

Among others things I have a Droplet and associated FloatingIp.
The problem is that with the code that I have (typescript), obtained based on a terraformer -> tf2pulumi flow, when I do a 'pulumi up', it will show that the floating IP will get the property 'dropletId' removed from my FloatingIp resource. Bad.

My code is initially like:

const var1 = new digitalocean.Droplet("someName", {
   variousParameters
}, {import: "someStringID");

const var2 = new digitalocean.FloatingIp("someOtherName", {
    ipAddress: "something",
    region: "someRegion",
}, {import: "someStringIP"});

Based on the diff shown to me, I said I should add property 'dropletId' to the FloatingIp construction args, like 'dropletId: var1.id'
But...I can't.

The problem is that Droplet ID is defined as Pulumi.ID (which itself is a string), but 'dropletId' is declared as 'number', inside the FloatingIP resource.

Unless that is normal and there is some kind of type transformation between an Output<Pulumi.ID> and Input I should know about, I can't use it :-(

I see that the 'dropletId' is being defined as number in several places inside Pulumi, and I'm wondering if it isn't like this because that's how it is defined in the original terraform plugin: https://github.com/terraform-providers/terraform-provider-digitalocean/blob/master/digitalocean/datasource_digitalocean_floating_ip.go

I found out that at least in another place, it is defined as string: DropletSnapshot
It should probably be Pulumi.ID or "Pulumi.ID | string".

Regards.

@cr1st1p
Copy link
Author

cr1st1p commented Mar 25, 2020

a temporary fix that seems to work so far:

dropletId: var1.id.apply(x => Number(x).valueOf())

@emiliza emiliza added kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue labels Oct 1, 2021
@emiliza
Copy link
Contributor

emiliza commented Oct 1, 2021

Closing this out in favor of the general tracking issue here: pulumi/pulumi-terraform-bridge#352

@emiliza emiliza closed this as completed Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants