Closed ayumakesit closed 1 month ago
Hi @ayumakesit
This is because resource IDs are strings in Pulumi, while DropletIds
expects integers. Assuming dataBaseServer.ID()
is in fact an integer, you should be able to convert it with something like
_, err = do.NewFirewall(ctx, "databaseFirewall", &do.FirewallArgs{
DropletIds: pulumi.IntArray{
dataBaseServer.ID().ToStringOutput().ApplyT(func(id string) int {
v, _ := strconv.Atoi(id)
return v
}).(pulumi.IntOutput),
},
InboundRules: do.FirewallInboundRuleArray{},
OutboundRules: do.FirewallOutboundRuleArray{},
})
A similar issue for TypeScript: https://github.com/pulumi/pulumi-digitalocean/issues/81
Let me know if this helps.
Hi @mikhailshilkov, thank you for the response :)
I already converted it:
_, err = do.NewFirewall(ctx, "databaseFirewall", &do.FirewallArgs{
DropletIds: pulumi.IntArray{
dataBaseServer.ID().ApplyT(strconv.Atoi).(pulumi.IntOutput),
},
InboundRules: do.FirewallInboundRuleArray{
&do.FirewallInboundRuleArgs{
Protocol: pulumi.String("tcp"),
PortRange: pulumi.String("22"),
},
},
OutboundRules: do.FirewallOutboundRuleArray{},
})
For newbies like me, it would be very helpful if the documentation could show the right way ;)
Great to hear you are unblocked! I'll leave the issue open to track fixing the example.
Upstream pu/pu issue: https://github.com/pulumi/pulumi/issues/9841
Tracked by #600
What happened?
Following the example to create a firewall I’m trying to use the ID of the created droplet. The example: https://www.pulumi.com/registry/packages/digitalocean/api-docs/firewall/
I get the following error:
Example
Output of
pulumi about
CLI Version 3.92.0 Go Version go1.21.3 Go Compiler gc
Plugins NAME VERSION digitalocean 4.23.0 go unknown
Host OS darwin Version 14.1 Arch arm64
Dependencies: NAME VERSION github.com/pulumi/pulumi-digitalocean/sdk/v4 4.23.0 github.com/pulumi/pulumi/sdk/v3 3.92.0
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).