1. Packages
  2. Ionoscloud Provider
  3. API Docs
  4. getNic
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

ionoscloud.getNic

Explore with Pulumi AI

ionoscloud logo
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

    The Nic data source can be used to search for and return existing nics. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.

    Example Usage

    By ID

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getNic({
        datacenterId: "datancenter_id",
        id: "nic_id",
        serverId: "server_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_nic(datacenter_id="datancenter_id",
        id="nic_id",
        server_id="server_id")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ionoscloud.LookupNic(ctx, &ionoscloud.LookupNicArgs{
    			DatacenterId: "datancenter_id",
    			Id:           pulumi.StringRef("nic_id"),
    			ServerId:     "server_id",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetNic.Invoke(new()
        {
            DatacenterId = "datancenter_id",
            Id = "nic_id",
            ServerId = "server_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetNicArgs;
    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 example = IonoscloudFunctions.getNic(GetNicArgs.builder()
                .datacenterId("datancenter_id")
                .id("nic_id")
                .serverId("server_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getNic
          arguments:
            datacenterId: datancenter_id
            id: nic_id
            serverId: server_id
    

    By Name

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getNic({
        datacenterId: "datancenter_id",
        name: "Nic Example",
        serverId: "server_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_nic(datacenter_id="datancenter_id",
        name="Nic Example",
        server_id="server_id")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ionoscloud.LookupNic(ctx, &ionoscloud.LookupNicArgs{
    			DatacenterId: "datancenter_id",
    			Name:         pulumi.StringRef("Nic Example"),
    			ServerId:     "server_id",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetNic.Invoke(new()
        {
            DatacenterId = "datancenter_id",
            Name = "Nic Example",
            ServerId = "server_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetNicArgs;
    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 example = IonoscloudFunctions.getNic(GetNicArgs.builder()
                .datacenterId("datancenter_id")
                .name("Nic Example")
                .serverId("server_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getNic
          arguments:
            datacenterId: datancenter_id
            name: Nic Example
            serverId: server_id
    

    Using getNic

    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 getNic(args: GetNicArgs, opts?: InvokeOptions): Promise<GetNicResult>
    function getNicOutput(args: GetNicOutputArgs, opts?: InvokeOptions): Output<GetNicResult>
    def get_nic(datacenter_id: Optional[str] = None,
                id: Optional[str] = None,
                name: Optional[str] = None,
                server_id: Optional[str] = None,
                timeouts: Optional[GetNicTimeouts] = None,
                opts: Optional[InvokeOptions] = None) -> GetNicResult
    def get_nic_output(datacenter_id: Optional[pulumi.Input[str]] = None,
                id: Optional[pulumi.Input[str]] = None,
                name: Optional[pulumi.Input[str]] = None,
                server_id: Optional[pulumi.Input[str]] = None,
                timeouts: Optional[pulumi.Input[GetNicTimeoutsArgs]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetNicResult]
    func LookupNic(ctx *Context, args *LookupNicArgs, opts ...InvokeOption) (*LookupNicResult, error)
    func LookupNicOutput(ctx *Context, args *LookupNicOutputArgs, opts ...InvokeOption) LookupNicResultOutput

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

    public static class GetNic 
    {
        public static Task<GetNicResult> InvokeAsync(GetNicArgs args, InvokeOptions? opts = null)
        public static Output<GetNicResult> Invoke(GetNicInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNicResult> getNic(GetNicArgs args, InvokeOptions options)
    public static Output<GetNicResult> getNic(GetNicArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:index/getNic:getNic
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DatacenterId string
    [string] The ID of a Virtual Data Center.
    ServerId string
    [string] The ID of a server.
    Id string

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    Name string
    [string] The name of the LAN.
    Timeouts GetNicTimeouts
    DatacenterId string
    [string] The ID of a Virtual Data Center.
    ServerId string
    [string] The ID of a server.
    Id string

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    Name string
    [string] The name of the LAN.
    Timeouts GetNicTimeouts
    datacenterId String
    [string] The ID of a Virtual Data Center.
    serverId String
    [string] The ID of a server.
    id String

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    name String
    [string] The name of the LAN.
    timeouts GetNicTimeouts
    datacenterId string
    [string] The ID of a Virtual Data Center.
    serverId string
    [string] The ID of a server.
    id string

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    name string
    [string] The name of the LAN.
    timeouts GetNicTimeouts
    datacenter_id str
    [string] The ID of a Virtual Data Center.
    server_id str
    [string] The ID of a server.
    id str

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    name str
    [string] The name of the LAN.
    timeouts GetNicTimeouts
    datacenterId String
    [string] The ID of a Virtual Data Center.
    serverId String
    [string] The ID of a server.
    id String

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    name String
    [string] The name of the LAN.
    timeouts Property Map

    getNic Result

    The following output properties are available:

    DatacenterId string
    The ID of a Virtual Data Center.
    DeviceNumber double
    The Logical Unit Number (LUN) of the storage volume. Null if this NIC was created from CloudAPI and no DCD changes were done on the Datacenter.
    Dhcp bool
    Indicates if the NIC should get an IP address using DHCP (true) or not (false).
    Dhcpv6 bool
    FirewallActive bool
    If this resource is set to true and is nested under a server resource firewall, with open SSH port, resource must be nested under the NIC.
    FirewallType string
    The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the default value INGRESS
    Flowlogs List<GetNicFlowlog>
    Only 1 flow log can be configured. Only the name field can change as part of an update. Flow logs holistically capture network information such as source and destination IP addresses, source and destination ports, number of packets, amount of bytes, the start and end time of the recording, and the type of protocol – and log the extent to which your instances are being accessed.
    Id string
    The id of the NIC.
    Ips List<string>
    Collection of IP addresses assigned to a nic. Explicitly assigned public IPs need to come from reserved IP blocks, Passing value null or empty array will assign an IP address automatically.
    Ipv6CidrBlock string
    Ipv6Ips List<string>
    Lan double
    The LAN ID the NIC will sit on.
    Mac string
    The MAC address of the NIC.
    Name string
    Specifies the name of the flow log.
    PciSlot double
    The PCI slot number of the Nic.
    SecurityGroupsIds List<string>
    The list of Security Group IDs for the resource.
    ServerId string
    The ID of a server.
    Timeouts GetNicTimeouts
    DatacenterId string
    The ID of a Virtual Data Center.
    DeviceNumber float64
    The Logical Unit Number (LUN) of the storage volume. Null if this NIC was created from CloudAPI and no DCD changes were done on the Datacenter.
    Dhcp bool
    Indicates if the NIC should get an IP address using DHCP (true) or not (false).
    Dhcpv6 bool
    FirewallActive bool
    If this resource is set to true and is nested under a server resource firewall, with open SSH port, resource must be nested under the NIC.
    FirewallType string
    The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the default value INGRESS
    Flowlogs []GetNicFlowlog
    Only 1 flow log can be configured. Only the name field can change as part of an update. Flow logs holistically capture network information such as source and destination IP addresses, source and destination ports, number of packets, amount of bytes, the start and end time of the recording, and the type of protocol – and log the extent to which your instances are being accessed.
    Id string
    The id of the NIC.
    Ips []string
    Collection of IP addresses assigned to a nic. Explicitly assigned public IPs need to come from reserved IP blocks, Passing value null or empty array will assign an IP address automatically.
    Ipv6CidrBlock string
    Ipv6Ips []string
    Lan float64
    The LAN ID the NIC will sit on.
    Mac string
    The MAC address of the NIC.
    Name string
    Specifies the name of the flow log.
    PciSlot float64
    The PCI slot number of the Nic.
    SecurityGroupsIds []string
    The list of Security Group IDs for the resource.
    ServerId string
    The ID of a server.
    Timeouts GetNicTimeouts
    datacenterId String
    The ID of a Virtual Data Center.
    deviceNumber Double
    The Logical Unit Number (LUN) of the storage volume. Null if this NIC was created from CloudAPI and no DCD changes were done on the Datacenter.
    dhcp Boolean
    Indicates if the NIC should get an IP address using DHCP (true) or not (false).
    dhcpv6 Boolean
    firewallActive Boolean
    If this resource is set to true and is nested under a server resource firewall, with open SSH port, resource must be nested under the NIC.
    firewallType String
    The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the default value INGRESS
    flowlogs List<GetNicFlowlog>
    Only 1 flow log can be configured. Only the name field can change as part of an update. Flow logs holistically capture network information such as source and destination IP addresses, source and destination ports, number of packets, amount of bytes, the start and end time of the recording, and the type of protocol – and log the extent to which your instances are being accessed.
    id String
    The id of the NIC.
    ips List<String>
    Collection of IP addresses assigned to a nic. Explicitly assigned public IPs need to come from reserved IP blocks, Passing value null or empty array will assign an IP address automatically.
    ipv6CidrBlock String
    ipv6Ips List<String>
    lan Double
    The LAN ID the NIC will sit on.
    mac String
    The MAC address of the NIC.
    name String
    Specifies the name of the flow log.
    pciSlot Double
    The PCI slot number of the Nic.
    securityGroupsIds List<String>
    The list of Security Group IDs for the resource.
    serverId String
    The ID of a server.
    timeouts GetNicTimeouts
    datacenterId string
    The ID of a Virtual Data Center.
    deviceNumber number
    The Logical Unit Number (LUN) of the storage volume. Null if this NIC was created from CloudAPI and no DCD changes were done on the Datacenter.
    dhcp boolean
    Indicates if the NIC should get an IP address using DHCP (true) or not (false).
    dhcpv6 boolean
    firewallActive boolean
    If this resource is set to true and is nested under a server resource firewall, with open SSH port, resource must be nested under the NIC.
    firewallType string
    The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the default value INGRESS
    flowlogs GetNicFlowlog[]
    Only 1 flow log can be configured. Only the name field can change as part of an update. Flow logs holistically capture network information such as source and destination IP addresses, source and destination ports, number of packets, amount of bytes, the start and end time of the recording, and the type of protocol – and log the extent to which your instances are being accessed.
    id string
    The id of the NIC.
    ips string[]
    Collection of IP addresses assigned to a nic. Explicitly assigned public IPs need to come from reserved IP blocks, Passing value null or empty array will assign an IP address automatically.
    ipv6CidrBlock string
    ipv6Ips string[]
    lan number
    The LAN ID the NIC will sit on.
    mac string
    The MAC address of the NIC.
    name string
    Specifies the name of the flow log.
    pciSlot number
    The PCI slot number of the Nic.
    securityGroupsIds string[]
    The list of Security Group IDs for the resource.
    serverId string
    The ID of a server.
    timeouts GetNicTimeouts
    datacenter_id str
    The ID of a Virtual Data Center.
    device_number float
    The Logical Unit Number (LUN) of the storage volume. Null if this NIC was created from CloudAPI and no DCD changes were done on the Datacenter.
    dhcp bool
    Indicates if the NIC should get an IP address using DHCP (true) or not (false).
    dhcpv6 bool
    firewall_active bool
    If this resource is set to true and is nested under a server resource firewall, with open SSH port, resource must be nested under the NIC.
    firewall_type str
    The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the default value INGRESS
    flowlogs Sequence[GetNicFlowlog]
    Only 1 flow log can be configured. Only the name field can change as part of an update. Flow logs holistically capture network information such as source and destination IP addresses, source and destination ports, number of packets, amount of bytes, the start and end time of the recording, and the type of protocol – and log the extent to which your instances are being accessed.
    id str
    The id of the NIC.
    ips Sequence[str]
    Collection of IP addresses assigned to a nic. Explicitly assigned public IPs need to come from reserved IP blocks, Passing value null or empty array will assign an IP address automatically.
    ipv6_cidr_block str
    ipv6_ips Sequence[str]
    lan float
    The LAN ID the NIC will sit on.
    mac str
    The MAC address of the NIC.
    name str
    Specifies the name of the flow log.
    pci_slot float
    The PCI slot number of the Nic.
    security_groups_ids Sequence[str]
    The list of Security Group IDs for the resource.
    server_id str
    The ID of a server.
    timeouts GetNicTimeouts
    datacenterId String
    The ID of a Virtual Data Center.
    deviceNumber Number
    The Logical Unit Number (LUN) of the storage volume. Null if this NIC was created from CloudAPI and no DCD changes were done on the Datacenter.
    dhcp Boolean
    Indicates if the NIC should get an IP address using DHCP (true) or not (false).
    dhcpv6 Boolean
    firewallActive Boolean
    If this resource is set to true and is nested under a server resource firewall, with open SSH port, resource must be nested under the NIC.
    firewallType String
    The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the default value INGRESS
    flowlogs List<Property Map>
    Only 1 flow log can be configured. Only the name field can change as part of an update. Flow logs holistically capture network information such as source and destination IP addresses, source and destination ports, number of packets, amount of bytes, the start and end time of the recording, and the type of protocol – and log the extent to which your instances are being accessed.
    id String
    The id of the NIC.
    ips List<String>
    Collection of IP addresses assigned to a nic. Explicitly assigned public IPs need to come from reserved IP blocks, Passing value null or empty array will assign an IP address automatically.
    ipv6CidrBlock String
    ipv6Ips List<String>
    lan Number
    The LAN ID the NIC will sit on.
    mac String
    The MAC address of the NIC.
    name String
    Specifies the name of the flow log.
    pciSlot Number
    The PCI slot number of the Nic.
    securityGroupsIds List<String>
    The list of Security Group IDs for the resource.
    serverId String
    The ID of a server.
    timeouts Property Map

    Supporting Types

    GetNicFlowlog

    Action string
    Specifies the action to be taken when the rule is matched. Possible values: ACCEPTED, REJECTED, ALL.
    Bucket string
    Specifies the IONOS Object Storage bucket where the flow log data will be stored. The bucket must exist.
    Direction string
    Specifies the traffic direction pattern. Valid values: INGRESS, EGRESS, BIDIRECTIONAL.
    Id string

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    Name string
    [string] The name of the LAN.
    Action string
    Specifies the action to be taken when the rule is matched. Possible values: ACCEPTED, REJECTED, ALL.
    Bucket string
    Specifies the IONOS Object Storage bucket where the flow log data will be stored. The bucket must exist.
    Direction string
    Specifies the traffic direction pattern. Valid values: INGRESS, EGRESS, BIDIRECTIONAL.
    Id string

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    Name string
    [string] The name of the LAN.
    action String
    Specifies the action to be taken when the rule is matched. Possible values: ACCEPTED, REJECTED, ALL.
    bucket String
    Specifies the IONOS Object Storage bucket where the flow log data will be stored. The bucket must exist.
    direction String
    Specifies the traffic direction pattern. Valid values: INGRESS, EGRESS, BIDIRECTIONAL.
    id String

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    name String
    [string] The name of the LAN.
    action string
    Specifies the action to be taken when the rule is matched. Possible values: ACCEPTED, REJECTED, ALL.
    bucket string
    Specifies the IONOS Object Storage bucket where the flow log data will be stored. The bucket must exist.
    direction string
    Specifies the traffic direction pattern. Valid values: INGRESS, EGRESS, BIDIRECTIONAL.
    id string

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    name string
    [string] The name of the LAN.
    action str
    Specifies the action to be taken when the rule is matched. Possible values: ACCEPTED, REJECTED, ALL.
    bucket str
    Specifies the IONOS Object Storage bucket where the flow log data will be stored. The bucket must exist.
    direction str
    Specifies the traffic direction pattern. Valid values: INGRESS, EGRESS, BIDIRECTIONAL.
    id str

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    name str
    [string] The name of the LAN.
    action String
    Specifies the action to be taken when the rule is matched. Possible values: ACCEPTED, REJECTED, ALL.
    bucket String
    Specifies the IONOS Object Storage bucket where the flow log data will be stored. The bucket must exist.
    direction String
    Specifies the traffic direction pattern. Valid values: INGRESS, EGRESS, BIDIRECTIONAL.
    id String

    ID of the nic you want to search for.

    datacenter_id and either name or id must be provided. If none, are provided, the datasource will return an error.

    name String
    [string] The name of the LAN.

    GetNicTimeouts

    Create string
    Default string
    Delete string
    Update string
    Create string
    Default string
    Delete string
    Update string
    create String
    default_ String
    delete String
    update String
    create string
    default string
    delete string
    update string
    create String
    default String
    delete String
    update String

    Package Details

    Repository
    ionoscloud ionos-cloud/terraform-provider-ionoscloud
    License
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud