1. Packages
  2. Vcd Provider
  3. API Docs
  4. getNsxtEdgegatewayL2VpnTunnel
vcd 3.14.1 published on Monday, Apr 14, 2025 by vmware

vcd.getNsxtEdgegatewayL2VpnTunnel

Explore with Pulumi AI

Supported in provider v3.11+ and VCD 10.4+ with NSX-T.

Provides a data source to read NSX-T Edge Gateway L2 VPN Tunnel sessions and their configurations.

Example Usage

Reading A Tunnel’s Server Session To Get The Peer Code For The Client Session)

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

const existing = vcd.getOrgVdc({
    name: "existing-vdc",
});
const server_testing = existing.then(existing => vcd.getNsxtEdgegateway({
    ownerId: existing.id,
    name: "server-testing",
}));
const client_testing = existing.then(existing => vcd.getNsxtEdgegateway({
    ownerId: existing.id,
    name: "client-testing",
}));
const server_session = server_testing.then(server_testing => vcd.getNsxtEdgegatewayL2VpnTunnel({
    org: "datacloud",
    edgeGatewayId: server_testing.id,
    name: "server-session",
}));
const client_session = new vcd.NsxtEdgegatewayL2VpnTunnel("client-session", {
    org: "datacloud",
    edgeGatewayId: client_testing.then(client_testing => client_testing.id),
    sessionMode: "CLIENT",
    enabled: true,
    localEndpointIp: "101.22.30.3",
    remoteEndpointIp: "1.2.2.3",
    peerCode: server_session.then(server_session => server_session.peerCode),
});
Copy
import pulumi
import pulumi_vcd as vcd

existing = vcd.get_org_vdc(name="existing-vdc")
server_testing = vcd.get_nsxt_edgegateway(owner_id=existing.id,
    name="server-testing")
client_testing = vcd.get_nsxt_edgegateway(owner_id=existing.id,
    name="client-testing")
server_session = vcd.get_nsxt_edgegateway_l2_vpn_tunnel(org="datacloud",
    edge_gateway_id=server_testing.id,
    name="server-session")
client_session = vcd.NsxtEdgegatewayL2VpnTunnel("client-session",
    org="datacloud",
    edge_gateway_id=client_testing.id,
    session_mode="CLIENT",
    enabled=True,
    local_endpoint_ip="101.22.30.3",
    remote_endpoint_ip="1.2.2.3",
    peer_code=server_session.peer_code)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/vcd/v3/vcd"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		existing, err := vcd.LookupOrgVdc(ctx, &vcd.LookupOrgVdcArgs{
			Name: "existing-vdc",
		}, nil)
		if err != nil {
			return err
		}
		server_testing, err := vcd.LookupNsxtEdgegateway(ctx, &vcd.LookupNsxtEdgegatewayArgs{
			OwnerId: pulumi.StringRef(existing.Id),
			Name:    "server-testing",
		}, nil)
		if err != nil {
			return err
		}
		client_testing, err := vcd.LookupNsxtEdgegateway(ctx, &vcd.LookupNsxtEdgegatewayArgs{
			OwnerId: pulumi.StringRef(existing.Id),
			Name:    "client-testing",
		}, nil)
		if err != nil {
			return err
		}
		server_session, err := vcd.LookupNsxtEdgegatewayL2VpnTunnel(ctx, &vcd.LookupNsxtEdgegatewayL2VpnTunnelArgs{
			Org:           pulumi.StringRef("datacloud"),
			EdgeGatewayId: server_testing.Id,
			Name:          "server-session",
		}, nil)
		if err != nil {
			return err
		}
		_, err = vcd.NewNsxtEdgegatewayL2VpnTunnel(ctx, "client-session", &vcd.NsxtEdgegatewayL2VpnTunnelArgs{
			Org:              pulumi.String("datacloud"),
			EdgeGatewayId:    pulumi.String(client_testing.Id),
			SessionMode:      pulumi.String("CLIENT"),
			Enabled:          pulumi.Bool(true),
			LocalEndpointIp:  pulumi.String("101.22.30.3"),
			RemoteEndpointIp: pulumi.String("1.2.2.3"),
			PeerCode:         pulumi.String(server_session.PeerCode),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vcd = Pulumi.Vcd;

return await Deployment.RunAsync(() => 
{
    var existing = Vcd.GetOrgVdc.Invoke(new()
    {
        Name = "existing-vdc",
    });

    var server_testing = Vcd.GetNsxtEdgegateway.Invoke(new()
    {
        OwnerId = existing.Apply(getOrgVdcResult => getOrgVdcResult.Id),
        Name = "server-testing",
    });

    var client_testing = Vcd.GetNsxtEdgegateway.Invoke(new()
    {
        OwnerId = existing.Apply(getOrgVdcResult => getOrgVdcResult.Id),
        Name = "client-testing",
    });

    var server_session = Vcd.GetNsxtEdgegatewayL2VpnTunnel.Invoke(new()
    {
        Org = "datacloud",
        EdgeGatewayId = server_testing.Apply(getNsxtEdgegatewayResult => getNsxtEdgegatewayResult.Id),
        Name = "server-session",
    });

    var client_session = new Vcd.NsxtEdgegatewayL2VpnTunnel("client-session", new()
    {
        Org = "datacloud",
        EdgeGatewayId = client_testing.Apply(client_testing => client_testing.Apply(getNsxtEdgegatewayResult => getNsxtEdgegatewayResult.Id)),
        SessionMode = "CLIENT",
        Enabled = true,
        LocalEndpointIp = "101.22.30.3",
        RemoteEndpointIp = "1.2.2.3",
        PeerCode = server_session.Apply(server_session => server_session.Apply(getNsxtEdgegatewayL2VpnTunnelResult => getNsxtEdgegatewayL2VpnTunnelResult.PeerCode)),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vcd.VcdFunctions;
import com.pulumi.vcd.inputs.GetOrgVdcArgs;
import com.pulumi.vcd.inputs.GetNsxtEdgegatewayArgs;
import com.pulumi.vcd.inputs.GetNsxtEdgegatewayL2VpnTunnelArgs;
import com.pulumi.vcd.NsxtEdgegatewayL2VpnTunnel;
import com.pulumi.vcd.NsxtEdgegatewayL2VpnTunnelArgs;
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 existing = VcdFunctions.getOrgVdc(GetOrgVdcArgs.builder()
            .name("existing-vdc")
            .build());

        final var server-testing = VcdFunctions.getNsxtEdgegateway(GetNsxtEdgegatewayArgs.builder()
            .ownerId(existing.applyValue(getOrgVdcResult -> getOrgVdcResult.id()))
            .name("server-testing")
            .build());

        final var client-testing = VcdFunctions.getNsxtEdgegateway(GetNsxtEdgegatewayArgs.builder()
            .ownerId(existing.applyValue(getOrgVdcResult -> getOrgVdcResult.id()))
            .name("client-testing")
            .build());

        final var server-session = VcdFunctions.getNsxtEdgegatewayL2VpnTunnel(GetNsxtEdgegatewayL2VpnTunnelArgs.builder()
            .org("datacloud")
            .edgeGatewayId(server_testing.id())
            .name("server-session")
            .build());

        var client_session = new NsxtEdgegatewayL2VpnTunnel("client-session", NsxtEdgegatewayL2VpnTunnelArgs.builder()
            .org("datacloud")
            .edgeGatewayId(client_testing.id())
            .sessionMode("CLIENT")
            .enabled(true)
            .localEndpointIp("101.22.30.3")
            .remoteEndpointIp("1.2.2.3")
            .peerCode(server_session.peerCode())
            .build());

    }
}
Copy
resources:
  client-session:
    type: vcd:NsxtEdgegatewayL2VpnTunnel
    properties:
      org: datacloud
      # Note that this is a different Edge Gateway, as one Edge Gateway
      #   # can function only in SERVER or CLIENT mode
      edgeGatewayId: ${["client-testing"].id}
      sessionMode: CLIENT
      enabled: true
      # must be sub-allocated on the Edge Gateway
      localEndpointIp: 101.22.30.3
      remoteEndpointIp: 1.2.2.3
      peerCode: ${["server-session"].peerCode}
variables:
  existing:
    fn::invoke:
      function: vcd:getOrgVdc
      arguments:
        name: existing-vdc
  server-testing:
    fn::invoke:
      function: vcd:getNsxtEdgegateway
      arguments:
        ownerId: ${existing.id}
        name: server-testing
  client-testing:
    fn::invoke:
      function: vcd:getNsxtEdgegateway
      arguments:
        ownerId: ${existing.id}
        name: client-testing
  server-session:
    fn::invoke:
      function: vcd:getNsxtEdgegatewayL2VpnTunnel
      arguments:
        org: datacloud
        edgeGatewayId: ${["server-testing"].id}
        name: server-session
Copy

Using getNsxtEdgegatewayL2VpnTunnel

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 getNsxtEdgegatewayL2VpnTunnel(args: GetNsxtEdgegatewayL2VpnTunnelArgs, opts?: InvokeOptions): Promise<GetNsxtEdgegatewayL2VpnTunnelResult>
function getNsxtEdgegatewayL2VpnTunnelOutput(args: GetNsxtEdgegatewayL2VpnTunnelOutputArgs, opts?: InvokeOptions): Output<GetNsxtEdgegatewayL2VpnTunnelResult>
Copy
def get_nsxt_edgegateway_l2_vpn_tunnel(edge_gateway_id: Optional[str] = None,
                                       id: Optional[str] = None,
                                       name: Optional[str] = None,
                                       org: Optional[str] = None,
                                       opts: Optional[InvokeOptions] = None) -> GetNsxtEdgegatewayL2VpnTunnelResult
def get_nsxt_edgegateway_l2_vpn_tunnel_output(edge_gateway_id: Optional[pulumi.Input[str]] = None,
                                       id: Optional[pulumi.Input[str]] = None,
                                       name: Optional[pulumi.Input[str]] = None,
                                       org: Optional[pulumi.Input[str]] = None,
                                       opts: Optional[InvokeOptions] = None) -> Output[GetNsxtEdgegatewayL2VpnTunnelResult]
Copy
func LookupNsxtEdgegatewayL2VpnTunnel(ctx *Context, args *LookupNsxtEdgegatewayL2VpnTunnelArgs, opts ...InvokeOption) (*LookupNsxtEdgegatewayL2VpnTunnelResult, error)
func LookupNsxtEdgegatewayL2VpnTunnelOutput(ctx *Context, args *LookupNsxtEdgegatewayL2VpnTunnelOutputArgs, opts ...InvokeOption) LookupNsxtEdgegatewayL2VpnTunnelResultOutput
Copy

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

public static class GetNsxtEdgegatewayL2VpnTunnel 
{
    public static Task<GetNsxtEdgegatewayL2VpnTunnelResult> InvokeAsync(GetNsxtEdgegatewayL2VpnTunnelArgs args, InvokeOptions? opts = null)
    public static Output<GetNsxtEdgegatewayL2VpnTunnelResult> Invoke(GetNsxtEdgegatewayL2VpnTunnelInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetNsxtEdgegatewayL2VpnTunnelResult> getNsxtEdgegatewayL2VpnTunnel(GetNsxtEdgegatewayL2VpnTunnelArgs args, InvokeOptions options)
public static Output<GetNsxtEdgegatewayL2VpnTunnelResult> getNsxtEdgegatewayL2VpnTunnel(GetNsxtEdgegatewayL2VpnTunnelArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: vcd:index/getNsxtEdgegatewayL2VpnTunnel:getNsxtEdgegatewayL2VpnTunnel
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

EdgeGatewayId This property is required. string
The ID of the Edge Gateway (NSX-T only). Can be looked up using vcd.NsxtEdgegateway data source
Name This property is required. string
The name of the tunnel.
Id string
Org string
The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organisations
EdgeGatewayId This property is required. string
The ID of the Edge Gateway (NSX-T only). Can be looked up using vcd.NsxtEdgegateway data source
Name This property is required. string
The name of the tunnel.
Id string
Org string
The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organisations
edgeGatewayId This property is required. String
The ID of the Edge Gateway (NSX-T only). Can be looked up using vcd.NsxtEdgegateway data source
name This property is required. String
The name of the tunnel.
id String
org String
The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organisations
edgeGatewayId This property is required. string
The ID of the Edge Gateway (NSX-T only). Can be looked up using vcd.NsxtEdgegateway data source
name This property is required. string
The name of the tunnel.
id string
org string
The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organisations
edge_gateway_id This property is required. str
The ID of the Edge Gateway (NSX-T only). Can be looked up using vcd.NsxtEdgegateway data source
name This property is required. str
The name of the tunnel.
id str
org str
The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organisations
edgeGatewayId This property is required. String
The ID of the Edge Gateway (NSX-T only). Can be looked up using vcd.NsxtEdgegateway data source
name This property is required. String
The name of the tunnel.
id String
org String
The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organisations

getNsxtEdgegatewayL2VpnTunnel Result

The following output properties are available:

Supporting Types

GetNsxtEdgegatewayL2VpnTunnelStretchedNetwork

NetworkId This property is required. string
TunnelId This property is required. double
NetworkId This property is required. string
TunnelId This property is required. float64
networkId This property is required. String
tunnelId This property is required. Double
networkId This property is required. string
tunnelId This property is required. number
network_id This property is required. str
tunnel_id This property is required. float
networkId This property is required. String
tunnelId This property is required. Number

Package Details

Repository
vcd vmware/terraform-provider-vcd
License
Notes
This Pulumi package is based on the vcd Terraform Provider.