Last active
March 15, 2021 22:08
-
-
Save lenardchristopher/caa58b4c3c1a36831b9ab8234fbbb112 to your computer and use it in GitHub Desktop.
Create virtual network peerings using Pulumi in Golang and CosmosDb config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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