Skip to content

Instantly share code, notes, and snippets.

@lenardchristopher
Last active March 15, 2021 22:08
Show Gist options
  • Save lenardchristopher/caa58b4c3c1a36831b9ab8234fbbb112 to your computer and use it in GitHub Desktop.
Save lenardchristopher/caa58b4c3c1a36831b9ab8234fbbb112 to your computer and use it in GitHub Desktop.
Create virtual network peerings using Pulumi in Golang and CosmosDb config
peerings, err := getRegionPeerings(params)
for _, p := range peerings {
_, err = network.NewVirtualNetworkPeering(ctx, p.Region+"-to-"+p.Name+"-vnet", &network.VirtualNetworkPeeringArgs{
Name: pulumi.StringPtr("to-" + p.Region + "-vnet-" + p.Name),
ResourceGroupName: pulumi.String("ctus-assets"),
VirtualNetworkName: pulumi.String(p.Region + "-vnet"),
RemoteVirtualNetwork: network.SubResourcePtrInput(&network.SubResourceArgs{
Id: pulumi.StringPtr(fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s", p.SubscriptionID, p.Name, p.Region+"-vnet")),
}),
AllowVirtualNetworkAccess: pulumi.BoolPtr(true),
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment