getNetworkInterfaces

DEPRECATED: This datasource has been renamed to alicloud.ecs.getEcsNetworkInterfaces from version 1.123.1. Use this data source to get a list of elastic network interfaces according to the specified filters in an Alibaba Cloud account. For information about elastic network interface and how to use it, see Elastic Network Interface

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.vpc.NetworkInterface;
import com.pulumi.alicloud.vpc.NetworkInterfaceArgs;
import com.pulumi.alicloud.ecs.Instance;
import com.pulumi.alicloud.ecs.InstanceArgs;
import com.pulumi.alicloud.vpc.NetworkInterfaceAttachment;
import com.pulumi.alicloud.vpc.NetworkInterfaceAttachmentArgs;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetNetworkInterfacesArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("networkInterfacesName");
var vpc = new Network("vpc", NetworkArgs.builder()
.cidrBlock("192.168.0.0/24")
.vpcName(name)
.build());
final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("VSwitch")
.build());
var vswitch = new Switch("vswitch", SwitchArgs.builder()
.availabilityZone(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.cidrBlock("192.168.0.0/24")
.vpcId(vpc.id())
.vswitchName(name)
.build());
var group = new SecurityGroup("group", SecurityGroupArgs.builder()
.vpcId(vpc.id())
.build());
var interface_ = new NetworkInterface("interface", NetworkInterfaceArgs.builder()
.description("Basic test")
.privateIp("192.168.0.2")
.securityGroups(group.id())
.tags(Map.of("TF-VER", "0.11.3"))
.vswitchId(vswitch.id())
.build());
var instance = new Instance("instance", InstanceArgs.builder()
.availabilityZone(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.imageId("centos_7_04_64_20G_alibase_201701015.vhd")
.instanceName(name)
.instanceType("ecs.e3.xlarge")
.internetMaxBandwidthOut(10)
.securityGroups(group.id())
.systemDiskCategory("cloud_efficiency")
.vswitchId(vswitch.id())
.build());
var attachment = new NetworkInterfaceAttachment("attachment", NetworkInterfaceAttachmentArgs.builder()
.instanceId(instance.id())
.networkInterfaceId(interface_.id())
.build());
final var defaultNetworkInterfaces = EcsFunctions.getNetworkInterfaces(GetNetworkInterfacesArgs.builder()
.ids(attachment.networkInterfaceId())
.instanceId(instance.id())
.nameRegex(name)
.privateIp("192.168.0.2")
.securityGroupId(group.id())
.tags(Map.of("TF-VER", "0.11.3"))
.type("Secondary")
.vpcId(vpc.id())
.vswitchId(vswitch.id())
.build());
ctx.export("eni0Name", defaultNetworkInterfaces.applyValue(getNetworkInterfacesResult -> getNetworkInterfacesResult).applyValue(defaultNetworkInterfaces -> defaultNetworkInterfaces.applyValue(getNetworkInterfacesResult -> getNetworkInterfacesResult.interfaces()[0].name())));
}
}

Argument Reference

The following arguments are supported:

  • ids - (Optional) A list of ENI IDs.

  • name_regex - (Optional) A regex string to filter results by ENI name.

  • vpc_id - (Optional) The VPC ID linked to ENIs.

  • vswitch_id - (Optional) The VSwitch ID linked to ENIs.

  • private_ip - (Optional) The primary private IP address of the ENI.

  • security_group_id - (Optional) The security group ID linked to ENIs.

  • name - (Optional) The name of the ENIs.

  • type - (Optional) The type of ENIs, Only support for "Primary" or "Secondary".

  • instance_id - (Optional) The ECS instance ID that the ENI is attached to.

  • tags - (Optional) A map of tags assigned to ENIs.

  • output_file - (Optional) The name of output file that saves the filter results.

  • resource_group_id - (Optional, ForceNew, Available in 1.57.0+) The Id of resource group which the network interface belongs.

Return

A collection of values returned by getNetworkInterfaces.

Parameters

argument

A collection of arguments for invoking getNetworkInterfaces.


suspend fun getNetworkInterfaces(ids: List<String>? = null, instanceId: String? = null, name: String? = null, nameRegex: String? = null, networkInterfaceName: String? = null, outputFile: String? = null, primaryIpAddress: String? = null, privateIp: String? = null, resourceGroupId: String? = null, securityGroupId: String? = null, serviceManaged: Boolean? = null, status: String? = null, tags: Map<String, Any>? = null, type: String? = null, vpcId: String? = null, vswitchId: String? = null): GetNetworkInterfacesResult

Return

A collection of values returned by getNetworkInterfaces.

See also

Parameters

ids
instanceId

ID of the instance that the ENI is attached to.

name

Name of the ENI.

nameRegex
networkInterfaceName
outputFile
primaryIpAddress
privateIp

Primary private IP of the ENI.

resourceGroupId

The Id of resource group.

securityGroupId
serviceManaged
status

Current status of the ENI.

tags

A map of tags assigned to the ENI.

type
vpcId

ID of the VPC that the ENI belongs to.

vswitchId

ID of the VSwitch that the ENI is linked to.


Return

A collection of values returned by getNetworkInterfaces.

See also

Parameters

argument

Builder for com.pulumi.alicloud.ecs.kotlin.inputs.GetNetworkInterfacesPlainArgs.