https://pulumi.com logo
#golang
Title
# golang
b

brash-salesclerk-15704

11/08/2023, 6:48 AM
Hi guys, I’m working with the digitalocean provider. 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/ My code to create the firewall:
Copy code
_, err = do.NewFirewall(ctx, "databaseFirewall", &do.FirewallArgs{
			DropletIds: pulumi.IntArray{
				dataBaseServer.ID(),
			},
			InboundRules: do.FirewallInboundRuleArray{},
			OutboundRules: do.FirewallOutboundRuleArray{},
		})
I get the following error:
Copy code
Cannot use 'dataBaseServer.ID()' (type IDOutput) as the type IntInputType does not implement 'IntInput' as some methods are missing:ToIntOutput() IntOutputToIntOutputWithContext(ctx context.Context) IntOutputToIntPtrOutput() IntPtrOutput…
What am I missing? 😄
n

nice-guitar-7761

11/08/2023, 3:04 PM
AFAIR, an Pulumi ID is a string, so I think you could probably do something like
dataBaseServer.ID().ApplyT(strconv.Atoi).(pulumi.IntOutput)
b

brash-salesclerk-15704

11/09/2023, 6:32 AM
Thank you 🙂 To convert the value was also my last idea. It is a pity that the documentation does not show the correct way.