1. Packages
  2. Azure Classic
  3. API Docs
  4. network
  5. getVpnGateway

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.network.getVpnGateway

Explore with Pulumi AI

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

Use this data source to access information about an existing VPN Gateway within a Virtual Hub.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.network.getVpnGateway({
    name: "existing-local-vpn_gateway",
    resourceGroupName: "existing-vpn_gateway",
});
export const azurermVpnGatewayId = example.then(example => example.id);
Copy
import pulumi
import pulumi_azure as azure

example = azure.network.get_vpn_gateway(name="existing-local-vpn_gateway",
    resource_group_name="existing-vpn_gateway")
pulumi.export("azurermVpnGatewayId", example.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := network.LookupVpnGateway(ctx, &network.LookupVpnGatewayArgs{
			Name:              "existing-local-vpn_gateway",
			ResourceGroupName: "existing-vpn_gateway",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("azurermVpnGatewayId", example.Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Network.GetVpnGateway.Invoke(new()
    {
        Name = "existing-local-vpn_gateway",
        ResourceGroupName = "existing-vpn_gateway",
    });

    return new Dictionary<string, object?>
    {
        ["azurermVpnGatewayId"] = example.Apply(getVpnGatewayResult => getVpnGatewayResult.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.network.NetworkFunctions;
import com.pulumi.azure.network.inputs.GetVpnGatewayArgs;
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) {
        final var example = NetworkFunctions.getVpnGateway(GetVpnGatewayArgs.builder()
            .name("existing-local-vpn_gateway")
            .resourceGroupName("existing-vpn_gateway")
            .build());

        ctx.export("azurermVpnGatewayId", example.applyValue(getVpnGatewayResult -> getVpnGatewayResult.id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:network:getVpnGateway
      arguments:
        name: existing-local-vpn_gateway
        resourceGroupName: existing-vpn_gateway
outputs:
  azurermVpnGatewayId: ${example.id}
Copy

Using getVpnGateway

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getVpnGateway(args: GetVpnGatewayArgs, opts?: InvokeOptions): Promise<GetVpnGatewayResult>
function getVpnGatewayOutput(args: GetVpnGatewayOutputArgs, opts?: InvokeOptions): Output<GetVpnGatewayResult>
Copy
def get_vpn_gateway(name: Optional[str] = None,
                    resource_group_name: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetVpnGatewayResult
def get_vpn_gateway_output(name: Optional[pulumi.Input[str]] = None,
                    resource_group_name: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetVpnGatewayResult]
Copy
func LookupVpnGateway(ctx *Context, args *LookupVpnGatewayArgs, opts ...InvokeOption) (*LookupVpnGatewayResult, error)
func LookupVpnGatewayOutput(ctx *Context, args *LookupVpnGatewayOutputArgs, opts ...InvokeOption) LookupVpnGatewayResultOutput
Copy

> Note: This function is named LookupVpnGateway in the Go SDK.

public static class GetVpnGateway 
{
    public static Task<GetVpnGatewayResult> InvokeAsync(GetVpnGatewayArgs args, InvokeOptions? opts = null)
    public static Output<GetVpnGatewayResult> Invoke(GetVpnGatewayInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetVpnGatewayResult> getVpnGateway(GetVpnGatewayArgs args, InvokeOptions options)
public static Output<GetVpnGatewayResult> getVpnGateway(GetVpnGatewayArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:network/getVpnGateway:getVpnGateway
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The Name of the VPN Gateway.
ResourceGroupName This property is required. string
The name of the Resource Group where the VPN Gateway exists.
Name This property is required. string
The Name of the VPN Gateway.
ResourceGroupName This property is required. string
The name of the Resource Group where the VPN Gateway exists.
name This property is required. String
The Name of the VPN Gateway.
resourceGroupName This property is required. String
The name of the Resource Group where the VPN Gateway exists.
name This property is required. string
The Name of the VPN Gateway.
resourceGroupName This property is required. string
The name of the Resource Group where the VPN Gateway exists.
name This property is required. str
The Name of the VPN Gateway.
resource_group_name This property is required. str
The name of the Resource Group where the VPN Gateway exists.
name This property is required. String
The Name of the VPN Gateway.
resourceGroupName This property is required. String
The name of the Resource Group where the VPN Gateway exists.

getVpnGateway Result

The following output properties are available:

BgpSettings List<GetVpnGatewayBgpSetting>
A bgp_settings block as defined below.
Id string
The provider-assigned unique ID for this managed resource.
Location string
The Azure location where the VPN Gateway exists.
Name string
ResourceGroupName string
ScaleUnit int
The Scale Unit of this VPN Gateway.
Tags Dictionary<string, string>
A mapping of tags assigned to the VPN Gateway.
VirtualHubId string
The ID of the Virtual Hub within which this VPN Gateway has been created.
BgpSettings []GetVpnGatewayBgpSetting
A bgp_settings block as defined below.
Id string
The provider-assigned unique ID for this managed resource.
Location string
The Azure location where the VPN Gateway exists.
Name string
ResourceGroupName string
ScaleUnit int
The Scale Unit of this VPN Gateway.
Tags map[string]string
A mapping of tags assigned to the VPN Gateway.
VirtualHubId string
The ID of the Virtual Hub within which this VPN Gateway has been created.
bgpSettings List<GetVpnGatewayBgpSetting>
A bgp_settings block as defined below.
id String
The provider-assigned unique ID for this managed resource.
location String
The Azure location where the VPN Gateway exists.
name String
resourceGroupName String
scaleUnit Integer
The Scale Unit of this VPN Gateway.
tags Map<String,String>
A mapping of tags assigned to the VPN Gateway.
virtualHubId String
The ID of the Virtual Hub within which this VPN Gateway has been created.
bgpSettings GetVpnGatewayBgpSetting[]
A bgp_settings block as defined below.
id string
The provider-assigned unique ID for this managed resource.
location string
The Azure location where the VPN Gateway exists.
name string
resourceGroupName string
scaleUnit number
The Scale Unit of this VPN Gateway.
tags {[key: string]: string}
A mapping of tags assigned to the VPN Gateway.
virtualHubId string
The ID of the Virtual Hub within which this VPN Gateway has been created.
bgp_settings Sequence[GetVpnGatewayBgpSetting]
A bgp_settings block as defined below.
id str
The provider-assigned unique ID for this managed resource.
location str
The Azure location where the VPN Gateway exists.
name str
resource_group_name str
scale_unit int
The Scale Unit of this VPN Gateway.
tags Mapping[str, str]
A mapping of tags assigned to the VPN Gateway.
virtual_hub_id str
The ID of the Virtual Hub within which this VPN Gateway has been created.
bgpSettings List<Property Map>
A bgp_settings block as defined below.
id String
The provider-assigned unique ID for this managed resource.
location String
The Azure location where the VPN Gateway exists.
name String
resourceGroupName String
scaleUnit Number
The Scale Unit of this VPN Gateway.
tags Map<String>
A mapping of tags assigned to the VPN Gateway.
virtualHubId String
The ID of the Virtual Hub within which this VPN Gateway has been created.

Supporting Types

GetVpnGatewayBgpSetting

Asn This property is required. int
The ASN of the BGP Speaker.
BgpPeeringAddress This property is required. string
The Address which should be used for the BGP Peering.
Instance0BgpPeeringAddresses This property is required. List<GetVpnGatewayBgpSettingInstance0BgpPeeringAddress>
an instance_bgp_peering_address block as defined below.
Instance1BgpPeeringAddresses This property is required. List<GetVpnGatewayBgpSettingInstance1BgpPeeringAddress>
an instance_bgp_peering_address block as defined below.
PeerWeight This property is required. int
The weight added to Routes learned from this BGP Speaker.
Asn This property is required. int
The ASN of the BGP Speaker.
BgpPeeringAddress This property is required. string
The Address which should be used for the BGP Peering.
Instance0BgpPeeringAddresses This property is required. []GetVpnGatewayBgpSettingInstance0BgpPeeringAddress
an instance_bgp_peering_address block as defined below.
Instance1BgpPeeringAddresses This property is required. []GetVpnGatewayBgpSettingInstance1BgpPeeringAddress
an instance_bgp_peering_address block as defined below.
PeerWeight This property is required. int
The weight added to Routes learned from this BGP Speaker.
asn This property is required. Integer
The ASN of the BGP Speaker.
bgpPeeringAddress This property is required. String
The Address which should be used for the BGP Peering.
instance0BgpPeeringAddresses This property is required. List<GetVpnGatewayBgpSettingInstance0BgpPeeringAddress>
an instance_bgp_peering_address block as defined below.
instance1BgpPeeringAddresses This property is required. List<GetVpnGatewayBgpSettingInstance1BgpPeeringAddress>
an instance_bgp_peering_address block as defined below.
peerWeight This property is required. Integer
The weight added to Routes learned from this BGP Speaker.
asn This property is required. number
The ASN of the BGP Speaker.
bgpPeeringAddress This property is required. string
The Address which should be used for the BGP Peering.
instance0BgpPeeringAddresses This property is required. GetVpnGatewayBgpSettingInstance0BgpPeeringAddress[]
an instance_bgp_peering_address block as defined below.
instance1BgpPeeringAddresses This property is required. GetVpnGatewayBgpSettingInstance1BgpPeeringAddress[]
an instance_bgp_peering_address block as defined below.
peerWeight This property is required. number
The weight added to Routes learned from this BGP Speaker.
asn This property is required. int
The ASN of the BGP Speaker.
bgp_peering_address This property is required. str
The Address which should be used for the BGP Peering.
instance0_bgp_peering_addresses This property is required. Sequence[GetVpnGatewayBgpSettingInstance0BgpPeeringAddress]
an instance_bgp_peering_address block as defined below.
instance1_bgp_peering_addresses This property is required. Sequence[GetVpnGatewayBgpSettingInstance1BgpPeeringAddress]
an instance_bgp_peering_address block as defined below.
peer_weight This property is required. int
The weight added to Routes learned from this BGP Speaker.
asn This property is required. Number
The ASN of the BGP Speaker.
bgpPeeringAddress This property is required. String
The Address which should be used for the BGP Peering.
instance0BgpPeeringAddresses This property is required. List<Property Map>
an instance_bgp_peering_address block as defined below.
instance1BgpPeeringAddresses This property is required. List<Property Map>
an instance_bgp_peering_address block as defined below.
peerWeight This property is required. Number
The weight added to Routes learned from this BGP Speaker.

GetVpnGatewayBgpSettingInstance0BgpPeeringAddress

CustomIps This property is required. List<string>
A list of custom BGP peering addresses to assigned to this instance.
DefaultIps This property is required. List<string>
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
IpConfigurationId This property is required. string
The pre-defined id of VPN Gateway IP Configuration.
TunnelIps This property is required. List<string>
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.
CustomIps This property is required. []string
A list of custom BGP peering addresses to assigned to this instance.
DefaultIps This property is required. []string
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
IpConfigurationId This property is required. string
The pre-defined id of VPN Gateway IP Configuration.
TunnelIps This property is required. []string
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.
customIps This property is required. List<String>
A list of custom BGP peering addresses to assigned to this instance.
defaultIps This property is required. List<String>
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
ipConfigurationId This property is required. String
The pre-defined id of VPN Gateway IP Configuration.
tunnelIps This property is required. List<String>
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.
customIps This property is required. string[]
A list of custom BGP peering addresses to assigned to this instance.
defaultIps This property is required. string[]
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
ipConfigurationId This property is required. string
The pre-defined id of VPN Gateway IP Configuration.
tunnelIps This property is required. string[]
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.
custom_ips This property is required. Sequence[str]
A list of custom BGP peering addresses to assigned to this instance.
default_ips This property is required. Sequence[str]
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
ip_configuration_id This property is required. str
The pre-defined id of VPN Gateway IP Configuration.
tunnel_ips This property is required. Sequence[str]
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.
customIps This property is required. List<String>
A list of custom BGP peering addresses to assigned to this instance.
defaultIps This property is required. List<String>
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
ipConfigurationId This property is required. String
The pre-defined id of VPN Gateway IP Configuration.
tunnelIps This property is required. List<String>
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.

GetVpnGatewayBgpSettingInstance1BgpPeeringAddress

CustomIps This property is required. List<string>
A list of custom BGP peering addresses to assigned to this instance.
DefaultIps This property is required. List<string>
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
IpConfigurationId This property is required. string
The pre-defined id of VPN Gateway IP Configuration.
TunnelIps This property is required. List<string>
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.
CustomIps This property is required. []string
A list of custom BGP peering addresses to assigned to this instance.
DefaultIps This property is required. []string
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
IpConfigurationId This property is required. string
The pre-defined id of VPN Gateway IP Configuration.
TunnelIps This property is required. []string
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.
customIps This property is required. List<String>
A list of custom BGP peering addresses to assigned to this instance.
defaultIps This property is required. List<String>
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
ipConfigurationId This property is required. String
The pre-defined id of VPN Gateway IP Configuration.
tunnelIps This property is required. List<String>
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.
customIps This property is required. string[]
A list of custom BGP peering addresses to assigned to this instance.
defaultIps This property is required. string[]
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
ipConfigurationId This property is required. string
The pre-defined id of VPN Gateway IP Configuration.
tunnelIps This property is required. string[]
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.
custom_ips This property is required. Sequence[str]
A list of custom BGP peering addresses to assigned to this instance.
default_ips This property is required. Sequence[str]
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
ip_configuration_id This property is required. str
The pre-defined id of VPN Gateway IP Configuration.
tunnel_ips This property is required. Sequence[str]
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.
customIps This property is required. List<String>
A list of custom BGP peering addresses to assigned to this instance.
defaultIps This property is required. List<String>
The list of default BGP peering addresses which belong to the pre-defined VPN Gateway IP configuration.
ipConfigurationId This property is required. String
The pre-defined id of VPN Gateway IP Configuration.
tunnelIps This property is required. List<String>
The list of tunnel public IP addresses which belong to the pre-defined VPN Gateway IP configuration.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi