pulumi / pulumi-digitalocean

A DigitalOcean Pulumi resource package, providing multi-language access to DigitalOcean
Apache License 2.0
83 stars 13 forks source link

DigitalOcean volume attachment requires dropletId as number but dropletId is string #351

Open Dreamystify opened 1 year ago

Dreamystify commented 1 year ago

What happened?

The following example in the docs

const foobarVolume = new digitalocean.Volume("foobarVolume", {
    region: "nyc1",
    size: 100,
    initialFilesystemType: "ext4",
    description: "an example volume",
});
const foobarDroplet = new digitalocean.Droplet("foobarDroplet", {
    size: "s-1vcpu-1gb",
    image: "ubuntu-18-04-x64",
    region: "nyc1",
});
const foobarVolumeAttachment = new digitalocean.VolumeAttachment("foobarVolumeAttachment", {
    dropletId: foobarDroplet.id, <--- this errors
    volumeId: foobarVolume.id,
});

Errors with the following

Type 'Output<string>' is not assignable to type 'Input<number>'.
  Type 'Output<string>' is not assignable to type 'OutputInstance<number>'.
    Types of property 'apply' are incompatible.
      Type '{ <U>(func: (t: string) => Promise<U>): Output<U>; <U>(func: (t: string) => OutputInstance<U>): Output<U>; <U>(func: (t: string) => U): Output<...>; }' is not assignable to type '{ <U>(func: (t: number) => Promise<U>): Output<U>; <U>(func: (t: number) => OutputInstance<U>): Output<U>; <U>(func: (t: number) => U): Output<...>; }'.
        Types of parameters 'func' and 'func' are incompatible.
          Types of parameters 't' and 't' are incompatible.

Pulumi Version: v3.49.0

Steps to reproduce

Run the example from the typescript docs https://www.pulumi.com/registry/packages/digitalocean/api-docs/volume/

Expected Behavior

dropletId to be the same type

Actual Behavior

VolumeAttachment.dropletId Input Droplet.dropletId Output

Output of pulumi about

No response

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

squaremo commented 1 year ago

Ah yes, I can see from the API docs https://www.pulumi.com/registry/packages/digitalocean/api-docs/droplet/#id_nodejs is typed string, and https://www.pulumi.com/registry/packages/digitalocean/api-docs/volumeattachment/#dropletid_nodejs is typed number.

As a workaround, can you use Apply to parse a number from the string, and use that as dropletId?