VpnGateway

class VpnGateway : KotlinCustomResource

VpnGateway Resource. Uses Azure REST API version 2024-05-01. In version 2.x of the Azure Native provider, it used API version 2023-02-01. Other available API versions: 2018-06-01, 2018-07-01, 2018-08-01, 2018-10-01, 2018-11-01, 2018-12-01, 2019-02-01, 2019-04-01, 2019-06-01, 2019-07-01, 2019-08-01, 2019-09-01, 2019-11-01, 2019-12-01, 2020-03-01, 2020-04-01, 2020-05-01, 2020-06-01, 2020-07-01, 2020-08-01, 2020-11-01, 2021-02-01, 2021-03-01, 2021-05-01, 2021-08-01, 2022-01-01, 2022-05-01, 2022-07-01, 2022-09-01, 2022-11-01, 2023-02-01, 2023-04-01, 2023-05-01, 2023-06-01, 2023-09-01, 2023-11-01, 2024-01-01, 2024-03-01. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native network [ApiVersion]. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.

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 = AzureNative.Network.VirtualNetworkGatewayConnectionProtocol.IKEv2,
VpnSiteLink = new AzureNative.Network.Inputs.SubResourceArgs
{
Id = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1",
},
},
},
},
},
EnableBgpRouteTranslationForNat = false,
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 = AzureNative.Network.VpnNatRuleMode.EgressSnat,
Name = "nat03",
Type = AzureNative.Network.VpnNatRuleType.Static,
},
},
ResourceGroupName = "rg1",
Tags =
{
{ "key1", "value1" },
},
VirtualHub = new AzureNative.Network.Inputs.SubResourceArgs
{
Id = "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1",
},
});
});
package main
import (
network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
"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.BgpSettingsArgs{
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.VpnConnectionTypeArray{
&network.VpnConnectionTypeArgs{
Name: pulumi.String("vpnConnection1"),
RemoteVpnSite: &network.SubResourceArgs{
Id: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1"),
},
VpnLinkConnections: network.VpnSiteLinkConnectionArray{
&network.VpnSiteLinkConnectionArgs{
ConnectionBandwidth: pulumi.Int(200),
EgressNatRules: network.SubResourceArray{
&network.SubResourceArgs{
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(network.VirtualNetworkGatewayConnectionProtocolIKEv2),
VpnSiteLink: &network.SubResourceArgs{
Id: pulumi.String("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1"),
},
},
},
},
},
EnableBgpRouteTranslationForNat: pulumi.Bool(false),
GatewayName: pulumi.String("gateway1"),
IsRoutingPreferenceInternet: pulumi.Bool(false),
Location: pulumi.String("westcentralus"),
NatRules: network.VpnGatewayNatRuleArray{
&network.VpnGatewayNatRuleArgs{
ExternalMappings: network.VpnNatRuleMappingArray{
&network.VpnNatRuleMappingArgs{
AddressSpace: pulumi.String("192.168.0.0/26"),
},
},
InternalMappings: network.VpnNatRuleMappingArray{
&network.VpnNatRuleMappingArgs{
AddressSpace: pulumi.String("0.0.0.0/26"),
},
},
IpConfigurationId: pulumi.String(""),
Mode: pulumi.String(network.VpnNatRuleModeEgressSnat),
Name: pulumi.String("nat03"),
Type: pulumi.String(network.VpnNatRuleTypeStatic),
},
},
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
})
}
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 com.pulumi.azurenative.network.inputs.BgpSettingsArgs;
import com.pulumi.azurenative.network.inputs.VpnConnectionArgs;
import com.pulumi.azurenative.network.inputs.SubResourceArgs;
import com.pulumi.azurenative.network.inputs.VpnGatewayNatRuleArgs;
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(BgpSettingsArgs.builder()
.asn(65515)
.bgpPeeringAddresses(
IPConfigurationBgpPeeringAddressArgs.builder()
.customBgpIpAddresses("169.254.21.5")
.ipconfigurationId("Instance0")
.build(),
IPConfigurationBgpPeeringAddressArgs.builder()
.customBgpIpAddresses("169.254.21.10")
.ipconfigurationId("Instance1")
.build())
.peerWeight(0)
.build())
.connections(VpnConnectionArgs.builder()
.name("vpnConnection1")
.remoteVpnSite(SubResourceArgs.builder()
.id("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1")
.build())
.vpnLinkConnections(VpnSiteLinkConnectionArgs.builder()
.connectionBandwidth(200)
.egressNatRules(SubResourceArgs.builder()
.id("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03")
.build())
.name("Connection-Link1")
.sharedKey("key")
.vpnConnectionProtocolType("IKEv2")
.vpnSiteLink(SubResourceArgs.builder()
.id("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1")
.build())
.build())
.build())
.enableBgpRouteTranslationForNat(false)
.gatewayName("gateway1")
.isRoutingPreferenceInternet(false)
.location("westcentralus")
.natRules(VpnGatewayNatRuleArgs.builder()
.externalMappings(VpnNatRuleMappingArgs.builder()
.addressSpace("192.168.0.0/26")
.build())
.internalMappings(VpnNatRuleMappingArgs.builder()
.addressSpace("0.0.0.0/26")
.build())
.ipConfigurationId("")
.mode("EgressSnat")
.name("nat03")
.type("Static")
.build())
.resourceGroupName("rg1")
.tags(Map.of("key1", "value1"))
.virtualHub(SubResourceArgs.builder()
.id("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1")
.build())
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:network:VpnGateway gateway1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}

Properties

Link copied to clipboard
val azureApiVersion: Output<String>

The Azure API version of the resource.

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

Enable BGP routes translation for NAT on this VpnGateway.

Link copied to clipboard
val etag: Output<String>

A unique read-only string that changes whenever the resource is updated.

Link copied to clipboard
val id: Output<String>
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
val location: Output<String>

Resource location.

Link copied to clipboard
val name: Output<String>

Resource name.

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
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val tags: Output<Map<String, String>>?

Resource tags.

Link copied to clipboard
val type: Output<String>

Resource type.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard

The VirtualHub to which the gateway belongs.

Link copied to clipboard
val vpnGatewayScaleUnit: Output<Int>?

The scale unit for this vpn gateway.