Vpn Gateway
VpnGateway Resource. API Version: 2020-11-01.
Example Usage
VpnGatewayPut
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var vpnGateway = new AzureNative.Network.VpnGateway("vpnGateway", new()
{
BgpSettings = new AzureNative.Network.Inputs.BgpSettingsArgs
{
Asn = 65515,
BgpPeeringAddresses = new[]
{
new AzureNative.Network.Inputs.IPConfigurationBgpPeeringAddressArgs
{
CustomBgpIpAddresses = new[]
{
"169.254.21.5",
},
IpconfigurationId = "Instance0",
},
new AzureNative.Network.Inputs.IPConfigurationBgpPeeringAddressArgs
{
CustomBgpIpAddresses = new[]
{
"169.254.21.10",
},
IpconfigurationId = "Instance1",
},
},
PeerWeight = 0,
},
Connections = new[]
{
new AzureNative.Network.Inputs.VpnConnectionArgs
{
Name = "vpnConnection1",
RemoteVpnSite = new AzureNative.Network.Inputs.SubResourceArgs
{
Id = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1",
},
VpnLinkConnections = new[]
{
new AzureNative.Network.Inputs.VpnSiteLinkConnectionArgs
{
ConnectionBandwidth = 200,
EgressNatRules = new[]
{
new AzureNative.Network.Inputs.SubResourceArgs
{
Id = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03",
},
},
Name = "Connection-Link1",
SharedKey = "key",
VpnConnectionProtocolType = "IKEv2",
VpnSiteLink = new AzureNative.Network.Inputs.SubResourceArgs
{
Id = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1",
},
},
},
},
},
GatewayName = "gateway1",
IsRoutingPreferenceInternet = false,
Location = "westcentralus",
NatRules = new[]
{
new AzureNative.Network.Inputs.VpnGatewayNatRuleArgs
{
ExternalMappings = new[]
{
new AzureNative.Network.Inputs.VpnNatRuleMappingArgs
{
AddressSpace = "192.168.0.0/26",
},
},
InternalMappings = new[]
{
new AzureNative.Network.Inputs.VpnNatRuleMappingArgs
{
AddressSpace = "0.0.0.0/26",
},
},
IpConfigurationId = "",
Mode = "EgressSnat",
Name = "nat03",
Type = "Static",
},
},
ResourceGroupName = "rg1",
Tags =
{
{ "key1", "value1" },
},
VirtualHub = new AzureNative.Network.Inputs.SubResourceArgs
{
Id = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1",
},
});
});
Content copied to clipboard
package main
import (
network "github.com/pulumi/pulumi-azure-native-sdk/network"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := network.NewVpnGateway(ctx, "vpnGateway", &network.VpnGatewayArgs{
BgpSettings: network.BgpSettingsResponse{
Asn: pulumi.Float64(65515),
BgpPeeringAddresses: network.IPConfigurationBgpPeeringAddressArray{
&network.IPConfigurationBgpPeeringAddressArgs{
CustomBgpIpAddresses: pulumi.StringArray{
pulumi.String("169.254.21.5"),
},
IpconfigurationId: pulumi.String("Instance0"),
},
&network.IPConfigurationBgpPeeringAddressArgs{
CustomBgpIpAddresses: pulumi.StringArray{
pulumi.String("169.254.21.10"),
},
IpconfigurationId: pulumi.String("Instance1"),
},
},
PeerWeight: pulumi.Int(0),
},
Connections: []network.VpnConnectionTypeArgs{
{
Name: pulumi.String("vpnConnection1"),
RemoteVpnSite: {
Id: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"),
},
VpnLinkConnections: network.VpnSiteLinkConnectionArray{
{
ConnectionBandwidth: pulumi.Int(200),
EgressNatRules: network.SubResourceArray{
{
Id: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"),
},
},
Name: pulumi.String("Connection-Link1"),
SharedKey: pulumi.String("key"),
VpnConnectionProtocolType: pulumi.String("IKEv2"),
VpnSiteLink: {
Id: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"),
},
},
},
},
},
GatewayName: pulumi.String("gateway1"),
IsRoutingPreferenceInternet: pulumi.Bool(false),
Location: pulumi.String("westcentralus"),
NatRules: []network.VpnGatewayNatRuleArgs{
{
ExternalMappings: network.VpnNatRuleMappingArray{
{
AddressSpace: pulumi.String("192.168.0.0/26"),
},
},
InternalMappings: network.VpnNatRuleMappingArray{
{
AddressSpace: pulumi.String("0.0.0.0/26"),
},
},
IpConfigurationId: pulumi.String(""),
Mode: pulumi.String("EgressSnat"),
Name: pulumi.String("nat03"),
Type: pulumi.String("Static"),
},
},
ResourceGroupName: pulumi.String("rg1"),
Tags: pulumi.StringMap{
"key1": pulumi.String("value1"),
},
VirtualHub: &network.SubResourceArgs{
Id: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"),
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.network.VpnGateway;
import com.pulumi.azurenative.network.VpnGatewayArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var vpnGateway = new VpnGateway("vpnGateway", VpnGatewayArgs.builder()
.bgpSettings(Map.ofEntries(
Map.entry("asn", 65515),
Map.entry("bgpPeeringAddresses",
Map.ofEntries(
Map.entry("customBgpIpAddresses", "169.254.21.5"),
Map.entry("ipconfigurationId", "Instance0")
),
Map.ofEntries(
Map.entry("customBgpIpAddresses", "169.254.21.10"),
Map.entry("ipconfigurationId", "Instance1")
)),
Map.entry("peerWeight", 0)
))
.connections(Map.ofEntries(
Map.entry("name", "vpnConnection1"),
Map.entry("remoteVpnSite", Map.of("id", "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1")),
Map.entry("vpnLinkConnections", Map.ofEntries(
Map.entry("connectionBandwidth", 200),
Map.entry("egressNatRules", Map.of("id", "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03")),
Map.entry("name", "Connection-Link1"),
Map.entry("sharedKey", "key"),
Map.entry("vpnConnectionProtocolType", "IKEv2"),
Map.entry("vpnSiteLink", Map.of("id", "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"))
))
))
.gatewayName("gateway1")
.isRoutingPreferenceInternet(false)
.location("westcentralus")
.natRules(Map.ofEntries(
Map.entry("externalMappings", Map.of("addressSpace", "192.168.0.0/26")),
Map.entry("internalMappings", Map.of("addressSpace", "0.0.0.0/26")),
Map.entry("ipConfigurationId", ""),
Map.entry("mode", "EgressSnat"),
Map.entry("name", "nat03"),
Map.entry("type", "Static")
))
.resourceGroupName("rg1")
.tags(Map.of("key1", "value1"))
.virtualHub(Map.of("id", "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1"))
.build());
}
}
Content copied to clipboard
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:network:VpnGateway gateway1 /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1
Content copied to clipboard
Properties
Link copied to clipboard
Local network gateway's BGP speaker settings.
Link copied to clipboard
List of all vpn connections to the gateway.
Link copied to clipboard
List of all IPs configured on the gateway.
Link copied to clipboard
Enable Routing Preference property for the Public IP Interface of the VpnGateway.
Link copied to clipboard
List of all the nat Rules associated with the gateway.
Link copied to clipboard
The provisioning state of the VPN gateway resource.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
The VirtualHub to which the gateway belongs.
Link copied to clipboard
The scale unit for this vpn gateway.