Oracle Cloud Infrastructure v3.9.0 published on Wednesday, Sep 24, 2025 by Pulumi
oci.Core.getVnicAttachments
This data source provides the list of Vnic Attachments in Oracle Cloud Infrastructure Core service.
Lists the VNIC attachments in the specified compartment. A VNIC attachment resides in the same compartment as the attached instance. The list can be filtered by instance, VNIC, or availability domain.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";
const testVnicAttachments = oci.Core.getVnicAttachments({
    compartmentId: compartmentId,
    availabilityDomain: vnicAttachmentAvailabilityDomain,
    instanceId: testInstance.id,
    vnicId: testVnic.id,
});
import pulumi
import pulumi_oci as oci
test_vnic_attachments = oci.Core.get_vnic_attachments(compartment_id=compartment_id,
    availability_domain=vnic_attachment_availability_domain,
    instance_id=test_instance["id"],
    vnic_id=test_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.GetVnicAttachments(ctx, &core.GetVnicAttachmentsArgs{
			CompartmentId:      compartmentId,
			AvailabilityDomain: pulumi.StringRef(vnicAttachmentAvailabilityDomain),
			InstanceId:         pulumi.StringRef(testInstance.Id),
			VnicId:             pulumi.StringRef(testVnic.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 testVnicAttachments = Oci.Core.GetVnicAttachments.Invoke(new()
    {
        CompartmentId = compartmentId,
        AvailabilityDomain = vnicAttachmentAvailabilityDomain,
        InstanceId = testInstance.Id,
        VnicId = testVnic.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.GetVnicAttachmentsArgs;
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 testVnicAttachments = CoreFunctions.getVnicAttachments(GetVnicAttachmentsArgs.builder()
            .compartmentId(compartmentId)
            .availabilityDomain(vnicAttachmentAvailabilityDomain)
            .instanceId(testInstance.id())
            .vnicId(testVnic.id())
            .build());
    }
}
variables:
  testVnicAttachments:
    fn::invoke:
      function: oci:Core:getVnicAttachments
      arguments:
        compartmentId: ${compartmentId}
        availabilityDomain: ${vnicAttachmentAvailabilityDomain}
        instanceId: ${testInstance.id}
        vnicId: ${testVnic.id}
Using getVnicAttachments
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 getVnicAttachments(args: GetVnicAttachmentsArgs, opts?: InvokeOptions): Promise<GetVnicAttachmentsResult>
function getVnicAttachmentsOutput(args: GetVnicAttachmentsOutputArgs, opts?: InvokeOptions): Output<GetVnicAttachmentsResult>def get_vnic_attachments(availability_domain: Optional[str] = None,
                         compartment_id: Optional[str] = None,
                         filters: Optional[Sequence[GetVnicAttachmentsFilter]] = None,
                         instance_id: Optional[str] = None,
                         vnic_id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetVnicAttachmentsResult
def get_vnic_attachments_output(availability_domain: Optional[pulumi.Input[str]] = None,
                         compartment_id: Optional[pulumi.Input[str]] = None,
                         filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVnicAttachmentsFilterArgs]]]] = None,
                         instance_id: Optional[pulumi.Input[str]] = None,
                         vnic_id: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetVnicAttachmentsResult]func GetVnicAttachments(ctx *Context, args *GetVnicAttachmentsArgs, opts ...InvokeOption) (*GetVnicAttachmentsResult, error)
func GetVnicAttachmentsOutput(ctx *Context, args *GetVnicAttachmentsOutputArgs, opts ...InvokeOption) GetVnicAttachmentsResultOutput> Note: This function is named GetVnicAttachments in the Go SDK.
public static class GetVnicAttachments 
{
    public static Task<GetVnicAttachmentsResult> InvokeAsync(GetVnicAttachmentsArgs args, InvokeOptions? opts = null)
    public static Output<GetVnicAttachmentsResult> Invoke(GetVnicAttachmentsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetVnicAttachmentsResult> getVnicAttachments(GetVnicAttachmentsArgs args, InvokeOptions options)
public static Output<GetVnicAttachmentsResult> getVnicAttachments(GetVnicAttachmentsArgs args, InvokeOptions options)
fn::invoke:
  function: oci:Core/getVnicAttachments:getVnicAttachments
  arguments:
    # arguments dictionaryThe following arguments are supported:
- CompartmentId string
- The OCID of the compartment.
- AvailabilityDomain string
- The name of the availability domain. Example: Uocm:PHX-AD-1
- Filters
List<GetVnic Attachments Filter> 
- InstanceId string
- The OCID of the instance.
- VnicId string
- The OCID of the VNIC.
- CompartmentId string
- The OCID of the compartment.
- AvailabilityDomain string
- The name of the availability domain. Example: Uocm:PHX-AD-1
- Filters
[]GetVnic Attachments Filter 
- InstanceId string
- The OCID of the instance.
- VnicId string
- The OCID of the VNIC.
- compartmentId String
- The OCID of the compartment.
- availabilityDomain String
- The name of the availability domain. Example: Uocm:PHX-AD-1
- filters
List<GetVnic Attachments Filter> 
- instanceId String
- The OCID of the instance.
- vnicId String
- The OCID of the VNIC.
- compartmentId string
- The OCID of the compartment.
- availabilityDomain string
- The name of the availability domain. Example: Uocm:PHX-AD-1
- filters
GetVnic Attachments Filter[] 
- instanceId string
- The OCID of the instance.
- vnicId string
- The OCID of the VNIC.
- compartment_id str
- The OCID of the compartment.
- availability_domain str
- The name of the availability domain. Example: Uocm:PHX-AD-1
- filters
Sequence[GetVnic Attachments Filter] 
- instance_id str
- The OCID of the instance.
- vnic_id str
- The OCID of the VNIC.
- compartmentId String
- The OCID of the compartment.
- availabilityDomain String
- The name of the availability domain. Example: Uocm:PHX-AD-1
- filters List<Property Map>
- instanceId String
- The OCID of the instance.
- vnicId String
- The OCID of the VNIC.
getVnicAttachments Result
The following output properties are available:
- CompartmentId string
- The OCID of the compartment the VNIC attachment is in, which is the same compartment the instance is in.
- Id string
- The provider-assigned unique ID for this managed resource.
- VnicAttachments List<GetVnic Attachments Vnic Attachment> 
- The list of vnic_attachments.
- AvailabilityDomain string
- The availability domain of the instance. Example: Uocm:PHX-AD-1
- Filters
List<GetVnic Attachments Filter> 
- InstanceId string
- The OCID of the instance.
- VnicId string
- The OCID of the VNIC. Available after the attachment process is complete.
- CompartmentId string
- The OCID of the compartment the VNIC attachment is in, which is the same compartment the instance is in.
- Id string
- The provider-assigned unique ID for this managed resource.
- VnicAttachments []GetVnic Attachments Vnic Attachment 
- The list of vnic_attachments.
- AvailabilityDomain string
- The availability domain of the instance. Example: Uocm:PHX-AD-1
- Filters
[]GetVnic Attachments Filter 
- InstanceId string
- The OCID of the instance.
- VnicId string
- The OCID of the VNIC. Available after the attachment process is complete.
- compartmentId String
- The OCID of the compartment the VNIC attachment is in, which is the same compartment the instance is in.
- id String
- The provider-assigned unique ID for this managed resource.
- vnicAttachments List<GetVnic Attachments Vnic Attachment> 
- The list of vnic_attachments.
- availabilityDomain String
- The availability domain of the instance. Example: Uocm:PHX-AD-1
- filters
List<GetVnic Attachments Filter> 
- instanceId String
- The OCID of the instance.
- vnicId String
- The OCID of the VNIC. Available after the attachment process is complete.
- compartmentId string
- The OCID of the compartment the VNIC attachment is in, which is the same compartment the instance is in.
- id string
- The provider-assigned unique ID for this managed resource.
- vnicAttachments GetVnic Attachments Vnic Attachment[] 
- The list of vnic_attachments.
- availabilityDomain string
- The availability domain of the instance. Example: Uocm:PHX-AD-1
- filters
GetVnic Attachments Filter[] 
- instanceId string
- The OCID of the instance.
- vnicId string
- The OCID of the VNIC. Available after the attachment process is complete.
- compartment_id str
- The OCID of the compartment the VNIC attachment is in, which is the same compartment the instance is in.
- id str
- The provider-assigned unique ID for this managed resource.
- vnic_attachments Sequence[GetVnic Attachments Vnic Attachment] 
- The list of vnic_attachments.
- availability_domain str
- The availability domain of the instance. Example: Uocm:PHX-AD-1
- filters
Sequence[GetVnic Attachments Filter] 
- instance_id str
- The OCID of the instance.
- vnic_id str
- The OCID of the VNIC. Available after the attachment process is complete.
- compartmentId String
- The OCID of the compartment the VNIC attachment is in, which is the same compartment the instance is in.
- id String
- The provider-assigned unique ID for this managed resource.
- vnicAttachments List<Property Map>
- The list of vnic_attachments.
- availabilityDomain String
- The availability domain of the instance. Example: Uocm:PHX-AD-1
- filters List<Property Map>
- instanceId String
- The OCID of the instance.
- vnicId String
- The OCID of the VNIC. Available after the attachment process is complete.
Supporting Types
GetVnicAttachmentsFilter   
GetVnicAttachmentsVnicAttachment    
- AvailabilityDomain string
- The name of the availability domain. Example: Uocm:PHX-AD-1
- CompartmentId string
- The OCID of the compartment.
- CreateVnic List<GetDetails Vnic Attachments Vnic Attachment Create Vnic Detail> 
- DisplayName string
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- Id string
- The OCID of the VNIC attachment.
- InstanceId string
- The OCID of the instance.
- NicIndex int
- Which physical network interface card (NIC) the VNIC uses. Certain bare metal instance shapes have two active physical NICs (0 and 1). If you add a secondary VNIC to one of these instances, you can specify which NIC the VNIC will use. For more information, see Virtual Network Interface Cards (VNICs).
- State string
- The current state of the VNIC attachment.
- SubnetId string
- The OCID of the subnet to create the VNIC in.
- TimeCreated string
- The date and time the VNIC attachment was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- VlanId string
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- VlanTag int
- The Oracle-assigned VLAN tag of the attached VNIC. Available after the attachment process is complete.
- VnicId string
- The OCID of the VNIC.
- AvailabilityDomain string
- The name of the availability domain. Example: Uocm:PHX-AD-1
- CompartmentId string
- The OCID of the compartment.
- CreateVnic []GetDetails Vnic Attachments Vnic Attachment Create Vnic Detail 
- DisplayName string
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- Id string
- The OCID of the VNIC attachment.
- InstanceId string
- The OCID of the instance.
- NicIndex int
- Which physical network interface card (NIC) the VNIC uses. Certain bare metal instance shapes have two active physical NICs (0 and 1). If you add a secondary VNIC to one of these instances, you can specify which NIC the VNIC will use. For more information, see Virtual Network Interface Cards (VNICs).
- State string
- The current state of the VNIC attachment.
- SubnetId string
- The OCID of the subnet to create the VNIC in.
- TimeCreated string
- The date and time the VNIC attachment was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- VlanId string
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- VlanTag int
- The Oracle-assigned VLAN tag of the attached VNIC. Available after the attachment process is complete.
- VnicId string
- The OCID of the VNIC.
- availabilityDomain String
- The name of the availability domain. Example: Uocm:PHX-AD-1
- compartmentId String
- The OCID of the compartment.
- createVnic List<GetDetails Vnic Attachments Vnic Attachment Create Vnic Detail> 
- displayName String
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- id String
- The OCID of the VNIC attachment.
- instanceId String
- The OCID of the instance.
- nicIndex Integer
- Which physical network interface card (NIC) the VNIC uses. Certain bare metal instance shapes have two active physical NICs (0 and 1). If you add a secondary VNIC to one of these instances, you can specify which NIC the VNIC will use. For more information, see Virtual Network Interface Cards (VNICs).
- state String
- The current state of the VNIC attachment.
- subnetId String
- The OCID of the subnet to create the VNIC in.
- timeCreated String
- The date and time the VNIC attachment was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- vlanId String
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- vlanTag Integer
- The Oracle-assigned VLAN tag of the attached VNIC. Available after the attachment process is complete.
- vnicId String
- The OCID of the VNIC.
- availabilityDomain string
- The name of the availability domain. Example: Uocm:PHX-AD-1
- compartmentId string
- The OCID of the compartment.
- createVnic GetDetails Vnic Attachments Vnic Attachment Create Vnic Detail[] 
- displayName string
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- id string
- The OCID of the VNIC attachment.
- instanceId string
- The OCID of the instance.
- nicIndex number
- Which physical network interface card (NIC) the VNIC uses. Certain bare metal instance shapes have two active physical NICs (0 and 1). If you add a secondary VNIC to one of these instances, you can specify which NIC the VNIC will use. For more information, see Virtual Network Interface Cards (VNICs).
- state string
- The current state of the VNIC attachment.
- subnetId string
- The OCID of the subnet to create the VNIC in.
- timeCreated string
- The date and time the VNIC attachment was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- vlanId string
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- vlanTag number
- The Oracle-assigned VLAN tag of the attached VNIC. Available after the attachment process is complete.
- vnicId string
- The OCID of the VNIC.
- availability_domain str
- The name of the availability domain. Example: Uocm:PHX-AD-1
- compartment_id str
- The OCID of the compartment.
- create_vnic_ Sequence[Getdetails Vnic Attachments Vnic Attachment Create Vnic Detail] 
- display_name str
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- id str
- The OCID of the VNIC attachment.
- instance_id str
- The OCID of the instance.
- nic_index int
- Which physical network interface card (NIC) the VNIC uses. Certain bare metal instance shapes have two active physical NICs (0 and 1). If you add a secondary VNIC to one of these instances, you can specify which NIC the VNIC will use. For more information, see Virtual Network Interface Cards (VNICs).
- state str
- The current state of the VNIC attachment.
- subnet_id str
- The OCID of the subnet to create the VNIC in.
- time_created str
- The date and time the VNIC attachment was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- vlan_id str
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- vlan_tag int
- The Oracle-assigned VLAN tag of the attached VNIC. Available after the attachment process is complete.
- vnic_id str
- The OCID of the VNIC.
- availabilityDomain String
- The name of the availability domain. Example: Uocm:PHX-AD-1
- compartmentId String
- The OCID of the compartment.
- createVnic List<Property Map>Details 
- displayName String
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- id String
- The OCID of the VNIC attachment.
- instanceId String
- The OCID of the instance.
- nicIndex Number
- Which physical network interface card (NIC) the VNIC uses. Certain bare metal instance shapes have two active physical NICs (0 and 1). If you add a secondary VNIC to one of these instances, you can specify which NIC the VNIC will use. For more information, see Virtual Network Interface Cards (VNICs).
- state String
- The current state of the VNIC attachment.
- subnetId String
- The OCID of the subnet to create the VNIC in.
- timeCreated String
- The date and time the VNIC attachment was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
- vlanId String
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- vlanTag Number
- The Oracle-assigned VLAN tag of the attached VNIC. Available after the attachment process is complete.
- vnicId String
- The OCID of the VNIC.
GetVnicAttachmentsVnicAttachmentCreateVnicDetail       
- AssignIpv6ip bool
- AssignPrivate boolDns Record 
- AssignPublic stringIp 
- Dictionary<string, string>
- DisplayName string
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- Dictionary<string, string>
- HostnameLabel string
- Ipv6addressIpv6subnet List<GetCidr Pair Details Vnic Attachments Vnic Attachment Create Vnic Detail Ipv6address Ipv6subnet Cidr Pair Detail> 
- NsgIds List<string>
- PrivateIp string
- RouteTable stringId 
- SecurityAttributes Dictionary<string, string>
- SkipSource boolDest Check 
- SubnetId string
- The OCID of the subnet to create the VNIC in.
- VlanId string
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- AssignIpv6ip bool
- AssignPrivate boolDns Record 
- AssignPublic stringIp 
- map[string]string
- DisplayName string
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- map[string]string
- HostnameLabel string
- Ipv6addressIpv6subnet []GetCidr Pair Details Vnic Attachments Vnic Attachment Create Vnic Detail Ipv6address Ipv6subnet Cidr Pair Detail 
- NsgIds []string
- PrivateIp string
- RouteTable stringId 
- SecurityAttributes map[string]string
- SkipSource boolDest Check 
- SubnetId string
- The OCID of the subnet to create the VNIC in.
- VlanId string
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- assignIpv6ip Boolean
- assignPrivate BooleanDns Record 
- assignPublic StringIp 
- Map<String,String>
- displayName String
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- Map<String,String>
- hostnameLabel String
- ipv6addressIpv6subnet List<GetCidr Pair Details Vnic Attachments Vnic Attachment Create Vnic Detail Ipv6address Ipv6subnet Cidr Pair Detail> 
- nsgIds List<String>
- privateIp String
- routeTable StringId 
- securityAttributes Map<String,String>
- skipSource BooleanDest Check 
- subnetId String
- The OCID of the subnet to create the VNIC in.
- vlanId String
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- assignIpv6ip boolean
- assignPrivate booleanDns Record 
- assignPublic stringIp 
- {[key: string]: string}
- displayName string
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- {[key: string]: string}
- hostnameLabel string
- ipv6addressIpv6subnet GetCidr Pair Details Vnic Attachments Vnic Attachment Create Vnic Detail Ipv6address Ipv6subnet Cidr Pair Detail[] 
- nsgIds string[]
- privateIp string
- routeTable stringId 
- securityAttributes {[key: string]: string}
- skipSource booleanDest Check 
- subnetId string
- The OCID of the subnet to create the VNIC in.
- vlanId string
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- assign_ipv6ip bool
- assign_private_ booldns_ record 
- assign_public_ strip 
- Mapping[str, str]
- display_name str
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- Mapping[str, str]
- hostname_label str
- ipv6address_ipv6subnet_ Sequence[Getcidr_ pair_ details Vnic Attachments Vnic Attachment Create Vnic Detail Ipv6address Ipv6subnet Cidr Pair Detail] 
- nsg_ids Sequence[str]
- private_ip str
- route_table_ strid 
- security_attributes Mapping[str, str]
- skip_source_ booldest_ check 
- subnet_id str
- The OCID of the subnet to create the VNIC in.
- vlan_id str
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
- assignIpv6ip Boolean
- assignPrivate BooleanDns Record 
- assignPublic StringIp 
- Map<String>
- displayName String
- A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- Map<String>
- hostnameLabel String
- ipv6addressIpv6subnet List<Property Map>Cidr Pair Details 
- nsgIds List<String>
- privateIp String
- routeTable StringId 
- securityAttributes Map<String>
- skipSource BooleanDest Check 
- subnetId String
- The OCID of the subnet to create the VNIC in.
- vlanId String
- The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See Vlan.
GetVnicAttachmentsVnicAttachmentCreateVnicDetailIpv6addressIpv6subnetCidrPairDetail            
- Ipv6Address string
- Ipv6SubnetCidr string
- Ipv6Address string
- Ipv6SubnetCidr string
- ipv6Address String
- ipv6SubnetCidr String
- ipv6Address string
- ipv6SubnetCidr string
- ipv6_address str
- ipv6_subnet_ strcidr 
- ipv6Address String
- ipv6SubnetCidr String
Package Details
- Repository
- oci pulumi/pulumi-oci
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the ociTerraform Provider.
