pulumi / pulumi-aws-native

AWS Native Provider for Pulumi
Apache License 2.0
90 stars 17 forks source link

cidr{Output} function doesn't work? #1566

Open arianvp opened 1 month ago

arianvp commented 1 month ago

What happened?

const cidr = aws.cidrOutput({
    ipBlock: "2a05:d024:d::/56",
    cidrBits: 4,
    count: 1,
})

I expected this to create a /60 CIDR. Instead ot just returns the string "2a05:d024:d::/56"

Example

const cidr = aws.cidrOutput({
    ipBlock: "2a05:d024:d::/56",
    cidrBits: 4,
    count: 1,
})

Output of pulumi about

CLI          
Version      3.90.1
Go Version   go1.21.9
Go Compiler  gc

Plugins
NAME        VERSION
aws         6.37.1
aws-native  0.99.0
nodejs      unknown

Additional context

Same problem occurs with IPv$

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).

corymhall commented 1 month ago

@arianvp thanks for raising this issue! It looks like there might be a couple of problems in our implementation of the cidr function.

  1. We add the ipBlock as the first item in the list of subnets. I don't think this is expected (unless I am missing something
  2. The NextSubnet returns true if it can't find a subnet cidr

https://github.com/pulumi/pulumi-aws-native/blob/8a4a7d820d4157548ce237b2d0e91cada96945ed/provider/pkg/provider/provider_intrinsics.go#L76-L85