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,
});
}
}
Coming soon!
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "networkInterfaceName"
vpc = alicloud.vpc.Network("vpc", cidr_block="192.168.0.0/24")
default_zones = alicloud.get_zones(available_resource_creation="VSwitch")
vswitch = alicloud.vpc.Switch("vswitch",
availability_zone=default_zones.zones[0]["id"],
cidr_block="192.168.0.0/24",
vpc_id=vpc.id)
group = alicloud.ecs.SecurityGroup("group", vpc_id=vpc.id)
default_network_interface = alicloud.vpc.NetworkInterface("defaultNetworkInterface",
private_ip="192.168.0.2",
private_ips_count=3,
security_groups=[group.id],
vswitch_id=vswitch.id)import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "networkInterfaceName";
const vpc = new alicloud.vpc.Network("vpc", {
cidrBlock: "192.168.0.0/24",
});
const defaultZones = pulumi.output(alicloud.getZones({
availableResourceCreation: "VSwitch",
}, { async: true }));
const vswitch = new alicloud.vpc.Switch("vswitch", {
availabilityZone: defaultZones.zones[0].id,
cidrBlock: "192.168.0.0/24",
vpcId: vpc.id,
});
const group = new alicloud.ecs.SecurityGroup("group", {
vpcId: vpc.id,
});
const defaultNetworkInterface = new alicloud.vpc.NetworkInterface("default", {
privateIp: "192.168.0.2",
privateIpsCount: 3,
securityGroups: [group.id],
vswitchId: vswitch.id,
});Create a NetworkInterface Resource
new NetworkInterface(name: string, args: NetworkInterfaceArgs, opts?: CustomResourceOptions);def NetworkInterface(resource_name, opts=None, description=None, name=None, private_ip=None, private_ips=None, private_ips_count=None, resource_group_id=None, security_groups=None, tags=None, vswitch_id=None, __props__=None);func NewNetworkInterface(ctx *Context, name string, args NetworkInterfaceArgs, opts ...ResourceOption) (*NetworkInterface, error)public NetworkInterface(string name, NetworkInterfaceArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args NetworkInterfaceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NetworkInterfaceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkInterfaceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
NetworkInterface Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The NetworkInterface resource accepts the following input properties:
- Security
Groups List<string> A list of security group ids to associate with.
- Vswitch
Id string The VSwitch to create the ENI in.
- Description string
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.
- Name string
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.
- Private
Ip string The primary private IP of the ENI.
- Private
Ips List<string> 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.
- Private
Ips intCount 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.
- Resource
Group stringId The Id of resource group which the network interface belongs.
- Dictionary<string, object>
A mapping of tags to assign to the resource.
- Security
Groups []string A list of security group ids to associate with.
- Vswitch
Id string The VSwitch to create the ENI in.
- Description string
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.
- Name string
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.
- Private
Ip string The primary private IP of the ENI.
- Private
Ips []string 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.
- Private
Ips intCount 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.
- Resource
Group stringId The Id of resource group which the network interface belongs.
- map[string]interface{}
A mapping of tags to assign to the resource.
- security
Groups string[] A list of security group ids to associate with.
- vswitch
Id string The VSwitch to create the ENI in.
- description string
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.
- name string
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.
- private
Ip string The primary private IP of the ENI.
- private
Ips string[] 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.
- private
Ips numberCount 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.
- resource
Group stringId The Id of resource group which the network interface belongs.
- {[key: string]: any}
A mapping of tags to assign to the resource.
- security_
groups List[str] A list of security group ids to associate with.
- vswitch_
id str The VSwitch to create the ENI in.
- description str
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.
- name str
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.
- private_
ip str The primary private IP of the ENI.
- private_
ips List[str] 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.
- private_
ips_ floatcount 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.
- resource_
group_ strid The Id of resource group which the network interface belongs.
- Dict[str, Any]
A mapping of tags to assign to the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkInterface resource produces the following output properties:
Look up an Existing NetworkInterface Resource
Get an existing NetworkInterface resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: NetworkInterfaceState, opts?: CustomResourceOptions): NetworkInterfacestatic get(resource_name, id, opts=None, description=None, mac=None, name=None, private_ip=None, private_ips=None, private_ips_count=None, resource_group_id=None, security_groups=None, tags=None, vswitch_id=None, __props__=None);func GetNetworkInterface(ctx *Context, name string, id IDInput, state *NetworkInterfaceState, opts ...ResourceOption) (*NetworkInterface, error)public static NetworkInterface Get(string name, Input<string> id, NetworkInterfaceState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Description string
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.
- Mac string
(Available in 1.54.0+) The MAC address of an ENI.
- Name string
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.
- Private
Ip string The primary private IP of the ENI.
- Private
Ips List<string> 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.
- Private
Ips intCount 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.
- Resource
Group stringId The Id of resource group which the network interface belongs.
- Security
Groups List<string> A list of security group ids to associate with.
- Dictionary<string, object>
A mapping of tags to assign to the resource.
- Vswitch
Id string The VSwitch to create the ENI in.
- Description string
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.
- Mac string
(Available in 1.54.0+) The MAC address of an ENI.
- Name string
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.
- Private
Ip string The primary private IP of the ENI.
- Private
Ips []string 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.
- Private
Ips intCount 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.
- Resource
Group stringId The Id of resource group which the network interface belongs.
- Security
Groups []string A list of security group ids to associate with.
- map[string]interface{}
A mapping of tags to assign to the resource.
- Vswitch
Id string The VSwitch to create the ENI in.
- description string
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.
- mac string
(Available in 1.54.0+) The MAC address of an ENI.
- name string
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.
- private
Ip string The primary private IP of the ENI.
- private
Ips string[] 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.
- private
Ips numberCount 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.
- resource
Group stringId The Id of resource group which the network interface belongs.
- security
Groups string[] A list of security group ids to associate with.
- {[key: string]: any}
A mapping of tags to assign to the resource.
- vswitch
Id string The VSwitch to create the ENI in.
- description str
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.
- mac str
(Available in 1.54.0+) The MAC address of an ENI.
- name str
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.
- private_
ip str The primary private IP of the ENI.
- private_
ips List[str] 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.
- private_
ips_ floatcount 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.
- resource_
group_ strid The Id of resource group which the network interface belongs.
- security_
groups List[str] A list of security group ids to associate with.
- Dict[str, Any]
A mapping of tags to assign to the resource.
- vswitch_
id str The VSwitch to create the ENI in.
Package Details
- Repository
- https://github.com/pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.