Oracle Cloud Infrastructure v3.9.0 published on Wednesday, Sep 24, 2025 by Pulumi
oci.Core.getVnic
This data source provides details about a specific Vnic resource in Oracle Cloud Infrastructure Core service.
Gets the information for the specified virtual network interface card (VNIC). You can get the VNIC OCID from the ListVnicAttachments operation.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";
const testVnic = oci.Core.getVnic({
    vnicId: testVnicOciCoreVnic.id,
});
import pulumi
import pulumi_oci as oci
test_vnic = oci.Core.get_vnic(vnic_id=test_vnic_oci_core_vnic["id"])
package main
import (
	"github.com/pulumi/pulumi-oci/sdk/v3/go/oci/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := core.GetVnic(ctx, &core.GetVnicArgs{
			VnicId: testVnicOciCoreVnic.Id,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;
return await Deployment.RunAsync(() => 
{
    var testVnic = Oci.Core.GetVnic.Invoke(new()
    {
        VnicId = testVnicOciCoreVnic.Id,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Core.CoreFunctions;
import com.pulumi.oci.Core.inputs.GetVnicArgs;
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 testVnic = CoreFunctions.getVnic(GetVnicArgs.builder()
            .vnicId(testVnicOciCoreVnic.id())
            .build());
    }
}
variables:
  testVnic:
    fn::invoke:
      function: oci:Core:getVnic
      arguments:
        vnicId: ${testVnicOciCoreVnic.id}
Using getVnic
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 getVnic(args: GetVnicArgs, opts?: InvokeOptions): Promise<GetVnicResult>
function getVnicOutput(args: GetVnicOutputArgs, opts?: InvokeOptions): Output<GetVnicResult>def get_vnic(vnic_id: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetVnicResult
def get_vnic_output(vnic_id: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetVnicResult]func GetVnic(ctx *Context, args *GetVnicArgs, opts ...InvokeOption) (*GetVnicResult, error)
func GetVnicOutput(ctx *Context, args *GetVnicOutputArgs, opts ...InvokeOption) GetVnicResultOutput> Note: This function is named GetVnic in the Go SDK.
public static class GetVnic 
{
    public static Task<GetVnicResult> InvokeAsync(GetVnicArgs args, InvokeOptions? opts = null)
    public static Output<GetVnicResult> Invoke(GetVnicInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetVnicResult> getVnic(GetVnicArgs args, InvokeOptions options)
public static Output<GetVnicResult> getVnic(GetVnicArgs args, InvokeOptions options)
fn::invoke:
  function: oci:Core/getVnic:getVnic
  arguments:
    # arguments dictionaryThe following arguments are supported:
getVnic Result
The following output properties are available:
- AvailabilityDomain string
- The VNIC's availability domain. Example: Uocm:PHX-AD-1
- CompartmentId string
- The OCID of the compartment containing the VNIC.
- Dictionary<string, string>
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
- DisplayName string
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- Dictionary<string, string>
- Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
- HostnameLabel string
- The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, bminstance1in FQDNbminstance1.subnet123.vcn1.oraclevcn.com). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipv6addresses List<string>
- List of IPv6 addresses assigned to the VNIC. Example: 2001:DB8::
- IsPrimary bool
- Whether the VNIC is the primary VNIC (the VNIC that is automatically created and attached during instance launch).
- MacAddress string
- The MAC address of the VNIC.
- NsgIds List<string>
- A list of the OCIDs of the network security groups that the VNIC belongs to.
- PrivateIp stringAddress 
- The private IP address of the primary privateIpobject on the VNIC. The address is within the CIDR of the VNIC's subnet. Example:10.0.3.3
- PublicIp stringAddress 
- The public IP address of the VNIC, if one is assigned.
- RouteTable stringId 
- The OCID of the route table the IP address or VNIC will use. For more information, see Source Based Routing.
- SecurityAttributes Dictionary<string, string>
- Security attributes are labels for a resource that can be referenced in a Zero Trust Packet Routing (ZPR) policy to control access to ZPR-supported resources. Example: {"Oracle-DataSecurity-ZPR": {"MaxEgressCount": {"value":"42","mode":"audit"}}}
- SkipSource boolDest Check 
- Whether the source/destination check is disabled on the VNIC. Defaults to false, which means the check is performed. For information about why you would skip the source/destination check, see Using a Private IP as a Route Target.
- State string
- The current state of the VNIC.
- SubnetId string
- The OCID of the subnet the VNIC is in.
- TimeCreated string
- The date and time the VNIC was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- VlanId string
- If the VNIC belongs to a VLAN as part of the Oracle Cloud VMware Solution (instead of belonging to a subnet), the vlanIdis the OCID of the VLAN the VNIC is in. See Vlan. If the VNIC is instead in a subnet,subnetIdhas a value.
- VnicId string
- AvailabilityDomain string
- The VNIC's availability domain. Example: Uocm:PHX-AD-1
- CompartmentId string
- The OCID of the compartment containing the VNIC.
- map[string]string
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
- DisplayName string
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- map[string]string
- Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
- HostnameLabel string
- The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, bminstance1in FQDNbminstance1.subnet123.vcn1.oraclevcn.com). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipv6addresses []string
- List of IPv6 addresses assigned to the VNIC. Example: 2001:DB8::
- IsPrimary bool
- Whether the VNIC is the primary VNIC (the VNIC that is automatically created and attached during instance launch).
- MacAddress string
- The MAC address of the VNIC.
- NsgIds []string
- A list of the OCIDs of the network security groups that the VNIC belongs to.
- PrivateIp stringAddress 
- The private IP address of the primary privateIpobject on the VNIC. The address is within the CIDR of the VNIC's subnet. Example:10.0.3.3
- PublicIp stringAddress 
- The public IP address of the VNIC, if one is assigned.
- RouteTable stringId 
- The OCID of the route table the IP address or VNIC will use. For more information, see Source Based Routing.
- SecurityAttributes map[string]string
- Security attributes are labels for a resource that can be referenced in a Zero Trust Packet Routing (ZPR) policy to control access to ZPR-supported resources. Example: {"Oracle-DataSecurity-ZPR": {"MaxEgressCount": {"value":"42","mode":"audit"}}}
- SkipSource boolDest Check 
- Whether the source/destination check is disabled on the VNIC. Defaults to false, which means the check is performed. For information about why you would skip the source/destination check, see Using a Private IP as a Route Target.
- State string
- The current state of the VNIC.
- SubnetId string
- The OCID of the subnet the VNIC is in.
- TimeCreated string
- The date and time the VNIC was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- VlanId string
- If the VNIC belongs to a VLAN as part of the Oracle Cloud VMware Solution (instead of belonging to a subnet), the vlanIdis the OCID of the VLAN the VNIC is in. See Vlan. If the VNIC is instead in a subnet,subnetIdhas a value.
- VnicId string
- availabilityDomain String
- The VNIC's availability domain. Example: Uocm:PHX-AD-1
- compartmentId String
- The OCID of the compartment containing the VNIC.
- Map<String,String>
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
- displayName String
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- Map<String,String>
- Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
- hostnameLabel String
- The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, bminstance1in FQDNbminstance1.subnet123.vcn1.oraclevcn.com). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.
- id String
- The provider-assigned unique ID for this managed resource.
- ipv6addresses List<String>
- List of IPv6 addresses assigned to the VNIC. Example: 2001:DB8::
- isPrimary Boolean
- Whether the VNIC is the primary VNIC (the VNIC that is automatically created and attached during instance launch).
- macAddress String
- The MAC address of the VNIC.
- nsgIds List<String>
- A list of the OCIDs of the network security groups that the VNIC belongs to.
- privateIp StringAddress 
- The private IP address of the primary privateIpobject on the VNIC. The address is within the CIDR of the VNIC's subnet. Example:10.0.3.3
- publicIp StringAddress 
- The public IP address of the VNIC, if one is assigned.
- routeTable StringId 
- The OCID of the route table the IP address or VNIC will use. For more information, see Source Based Routing.
- securityAttributes Map<String,String>
- Security attributes are labels for a resource that can be referenced in a Zero Trust Packet Routing (ZPR) policy to control access to ZPR-supported resources. Example: {"Oracle-DataSecurity-ZPR": {"MaxEgressCount": {"value":"42","mode":"audit"}}}
- skipSource BooleanDest Check 
- Whether the source/destination check is disabled on the VNIC. Defaults to false, which means the check is performed. For information about why you would skip the source/destination check, see Using a Private IP as a Route Target.
- state String
- The current state of the VNIC.
- subnetId String
- The OCID of the subnet the VNIC is in.
- timeCreated String
- The date and time the VNIC was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- vlanId String
- If the VNIC belongs to a VLAN as part of the Oracle Cloud VMware Solution (instead of belonging to a subnet), the vlanIdis the OCID of the VLAN the VNIC is in. See Vlan. If the VNIC is instead in a subnet,subnetIdhas a value.
- vnicId String
- availabilityDomain string
- The VNIC's availability domain. Example: Uocm:PHX-AD-1
- compartmentId string
- The OCID of the compartment containing the VNIC.
- {[key: string]: string}
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
- displayName string
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- {[key: string]: string}
- Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
- hostnameLabel string
- The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, bminstance1in FQDNbminstance1.subnet123.vcn1.oraclevcn.com). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.
- id string
- The provider-assigned unique ID for this managed resource.
- ipv6addresses string[]
- List of IPv6 addresses assigned to the VNIC. Example: 2001:DB8::
- isPrimary boolean
- Whether the VNIC is the primary VNIC (the VNIC that is automatically created and attached during instance launch).
- macAddress string
- The MAC address of the VNIC.
- nsgIds string[]
- A list of the OCIDs of the network security groups that the VNIC belongs to.
- privateIp stringAddress 
- The private IP address of the primary privateIpobject on the VNIC. The address is within the CIDR of the VNIC's subnet. Example:10.0.3.3
- publicIp stringAddress 
- The public IP address of the VNIC, if one is assigned.
- routeTable stringId 
- The OCID of the route table the IP address or VNIC will use. For more information, see Source Based Routing.
- securityAttributes {[key: string]: string}
- Security attributes are labels for a resource that can be referenced in a Zero Trust Packet Routing (ZPR) policy to control access to ZPR-supported resources. Example: {"Oracle-DataSecurity-ZPR": {"MaxEgressCount": {"value":"42","mode":"audit"}}}
- skipSource booleanDest Check 
- Whether the source/destination check is disabled on the VNIC. Defaults to false, which means the check is performed. For information about why you would skip the source/destination check, see Using a Private IP as a Route Target.
- state string
- The current state of the VNIC.
- subnetId string
- The OCID of the subnet the VNIC is in.
- timeCreated string
- The date and time the VNIC was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- vlanId string
- If the VNIC belongs to a VLAN as part of the Oracle Cloud VMware Solution (instead of belonging to a subnet), the vlanIdis the OCID of the VLAN the VNIC is in. See Vlan. If the VNIC is instead in a subnet,subnetIdhas a value.
- vnicId string
- availability_domain str
- The VNIC's availability domain. Example: Uocm:PHX-AD-1
- compartment_id str
- The OCID of the compartment containing the VNIC.
- Mapping[str, str]
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
- display_name str
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- Mapping[str, str]
- Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
- hostname_label str
- The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, bminstance1in FQDNbminstance1.subnet123.vcn1.oraclevcn.com). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.
- id str
- The provider-assigned unique ID for this managed resource.
- ipv6addresses Sequence[str]
- List of IPv6 addresses assigned to the VNIC. Example: 2001:DB8::
- is_primary bool
- Whether the VNIC is the primary VNIC (the VNIC that is automatically created and attached during instance launch).
- mac_address str
- The MAC address of the VNIC.
- nsg_ids Sequence[str]
- A list of the OCIDs of the network security groups that the VNIC belongs to.
- private_ip_ straddress 
- The private IP address of the primary privateIpobject on the VNIC. The address is within the CIDR of the VNIC's subnet. Example:10.0.3.3
- public_ip_ straddress 
- The public IP address of the VNIC, if one is assigned.
- route_table_ strid 
- The OCID of the route table the IP address or VNIC will use. For more information, see Source Based Routing.
- security_attributes Mapping[str, str]
- Security attributes are labels for a resource that can be referenced in a Zero Trust Packet Routing (ZPR) policy to control access to ZPR-supported resources. Example: {"Oracle-DataSecurity-ZPR": {"MaxEgressCount": {"value":"42","mode":"audit"}}}
- skip_source_ booldest_ check 
- Whether the source/destination check is disabled on the VNIC. Defaults to false, which means the check is performed. For information about why you would skip the source/destination check, see Using a Private IP as a Route Target.
- state str
- The current state of the VNIC.
- subnet_id str
- The OCID of the subnet the VNIC is in.
- time_created str
- The date and time the VNIC was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- vlan_id str
- If the VNIC belongs to a VLAN as part of the Oracle Cloud VMware Solution (instead of belonging to a subnet), the vlanIdis the OCID of the VLAN the VNIC is in. See Vlan. If the VNIC is instead in a subnet,subnetIdhas a value.
- vnic_id str
- availabilityDomain String
- The VNIC's availability domain. Example: Uocm:PHX-AD-1
- compartmentId String
- The OCID of the compartment containing the VNIC.
- Map<String>
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
- displayName String
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- Map<String>
- Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
- hostnameLabel String
- The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, bminstance1in FQDNbminstance1.subnet123.vcn1.oraclevcn.com). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.
- id String
- The provider-assigned unique ID for this managed resource.
- ipv6addresses List<String>
- List of IPv6 addresses assigned to the VNIC. Example: 2001:DB8::
- isPrimary Boolean
- Whether the VNIC is the primary VNIC (the VNIC that is automatically created and attached during instance launch).
- macAddress String
- The MAC address of the VNIC.
- nsgIds List<String>
- A list of the OCIDs of the network security groups that the VNIC belongs to.
- privateIp StringAddress 
- The private IP address of the primary privateIpobject on the VNIC. The address is within the CIDR of the VNIC's subnet. Example:10.0.3.3
- publicIp StringAddress 
- The public IP address of the VNIC, if one is assigned.
- routeTable StringId 
- The OCID of the route table the IP address or VNIC will use. For more information, see Source Based Routing.
- securityAttributes Map<String>
- Security attributes are labels for a resource that can be referenced in a Zero Trust Packet Routing (ZPR) policy to control access to ZPR-supported resources. Example: {"Oracle-DataSecurity-ZPR": {"MaxEgressCount": {"value":"42","mode":"audit"}}}
- skipSource BooleanDest Check 
- Whether the source/destination check is disabled on the VNIC. Defaults to false, which means the check is performed. For information about why you would skip the source/destination check, see Using a Private IP as a Route Target.
- state String
- The current state of the VNIC.
- subnetId String
- The OCID of the subnet the VNIC is in.
- timeCreated String
- The date and time the VNIC was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- vlanId String
- If the VNIC belongs to a VLAN as part of the Oracle Cloud VMware Solution (instead of belonging to a subnet), the vlanIdis the OCID of the VLAN the VNIC is in. See Vlan. If the VNIC is instead in a subnet,subnetIdhas a value.
- vnicId String
Package Details
- Repository
- oci pulumi/pulumi-oci
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the ociTerraform Provider.
