Class GetNetworkInterfaces
Inheritance
System.Object
GetNetworkInterfaces
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.AliCloud.Ecs
Assembly: Pulumi.AliCloud.dll
Syntax
public static class GetNetworkInterfaces
Methods
View SourceInvokeAsync(GetNetworkInterfacesArgs, InvokeOptions)
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
{{% examples %}}
Example Usage
{{% example %}}
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var name = config.Get("name") ?? "networkInterfacesName";
var vpc = new AliCloud.Vpc.Network("vpc", new AliCloud.Vpc.NetworkArgs
{
CidrBlock = "192.168.0.0/24",
});
var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
{
AvailableResourceCreation = "VSwitch",
}));
var vswitch = new AliCloud.Vpc.Switch("vswitch", new AliCloud.Vpc.SwitchArgs
{
AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones[0].Id),
CidrBlock = "192.168.0.0/24",
VpcId = vpc.Id,
});
var @group = new AliCloud.Ecs.SecurityGroup("group", new AliCloud.Ecs.SecurityGroupArgs
{
VpcId = vpc.Id,
});
var @interface = new AliCloud.Vpc.NetworkInterface("interface", new AliCloud.Vpc.NetworkInterfaceArgs
{
Description = "Basic test",
PrivateIp = "192.168.0.2",
SecurityGroups =
{
@group.Id,
},
Tags =
{
{ "TF-VER", "0.11.3" },
},
VswitchId = vswitch.Id,
});
var instance = new AliCloud.Ecs.Instance("instance", new AliCloud.Ecs.InstanceArgs
{
AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.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,
});
var attachment = new AliCloud.Vpc.NetworkInterfaceAttachment("attachment", new AliCloud.Vpc.NetworkInterfaceAttachmentArgs
{
InstanceId = instance.Id,
NetworkInterfaceId = @interface.Id,
});
var defaultNetworkInterfaces = Output.Tuple(attachment.NetworkInterfaceId, instance.Id, @group.Id, vpc.Id, vswitch.Id).Apply(values =>
{
var networkInterfaceId = values.Item1;
var instanceId = values.Item2;
var groupId = values.Item3;
var vpcId = values.Item4;
var vswitchId = values.Item5;
return AliCloud.Ecs.GetNetworkInterfaces.InvokeAsync(new AliCloud.Ecs.GetNetworkInterfacesArgs
{
Ids =
{
networkInterfaceId,
},
InstanceId = instanceId,
NameRegex = name,
PrivateIp = "192.168.0.2",
SecurityGroupId = groupId,
Tags =
{
{ "TF-VER", "0.11.3" },
},
Type = "Secondary",
VpcId = vpcId,
VswitchId = vswitchId,
});
});
this.Eni0Name = defaultNetworkInterfaces.Apply(defaultNetworkInterfaces => defaultNetworkInterfaces.Interfaces[0].Name);
}
[Output("eni0Name")]
public Output<string> Eni0Name { get; set; }
}
{{% /example %}} {{% /examples %}}
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.
Declaration
public static Task<GetNetworkInterfacesResult> InvokeAsync(GetNetworkInterfacesArgs args = null, InvokeOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GetNetworkInterfacesArgs | args | |
| InvokeOptions | options |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<GetNetworkInterfacesResult> |