Class NetworkInterface
Provides an ECS Elastic Network Interface resource.
For information about Elastic Network Interface and how to use it, see Elastic Network Interface.
NOTE Only one of private_ips or private_ips_count can be specified when assign private IPs.
Example Usage
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var name = config.Get("name") ?? "networkInterfaceName";
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 defaultNetworkInterface = new AliCloud.Vpc.NetworkInterface("defaultNetworkInterface", new AliCloud.Vpc.NetworkInterfaceArgs
{
PrivateIp = "192.168.0.2",
PrivateIpsCount = 3,
SecurityGroups =
{
@group.Id,
},
VswitchId = vswitch.Id,
});
}
}
Inherited Members
Namespace: Pulumi.AliCloud.Vpc
Assembly: Pulumi.AliCloud.dll
Syntax
public class NetworkInterface : CustomResource
Constructors
View SourceNetworkInterface(String, NetworkInterfaceArgs, CustomResourceOptions)
Create a NetworkInterface resource with the given unique name, arguments, and options.
Declaration
public NetworkInterface(string name, NetworkInterfaceArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| NetworkInterfaceArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceDescription
Description of the ENI. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Declaration
public Output<string> Description { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Mac
(Available in 1.54.0+) The MAC address of an ENI.
Declaration
public Output<string> Mac { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
Name of the ENI. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-", ".", "_", and must not begin or end with a hyphen, and must not begin with http:// or https://. Default value is null.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PrivateIp
The primary private IP of the ENI.
Declaration
public Output<string> PrivateIp { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PrivateIps
List of secondary private IPs to assign to the ENI. Don't use both private_ips and private_ips_count in the same ENI resource block.
Declaration
public Output<ImmutableArray<string>> PrivateIps { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
PrivateIpsCount
Number of secondary private IPs to assign to the ENI. Don't use both private_ips and private_ips_count in the same ENI resource block.
Declaration
public Output<int> PrivateIpsCount { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
ResourceGroupId
The Id of resource group which the network interface belongs.
Declaration
public Output<string> ResourceGroupId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SecurityGroups
A list of security group ids to associate with.
Declaration
public Output<ImmutableArray<string>> SecurityGroups { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
Tags
A mapping of tags to assign to the resource.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
VswitchId
The VSwitch to create the ENI in.
Declaration
public Output<string> VswitchId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, NetworkInterfaceState, CustomResourceOptions)
Get an existing NetworkInterface resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static NetworkInterface Get(string name, Input<string> id, NetworkInterfaceState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| NetworkInterfaceState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| NetworkInterface |