1. Packages
  2. Ibm Provider
  3. API Docs
  4. getNetworkVlan
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

ibm.getNetworkVlan

Explore with Pulumi AI

ibm logo
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

    Retrieve information of an existing network VLAN as a read-only data source. For more information, about network VLAN, see network services.

    Example Usage

    The following example shows how you can use this data source to reference a VLAN ID in the ibm.ComputeBareMetal resource because the numeric IDs are often unknown.

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const vlanFoo = ibm.getNetworkVlan({
        name: "FOO",
    });
    const bm1 = new ibm.ComputeBareMetal("bm1", {publicVlanId: vlanFoo.then(vlanFoo => vlanFoo.id)});
    
    import pulumi
    import pulumi_ibm as ibm
    
    vlan_foo = ibm.get_network_vlan(name="FOO")
    bm1 = ibm.ComputeBareMetal("bm1", public_vlan_id=vlan_foo.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		vlanFoo, err := ibm.LookupNetworkVlan(ctx, &ibm.LookupNetworkVlanArgs{
    			Name: pulumi.StringRef("FOO"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = ibm.NewComputeBareMetal(ctx, "bm1", &ibm.ComputeBareMetalArgs{
    			PublicVlanId: pulumi.Float64(vlanFoo.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        var vlanFoo = Ibm.GetNetworkVlan.Invoke(new()
        {
            Name = "FOO",
        });
    
        var bm1 = new Ibm.ComputeBareMetal("bm1", new()
        {
            PublicVlanId = vlanFoo.Apply(getNetworkVlanResult => getNetworkVlanResult.Id),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.IbmFunctions;
    import com.pulumi.ibm.inputs.GetNetworkVlanArgs;
    import com.pulumi.ibm.ComputeBareMetal;
    import com.pulumi.ibm.ComputeBareMetalArgs;
    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 vlanFoo = IbmFunctions.getNetworkVlan(GetNetworkVlanArgs.builder()
                .name("FOO")
                .build());
    
            var bm1 = new ComputeBareMetal("bm1", ComputeBareMetalArgs.builder()
                .publicVlanId(vlanFoo.applyValue(getNetworkVlanResult -> getNetworkVlanResult.id()))
                .build());
    
        }
    }
    
    resources:
      bm1:
        type: ibm:ComputeBareMetal
        properties:
          publicVlanId: ${vlanFoo.id}
    variables:
      vlanFoo:
        fn::invoke:
          function: ibm:getNetworkVlan
          arguments:
            name: FOO
    

    Using getNetworkVlan

    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 getNetworkVlan(args: GetNetworkVlanArgs, opts?: InvokeOptions): Promise<GetNetworkVlanResult>
    function getNetworkVlanOutput(args: GetNetworkVlanOutputArgs, opts?: InvokeOptions): Output<GetNetworkVlanResult>
    def get_network_vlan(name: Optional[str] = None,
                         number: Optional[float] = None,
                         router_hostname: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetNetworkVlanResult
    def get_network_vlan_output(name: Optional[pulumi.Input[str]] = None,
                         number: Optional[pulumi.Input[float]] = None,
                         router_hostname: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetNetworkVlanResult]
    func LookupNetworkVlan(ctx *Context, args *LookupNetworkVlanArgs, opts ...InvokeOption) (*LookupNetworkVlanResult, error)
    func LookupNetworkVlanOutput(ctx *Context, args *LookupNetworkVlanOutputArgs, opts ...InvokeOption) LookupNetworkVlanResultOutput

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

    public static class GetNetworkVlan 
    {
        public static Task<GetNetworkVlanResult> InvokeAsync(GetNetworkVlanArgs args, InvokeOptions? opts = null)
        public static Output<GetNetworkVlanResult> Invoke(GetNetworkVlanInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNetworkVlanResult> getNetworkVlan(GetNetworkVlanArgs args, InvokeOptions options)
    public static Output<GetNetworkVlanResult> getNetworkVlan(GetNetworkVlanArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ibm:index/getNetworkVlan:getNetworkVlan
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the VLAN. This value is required if neither the VLAN number nor the router host name is specified. To retrieve the name, go to the IBM Cloud infrastructure portal and navigate to Network > IP Management > VLANs. Note you need right permission to access the classic infrastructure.
    Number double
    The VLAN number. This value is required if no VLAN name is provided. To find the number, go to the IBM Cloud infrastructure portal.
    RouterHostname string
    The host name of the primary VLAN router. This value is required if no VLAN name is provided. To find the host name, see IBM Cloud infrastructure portal.
    Name string
    The name of the VLAN. This value is required if neither the VLAN number nor the router host name is specified. To retrieve the name, go to the IBM Cloud infrastructure portal and navigate to Network > IP Management > VLANs. Note you need right permission to access the classic infrastructure.
    Number float64
    The VLAN number. This value is required if no VLAN name is provided. To find the number, go to the IBM Cloud infrastructure portal.
    RouterHostname string
    The host name of the primary VLAN router. This value is required if no VLAN name is provided. To find the host name, see IBM Cloud infrastructure portal.
    name String
    The name of the VLAN. This value is required if neither the VLAN number nor the router host name is specified. To retrieve the name, go to the IBM Cloud infrastructure portal and navigate to Network > IP Management > VLANs. Note you need right permission to access the classic infrastructure.
    number Double
    The VLAN number. This value is required if no VLAN name is provided. To find the number, go to the IBM Cloud infrastructure portal.
    routerHostname String
    The host name of the primary VLAN router. This value is required if no VLAN name is provided. To find the host name, see IBM Cloud infrastructure portal.
    name string
    The name of the VLAN. This value is required if neither the VLAN number nor the router host name is specified. To retrieve the name, go to the IBM Cloud infrastructure portal and navigate to Network > IP Management > VLANs. Note you need right permission to access the classic infrastructure.
    number number
    The VLAN number. This value is required if no VLAN name is provided. To find the number, go to the IBM Cloud infrastructure portal.
    routerHostname string
    The host name of the primary VLAN router. This value is required if no VLAN name is provided. To find the host name, see IBM Cloud infrastructure portal.
    name str
    The name of the VLAN. This value is required if neither the VLAN number nor the router host name is specified. To retrieve the name, go to the IBM Cloud infrastructure portal and navigate to Network > IP Management > VLANs. Note you need right permission to access the classic infrastructure.
    number float
    The VLAN number. This value is required if no VLAN name is provided. To find the number, go to the IBM Cloud infrastructure portal.
    router_hostname str
    The host name of the primary VLAN router. This value is required if no VLAN name is provided. To find the host name, see IBM Cloud infrastructure portal.
    name String
    The name of the VLAN. This value is required if neither the VLAN number nor the router host name is specified. To retrieve the name, go to the IBM Cloud infrastructure portal and navigate to Network > IP Management > VLANs. Note you need right permission to access the classic infrastructure.
    number Number
    The VLAN number. This value is required if no VLAN name is provided. To find the number, go to the IBM Cloud infrastructure portal.
    routerHostname String
    The host name of the primary VLAN router. This value is required if no VLAN name is provided. To find the host name, see IBM Cloud infrastructure portal.

    getNetworkVlan Result

    The following output properties are available:

    Id double
    (String) The ID of the virtual guest.
    Name string
    Number double
    RouterHostname string
    Subnets List<GetNetworkVlanSubnet>
    (List of Objects) The collection of subnets associated with the VLAN.
    VirtualGuests List<GetNetworkVlanVirtualGuest>
    (List of Objects) A nested block describes the VSIs attached to the VLAN.
    Id float64
    (String) The ID of the virtual guest.
    Name string
    Number float64
    RouterHostname string
    Subnets []GetNetworkVlanSubnet
    (List of Objects) The collection of subnets associated with the VLAN.
    VirtualGuests []GetNetworkVlanVirtualGuest
    (List of Objects) A nested block describes the VSIs attached to the VLAN.
    id Double
    (String) The ID of the virtual guest.
    name String
    number Double
    routerHostname String
    subnets List<GetNetworkVlanSubnet>
    (List of Objects) The collection of subnets associated with the VLAN.
    virtualGuests List<GetNetworkVlanVirtualGuest>
    (List of Objects) A nested block describes the VSIs attached to the VLAN.
    id number
    (String) The ID of the virtual guest.
    name string
    number number
    routerHostname string
    subnets GetNetworkVlanSubnet[]
    (List of Objects) The collection of subnets associated with the VLAN.
    virtualGuests GetNetworkVlanVirtualGuest[]
    (List of Objects) A nested block describes the VSIs attached to the VLAN.
    id float
    (String) The ID of the virtual guest.
    name str
    number float
    router_hostname str
    subnets Sequence[GetNetworkVlanSubnet]
    (List of Objects) The collection of subnets associated with the VLAN.
    virtual_guests Sequence[GetNetworkVlanVirtualGuest]
    (List of Objects) A nested block describes the VSIs attached to the VLAN.
    id Number
    (String) The ID of the virtual guest.
    name String
    number Number
    routerHostname String
    subnets List<Property Map>
    (List of Objects) The collection of subnets associated with the VLAN.
    virtualGuests List<Property Map>
    (List of Objects) A nested block describes the VSIs attached to the VLAN.

    Supporting Types

    GetNetworkVlanSubnet

    Cidr double
    (Integer) A subnet Classless Inter-Domain Routing prefix. The number in the range of 0 - 32 signifying the number of bits in a subnet mask.
    Gateway string
    (String) A subnet gateway address.
    Id double
    (String) The ID of the virtual guest.
    Subnet string
    (String) The subnet for the VLAN.

    • subnet-type - (String) A subnet can be one of several types. PRIMARY, ADDITIONAL_PRIMARY, SECONDARY, ROUTED_TO_VLAN, SECONDARY_ON_VLAN, STORAGE_NETWORK, and STATIC_IP_ROUTED. A PRIMARY subnet is the primary network that is bound to a VLAN within the IBM Cloud network. An ADDITIONAL_PRIMARY subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. A SECONDARY subnet is any of the secondary subnets bound to a VLAN interface. A ROUTED_TO_VLAN subnet is a portable subnet that can be routed to any server on a VLAN. A SECONDARY_ON_VLAN subnet also doesn't exist as a VLAN interface, but is routed directly to a VLAN instead of a single IP address.
    • subnet-size - (String) The size of the subnet for the VLAN.
    SubnetSize double
    SubnetType string
    Cidr float64
    (Integer) A subnet Classless Inter-Domain Routing prefix. The number in the range of 0 - 32 signifying the number of bits in a subnet mask.
    Gateway string
    (String) A subnet gateway address.
    Id float64
    (String) The ID of the virtual guest.
    Subnet string
    (String) The subnet for the VLAN.

    • subnet-type - (String) A subnet can be one of several types. PRIMARY, ADDITIONAL_PRIMARY, SECONDARY, ROUTED_TO_VLAN, SECONDARY_ON_VLAN, STORAGE_NETWORK, and STATIC_IP_ROUTED. A PRIMARY subnet is the primary network that is bound to a VLAN within the IBM Cloud network. An ADDITIONAL_PRIMARY subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. A SECONDARY subnet is any of the secondary subnets bound to a VLAN interface. A ROUTED_TO_VLAN subnet is a portable subnet that can be routed to any server on a VLAN. A SECONDARY_ON_VLAN subnet also doesn't exist as a VLAN interface, but is routed directly to a VLAN instead of a single IP address.
    • subnet-size - (String) The size of the subnet for the VLAN.
    SubnetSize float64
    SubnetType string
    cidr Double
    (Integer) A subnet Classless Inter-Domain Routing prefix. The number in the range of 0 - 32 signifying the number of bits in a subnet mask.
    gateway String
    (String) A subnet gateway address.
    id Double
    (String) The ID of the virtual guest.
    subnet String
    (String) The subnet for the VLAN.

    • subnet-type - (String) A subnet can be one of several types. PRIMARY, ADDITIONAL_PRIMARY, SECONDARY, ROUTED_TO_VLAN, SECONDARY_ON_VLAN, STORAGE_NETWORK, and STATIC_IP_ROUTED. A PRIMARY subnet is the primary network that is bound to a VLAN within the IBM Cloud network. An ADDITIONAL_PRIMARY subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. A SECONDARY subnet is any of the secondary subnets bound to a VLAN interface. A ROUTED_TO_VLAN subnet is a portable subnet that can be routed to any server on a VLAN. A SECONDARY_ON_VLAN subnet also doesn't exist as a VLAN interface, but is routed directly to a VLAN instead of a single IP address.
    • subnet-size - (String) The size of the subnet for the VLAN.
    subnetSize Double
    subnetType String
    cidr number
    (Integer) A subnet Classless Inter-Domain Routing prefix. The number in the range of 0 - 32 signifying the number of bits in a subnet mask.
    gateway string
    (String) A subnet gateway address.
    id number
    (String) The ID of the virtual guest.
    subnet string
    (String) The subnet for the VLAN.

    • subnet-type - (String) A subnet can be one of several types. PRIMARY, ADDITIONAL_PRIMARY, SECONDARY, ROUTED_TO_VLAN, SECONDARY_ON_VLAN, STORAGE_NETWORK, and STATIC_IP_ROUTED. A PRIMARY subnet is the primary network that is bound to a VLAN within the IBM Cloud network. An ADDITIONAL_PRIMARY subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. A SECONDARY subnet is any of the secondary subnets bound to a VLAN interface. A ROUTED_TO_VLAN subnet is a portable subnet that can be routed to any server on a VLAN. A SECONDARY_ON_VLAN subnet also doesn't exist as a VLAN interface, but is routed directly to a VLAN instead of a single IP address.
    • subnet-size - (String) The size of the subnet for the VLAN.
    subnetSize number
    subnetType string
    cidr float
    (Integer) A subnet Classless Inter-Domain Routing prefix. The number in the range of 0 - 32 signifying the number of bits in a subnet mask.
    gateway str
    (String) A subnet gateway address.
    id float
    (String) The ID of the virtual guest.
    subnet str
    (String) The subnet for the VLAN.

    • subnet-type - (String) A subnet can be one of several types. PRIMARY, ADDITIONAL_PRIMARY, SECONDARY, ROUTED_TO_VLAN, SECONDARY_ON_VLAN, STORAGE_NETWORK, and STATIC_IP_ROUTED. A PRIMARY subnet is the primary network that is bound to a VLAN within the IBM Cloud network. An ADDITIONAL_PRIMARY subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. A SECONDARY subnet is any of the secondary subnets bound to a VLAN interface. A ROUTED_TO_VLAN subnet is a portable subnet that can be routed to any server on a VLAN. A SECONDARY_ON_VLAN subnet also doesn't exist as a VLAN interface, but is routed directly to a VLAN instead of a single IP address.
    • subnet-size - (String) The size of the subnet for the VLAN.
    subnet_size float
    subnet_type str
    cidr Number
    (Integer) A subnet Classless Inter-Domain Routing prefix. The number in the range of 0 - 32 signifying the number of bits in a subnet mask.
    gateway String
    (String) A subnet gateway address.
    id Number
    (String) The ID of the virtual guest.
    subnet String
    (String) The subnet for the VLAN.

    • subnet-type - (String) A subnet can be one of several types. PRIMARY, ADDITIONAL_PRIMARY, SECONDARY, ROUTED_TO_VLAN, SECONDARY_ON_VLAN, STORAGE_NETWORK, and STATIC_IP_ROUTED. A PRIMARY subnet is the primary network that is bound to a VLAN within the IBM Cloud network. An ADDITIONAL_PRIMARY subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. A SECONDARY subnet is any of the secondary subnets bound to a VLAN interface. A ROUTED_TO_VLAN subnet is a portable subnet that can be routed to any server on a VLAN. A SECONDARY_ON_VLAN subnet also doesn't exist as a VLAN interface, but is routed directly to a VLAN instead of a single IP address.
    • subnet-size - (String) The size of the subnet for the VLAN.
    subnetSize Number
    subnetType String

    GetNetworkVlanVirtualGuest

    Domain string
    (String) The domain of the virtual guest.
    Hostname string
    (String) The hostname of the virtual guest.
    Id double
    (String) The ID of the virtual guest.
    Domain string
    (String) The domain of the virtual guest.
    Hostname string
    (String) The hostname of the virtual guest.
    Id float64
    (String) The ID of the virtual guest.
    domain String
    (String) The domain of the virtual guest.
    hostname String
    (String) The hostname of the virtual guest.
    id Double
    (String) The ID of the virtual guest.
    domain string
    (String) The domain of the virtual guest.
    hostname string
    (String) The hostname of the virtual guest.
    id number
    (String) The ID of the virtual guest.
    domain str
    (String) The domain of the virtual guest.
    hostname str
    (String) The hostname of the virtual guest.
    id float
    (String) The ID of the virtual guest.
    domain String
    (String) The domain of the virtual guest.
    hostname String
    (String) The hostname of the virtual guest.
    id Number
    (String) The ID of the virtual guest.

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm logo
    ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud