Hi there, I'm trying out this piece of code from ...
# golang
m
Hi there, I'm trying out this piece of code from https://www.pulumi.com/registry/packages/azure-native/api-docs/network/virtualnetwork/#create-virtual-network-with-subnet:
Copy code
_, err := network.NewVirtualNetwork(ctx, "virtualNetwork", &network.VirtualNetworkArgs{
			AddressSpace: &network.AddressSpaceArgs{
				AddressPrefixes: pulumi.StringArray{
					pulumi.String("10.0.0.0/16"),
				},
			},
			Location:          pulumi.String("eastus"),
			ResourceGroupName: pulumi.String("rg1"),
			Subnets: []network.SubnetArgs{
				&network.SubnetArgs{
					AddressPrefix: pulumi.String("10.0.0.0/24"),
					Name:          pulumi.String("test-1"),
				},
			},
			VirtualNetworkName: pulumi.String("test-vnet"),
		})
For the "Subnets" field, however, the
network.SubnetArgs
type doesn't seem qualify as a
network.SubnetTypeArrayInput
because it does implement a method called `ToSubnetTypeArrayOutput`:
b
I have the EXACT same problem with postgresservers. Their example for it is just broken on their website. I realize this doesn't help but im honestly a little sad to see it be a widespread issue :(
I have even submitted an issue on this, in their github: https://github.com/pulumi/pulumi-azure-native/issues/1472 You could possibly add your case to it. They could be related
m
Nice one mate - looks like whatever they use to automatically codegen these things might be missing methods. I've voted your issue up.
I ended up filing a bug as well: https://github.com/pulumi/pulumi-azure-native/issues/1479. Thanks for the tip.
i
given that it wants a
SubnetTypeArrayInput
, this compiles for me…
Copy code
_, err := network.NewVirtualNetwork(ctx, "virtualNetwork", &network.VirtualNetworkArgs{
                        AddressSpace: &network.AddressSpaceArgs{
                                AddressPrefixes: pulumi.StringArray{
                                        pulumi.String("10.0.0.0/16"),
                                },
                        },
                        Location:          pulumi.String("eastus"),
                        ResourceGroupName: pulumi.String("rg1"),
                        Subnets: network.SubnetTypeArray{
                                &network.SubnetTypeArgs{
                                        AddressPrefix: pulumi.String("10.0.0.0/24"),
                                        Name:          pulumi.String("test-1"),
                                },
                        },
                        VirtualNetworkName: pulumi.String("test-vnet"),
                })
🙌 1
(untested beyond running go build)
m
Thank you @important-appointment-55126 - that was a simple fix ! Much appreciated !! Still a noob learning this API 🙂
i
great! Glad it worked - looks like they need a bug fix on the docs eh?
m
Yes - the docs need to be fixed - correct.
a
They were quick to merge a GHA docs PR for me so perhaps worth raising?
m
That's a great idea yes!