ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud
ibm.getNetworkVlan
Explore with Pulumi AI
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.
- Router
Hostname 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.
- Router
Hostname 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.
- router
Hostname 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.
- router
Hostname 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.
- router
Hostname 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
- Router
Hostname string - Subnets
List<Get
Network Vlan Subnet> - (List of Objects) The collection of subnets associated with the VLAN.
- Virtual
Guests List<GetNetwork Vlan Virtual Guest> - (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
- Router
Hostname string - Subnets
[]Get
Network Vlan Subnet - (List of Objects) The collection of subnets associated with the VLAN.
- Virtual
Guests []GetNetwork Vlan Virtual Guest - (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
- router
Hostname String - subnets
List<Get
Network Vlan Subnet> - (List of Objects) The collection of subnets associated with the VLAN.
- virtual
Guests List<GetNetwork Vlan Virtual Guest> - (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
- router
Hostname string - subnets
Get
Network Vlan Subnet[] - (List of Objects) The collection of subnets associated with the VLAN.
- virtual
Guests GetNetwork Vlan Virtual Guest[] - (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[Get
Network Vlan Subnet] - (List of Objects) The collection of subnets associated with the VLAN.
- virtual_
guests Sequence[GetNetwork Vlan Virtual Guest] - (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
- router
Hostname String - subnets List<Property Map>
- (List of Objects) The collection of subnets associated with the VLAN.
- virtual
Guests 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
. APRIMARY
subnet is the primary network that is bound to a VLAN within the IBM Cloud network. AnADDITIONAL_PRIMARY
subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. ASECONDARY
subnet is any of the secondary subnets bound to a VLAN interface. AROUTED_TO_VLAN
subnet is a portable subnet that can be routed to any server on a VLAN. ASECONDARY_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 double - Subnet
Type 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
. APRIMARY
subnet is the primary network that is bound to a VLAN within the IBM Cloud network. AnADDITIONAL_PRIMARY
subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. ASECONDARY
subnet is any of the secondary subnets bound to a VLAN interface. AROUTED_TO_VLAN
subnet is a portable subnet that can be routed to any server on a VLAN. ASECONDARY_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 float64 - Subnet
Type 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
. APRIMARY
subnet is the primary network that is bound to a VLAN within the IBM Cloud network. AnADDITIONAL_PRIMARY
subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. ASECONDARY
subnet is any of the secondary subnets bound to a VLAN interface. AROUTED_TO_VLAN
subnet is a portable subnet that can be routed to any server on a VLAN. ASECONDARY_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 Double - subnet
Type 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
. APRIMARY
subnet is the primary network that is bound to a VLAN within the IBM Cloud network. AnADDITIONAL_PRIMARY
subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. ASECONDARY
subnet is any of the secondary subnets bound to a VLAN interface. AROUTED_TO_VLAN
subnet is a portable subnet that can be routed to any server on a VLAN. ASECONDARY_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 number - subnet
Type 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
. APRIMARY
subnet is the primary network that is bound to a VLAN within the IBM Cloud network. AnADDITIONAL_PRIMARY
subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. ASECONDARY
subnet is any of the secondary subnets bound to a VLAN interface. AROUTED_TO_VLAN
subnet is a portable subnet that can be routed to any server on a VLAN. ASECONDARY_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
. APRIMARY
subnet is the primary network that is bound to a VLAN within the IBM Cloud network. AnADDITIONAL_PRIMARY
subnet is bound to a network VLAN to augment the pool of available primary IP addresses that might be assigned to a server. ASECONDARY
subnet is any of the secondary subnets bound to a VLAN interface. AROUTED_TO_VLAN
subnet is a portable subnet that can be routed to any server on a VLAN. ASECONDARY_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 Number - subnet
Type String
GetNetworkVlanVirtualGuest
Package Details
- Repository
- ibm ibm-cloud/terraform-provider-ibm
- License
- Notes
- This Pulumi package is based on the
ibm
Terraform Provider.