published on Thursday, Sep 24, 2026 by ucloud
published on Thursday, Sep 24, 2026 by ucloud
Provides a virtual network interface (UNI) resource. A UNI is an elastic network interface that can be created in a subnet and optionally attached to a UHost instance. Detaching or deleting the resource leaves the instance untouched.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ucloud from "@pulumi/ucloud";
const foo = new ucloud.Vpc("foo", {
name: "tf-example-vpc",
tag: "tf-example",
cidrBlocks: ["192.168.0.0/16"],
});
const fooSubnet = new ucloud.Subnet("foo", {
name: "tf-example-subnet",
tag: "tf-example",
cidrBlock: "192.168.1.0/24",
vpcId: foo.vpcId,
});
const fooNetworkInterface = new ucloud.NetworkInterface("foo", {
name: "tf-example-uni",
tag: "tf-example",
vpcId: foo.vpcId,
subnetId: fooSubnet.subnetId,
});
import pulumi
import pulumi_ucloud as ucloud
foo = ucloud.Vpc("foo",
name="tf-example-vpc",
tag="tf-example",
cidr_blocks=["192.168.0.0/16"])
foo_subnet = ucloud.Subnet("foo",
name="tf-example-subnet",
tag="tf-example",
cidr_block="192.168.1.0/24",
vpc_id=foo.vpc_id)
foo_network_interface = ucloud.NetworkInterface("foo",
name="tf-example-uni",
tag="tf-example",
vpc_id=foo.vpc_id,
subnet_id=foo_subnet.subnet_id)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
foo, err := ucloud.NewVpc(ctx, "foo", &ucloud.VpcArgs{
Name: pulumi.String("tf-example-vpc"),
Tag: pulumi.String("tf-example"),
CidrBlocks: pulumi.StringArray{
pulumi.String("192.168.0.0/16"),
},
})
if err != nil {
return err
}
fooSubnet, err := ucloud.NewSubnet(ctx, "foo", &ucloud.SubnetArgs{
Name: pulumi.String("tf-example-subnet"),
Tag: pulumi.String("tf-example"),
CidrBlock: pulumi.String("192.168.1.0/24"),
VpcId: foo.VpcId,
})
if err != nil {
return err
}
_, err = ucloud.NewNetworkInterface(ctx, "foo", &ucloud.NetworkInterfaceArgs{
Name: pulumi.String("tf-example-uni"),
Tag: pulumi.String("tf-example"),
VpcId: foo.VpcId,
SubnetId: fooSubnet.SubnetId,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ucloud = Pulumi.Ucloud;
return await Deployment.RunAsync(() =>
{
var foo = new Ucloud.Vpc("foo", new()
{
Name = "tf-example-vpc",
Tag = "tf-example",
CidrBlocks = new[]
{
"192.168.0.0/16",
},
});
var fooSubnet = new Ucloud.Subnet("foo", new()
{
Name = "tf-example-subnet",
Tag = "tf-example",
CidrBlock = "192.168.1.0/24",
VpcId = foo.VpcId,
});
var fooNetworkInterface = new Ucloud.NetworkInterface("foo", new()
{
Name = "tf-example-uni",
Tag = "tf-example",
VpcId = foo.VpcId,
SubnetId = fooSubnet.SubnetId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ucloud.Vpc;
import com.pulumi.ucloud.VpcArgs;
import com.pulumi.ucloud.Subnet;
import com.pulumi.ucloud.SubnetArgs;
import com.pulumi.ucloud.NetworkInterface;
import com.pulumi.ucloud.NetworkInterfaceArgs;
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) {
var foo = new Vpc("foo", VpcArgs.builder()
.name("tf-example-vpc")
.tag("tf-example")
.cidrBlocks("192.168.0.0/16")
.build());
var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()
.name("tf-example-subnet")
.tag("tf-example")
.cidrBlock("192.168.1.0/24")
.vpcId(foo.vpcId())
.build());
var fooNetworkInterface = new NetworkInterface("fooNetworkInterface", NetworkInterfaceArgs.builder()
.name("tf-example-uni")
.tag("tf-example")
.vpcId(foo.vpcId())
.subnetId(fooSubnet.subnetId())
.build());
}
}
resources:
foo:
type: ucloud:Vpc
properties:
name: tf-example-vpc
tag: tf-example
cidrBlocks:
- 192.168.0.0/16
fooSubnet:
type: ucloud:Subnet
name: foo
properties:
name: tf-example-subnet
tag: tf-example
cidrBlock: 192.168.1.0/24
vpcId: ${foo.vpcId}
fooNetworkInterface:
type: ucloud:NetworkInterface
name: foo
properties:
name: tf-example-uni
tag: tf-example
vpcId: ${foo.vpcId}
subnetId: ${fooSubnet.subnetId}
Example coming soon!
Create NetworkInterface Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NetworkInterface(name: string, args: NetworkInterfaceArgs, opts?: CustomResourceOptions);@overload
def NetworkInterface(resource_name: str,
args: NetworkInterfaceArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NetworkInterface(resource_name: str,
opts: Optional[ResourceOptions] = None,
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
instance_id: Optional[str] = None,
name: Optional[str] = None,
network_interface_id: Optional[str] = None,
private_ip: Optional[str] = None,
remark: Optional[str] = None,
tag: Optional[str] = None)func NewNetworkInterface(ctx *Context, name string, args NetworkInterfaceArgs, opts ...ResourceOption) (*NetworkInterface, error)public NetworkInterface(string name, NetworkInterfaceArgs args, CustomResourceOptions? opts = null)
public NetworkInterface(String name, NetworkInterfaceArgs args)
public NetworkInterface(String name, NetworkInterfaceArgs args, CustomResourceOptions options)
type: ucloud:NetworkInterface
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "ucloud_network_interface" "name" {
# resource properties
}Parameters
- 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.
- args NetworkInterfaceArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control 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.
- name String
- The unique name of the resource.
- args NetworkInterfaceArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var networkInterfaceResource = new Ucloud.NetworkInterface("networkInterfaceResource", new()
{
SubnetId = "string",
VpcId = "string",
InstanceId = "string",
Name = "string",
NetworkInterfaceId = "string",
PrivateIp = "string",
Remark = "string",
Tag = "string",
});
example, err := ucloud.NewNetworkInterface(ctx, "networkInterfaceResource", &ucloud.NetworkInterfaceArgs{
SubnetId: pulumi.String("string"),
VpcId: pulumi.String("string"),
InstanceId: pulumi.String("string"),
Name: pulumi.String("string"),
NetworkInterfaceId: pulumi.String("string"),
PrivateIp: pulumi.String("string"),
Remark: pulumi.String("string"),
Tag: pulumi.String("string"),
})
resource "ucloud_network_interface" "networkInterfaceResource" {
lifecycle {
create_before_destroy = true
}
subnet_id = "string"
vpc_id = "string"
instance_id = "string"
name = "string"
network_interface_id = "string"
private_ip = "string"
remark = "string"
tag = "string"
}
var networkInterfaceResource = new NetworkInterface("networkInterfaceResource", NetworkInterfaceArgs.builder()
.subnetId("string")
.vpcId("string")
.instanceId("string")
.name("string")
.networkInterfaceId("string")
.privateIp("string")
.remark("string")
.tag("string")
.build());
network_interface_resource = ucloud.NetworkInterface("networkInterfaceResource",
subnet_id="string",
vpc_id="string",
instance_id="string",
name="string",
network_interface_id="string",
private_ip="string",
remark="string",
tag="string")
const networkInterfaceResource = new ucloud.NetworkInterface("networkInterfaceResource", {
subnetId: "string",
vpcId: "string",
instanceId: "string",
name: "string",
networkInterfaceId: "string",
privateIp: "string",
remark: "string",
tag: "string",
});
type: ucloud:NetworkInterface
properties:
instanceId: string
name: string
networkInterfaceId: string
privateIp: string
remark: string
subnetId: string
tag: string
vpcId: string
NetworkInterface Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The NetworkInterface resource accepts the following input properties:
- Subnet
Id string - The ID of the subnet the network interface belongs to.
- Vpc
Id string - The ID of the VPC the network interface belongs to.
- Instance
Id string - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- Name string
- The name of the network interface. If not specified, a name is auto generated.
- Network
Interface stringId - The ID of the network interface.
- Private
Ip string - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- Remark string
- The remark of the network interface.
- Tag string
- The business group the network interface belongs to. Defaults to
Default.
- Subnet
Id string - The ID of the subnet the network interface belongs to.
- Vpc
Id string - The ID of the VPC the network interface belongs to.
- Instance
Id string - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- Name string
- The name of the network interface. If not specified, a name is auto generated.
- Network
Interface stringId - The ID of the network interface.
- Private
Ip string - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- Remark string
- The remark of the network interface.
- Tag string
- The business group the network interface belongs to. Defaults to
Default.
- subnet_
id string - The ID of the subnet the network interface belongs to.
- vpc_
id string - The ID of the VPC the network interface belongs to.
- instance_
id string - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- name string
- The name of the network interface. If not specified, a name is auto generated.
- network_
interface_ stringid - The ID of the network interface.
- private_
ip string - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- remark string
- The remark of the network interface.
- tag string
- The business group the network interface belongs to. Defaults to
Default.
- subnet
Id String - The ID of the subnet the network interface belongs to.
- vpc
Id String - The ID of the VPC the network interface belongs to.
- instance
Id String - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- name String
- The name of the network interface. If not specified, a name is auto generated.
- network
Interface StringId - The ID of the network interface.
- private
Ip String - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- remark String
- The remark of the network interface.
- tag String
- The business group the network interface belongs to. Defaults to
Default.
- subnet
Id string - The ID of the subnet the network interface belongs to.
- vpc
Id string - The ID of the VPC the network interface belongs to.
- instance
Id string - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- name string
- The name of the network interface. If not specified, a name is auto generated.
- network
Interface stringId - The ID of the network interface.
- private
Ip string - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- remark string
- The remark of the network interface.
- tag string
- The business group the network interface belongs to. Defaults to
Default.
- subnet_
id str - The ID of the subnet the network interface belongs to.
- vpc_
id str - The ID of the VPC the network interface belongs to.
- instance_
id str - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- name str
- The name of the network interface. If not specified, a name is auto generated.
- network_
interface_ strid - The ID of the network interface.
- private_
ip str - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- remark str
- The remark of the network interface.
- tag str
- The business group the network interface belongs to. Defaults to
Default.
- subnet
Id String - The ID of the subnet the network interface belongs to.
- vpc
Id String - The ID of the VPC the network interface belongs to.
- instance
Id String - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- name String
- The name of the network interface. If not specified, a name is auto generated.
- network
Interface StringId - The ID of the network interface.
- private
Ip String - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- remark String
- The remark of the network interface.
- tag String
- The business group the network interface belongs to. Defaults to
Default.
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkInterface resource produces the following output properties:
- Create
Time string - The time when the network interface was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Mac
Address string - The MAC address of the network interface.
- Status double
- The binding status of the network interface.
1means attached to an instance,0means detached.
- Create
Time string - The time when the network interface was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Mac
Address string - The MAC address of the network interface.
- Status float64
- The binding status of the network interface.
1means attached to an instance,0means detached.
- create_
time string - The time when the network interface was created.
- id string
- The provider-assigned unique ID for this managed resource.
- mac_
address string - The MAC address of the network interface.
- status number
- The binding status of the network interface.
1means attached to an instance,0means detached.
- create
Time String - The time when the network interface was created.
- id String
- The provider-assigned unique ID for this managed resource.
- mac
Address String - The MAC address of the network interface.
- status Double
- The binding status of the network interface.
1means attached to an instance,0means detached.
- create
Time string - The time when the network interface was created.
- id string
- The provider-assigned unique ID for this managed resource.
- mac
Address string - The MAC address of the network interface.
- status number
- The binding status of the network interface.
1means attached to an instance,0means detached.
- create_
time str - The time when the network interface was created.
- id str
- The provider-assigned unique ID for this managed resource.
- mac_
address str - The MAC address of the network interface.
- status float
- The binding status of the network interface.
1means attached to an instance,0means detached.
- create
Time String - The time when the network interface was created.
- id String
- The provider-assigned unique ID for this managed resource.
- mac
Address String - The MAC address of the network interface.
- status Number
- The binding status of the network interface.
1means attached to an instance,0means detached.
Look up 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): NetworkInterface@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
create_time: Optional[str] = None,
instance_id: Optional[str] = None,
mac_address: Optional[str] = None,
name: Optional[str] = None,
network_interface_id: Optional[str] = None,
private_ip: Optional[str] = None,
remark: Optional[str] = None,
status: Optional[float] = None,
subnet_id: Optional[str] = None,
tag: Optional[str] = None,
vpc_id: Optional[str] = None) -> NetworkInterfacefunc 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)public static NetworkInterface get(String name, Output<String> id, NetworkInterfaceState state, CustomResourceOptions options)resources: _: type: ucloud:NetworkInterface get: id: ${id}import {
to = ucloud_network_interface.example
id = "${id}"
}
- 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.
- 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.
- Create
Time string - The time when the network interface was created.
- Instance
Id string - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- Mac
Address string - The MAC address of the network interface.
- Name string
- The name of the network interface. If not specified, a name is auto generated.
- Network
Interface stringId - The ID of the network interface.
- Private
Ip string - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- Remark string
- The remark of the network interface.
- Status double
- The binding status of the network interface.
1means attached to an instance,0means detached. - Subnet
Id string - The ID of the subnet the network interface belongs to.
- Tag string
- The business group the network interface belongs to. Defaults to
Default. - Vpc
Id string - The ID of the VPC the network interface belongs to.
- Create
Time string - The time when the network interface was created.
- Instance
Id string - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- Mac
Address string - The MAC address of the network interface.
- Name string
- The name of the network interface. If not specified, a name is auto generated.
- Network
Interface stringId - The ID of the network interface.
- Private
Ip string - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- Remark string
- The remark of the network interface.
- Status float64
- The binding status of the network interface.
1means attached to an instance,0means detached. - Subnet
Id string - The ID of the subnet the network interface belongs to.
- Tag string
- The business group the network interface belongs to. Defaults to
Default. - Vpc
Id string - The ID of the VPC the network interface belongs to.
- create_
time string - The time when the network interface was created.
- instance_
id string - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- mac_
address string - The MAC address of the network interface.
- name string
- The name of the network interface. If not specified, a name is auto generated.
- network_
interface_ stringid - The ID of the network interface.
- private_
ip string - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- remark string
- The remark of the network interface.
- status number
- The binding status of the network interface.
1means attached to an instance,0means detached. - subnet_
id string - The ID of the subnet the network interface belongs to.
- tag string
- The business group the network interface belongs to. Defaults to
Default. - vpc_
id string - The ID of the VPC the network interface belongs to.
- create
Time String - The time when the network interface was created.
- instance
Id String - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- mac
Address String - The MAC address of the network interface.
- name String
- The name of the network interface. If not specified, a name is auto generated.
- network
Interface StringId - The ID of the network interface.
- private
Ip String - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- remark String
- The remark of the network interface.
- status Double
- The binding status of the network interface.
1means attached to an instance,0means detached. - subnet
Id String - The ID of the subnet the network interface belongs to.
- tag String
- The business group the network interface belongs to. Defaults to
Default. - vpc
Id String - The ID of the VPC the network interface belongs to.
- create
Time string - The time when the network interface was created.
- instance
Id string - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- mac
Address string - The MAC address of the network interface.
- name string
- The name of the network interface. If not specified, a name is auto generated.
- network
Interface stringId - The ID of the network interface.
- private
Ip string - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- remark string
- The remark of the network interface.
- status number
- The binding status of the network interface.
1means attached to an instance,0means detached. - subnet
Id string - The ID of the subnet the network interface belongs to.
- tag string
- The business group the network interface belongs to. Defaults to
Default. - vpc
Id string - The ID of the VPC the network interface belongs to.
- create_
time str - The time when the network interface was created.
- instance_
id str - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- mac_
address str - The MAC address of the network interface.
- name str
- The name of the network interface. If not specified, a name is auto generated.
- network_
interface_ strid - The ID of the network interface.
- private_
ip str - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- remark str
- The remark of the network interface.
- status float
- The binding status of the network interface.
1means attached to an instance,0means detached. - subnet_
id str - The ID of the subnet the network interface belongs to.
- tag str
- The business group the network interface belongs to. Defaults to
Default. - vpc_
id str - The ID of the VPC the network interface belongs to.
- create
Time String - The time when the network interface was created.
- instance
Id String - The ID of the UHost instance to attach the network interface to. Setting this attaches the interface; removing it detaches the interface.
- mac
Address String - The MAC address of the network interface.
- name String
- The name of the network interface. If not specified, a name is auto generated.
- network
Interface StringId - The ID of the network interface.
- private
Ip String - The private IP address to assign to the network interface. If not specified, one is allocated automatically.
- remark String
- The remark of the network interface.
- status Number
- The binding status of the network interface.
1means attached to an instance,0means detached. - subnet
Id String - The ID of the subnet the network interface belongs to.
- tag String
- The business group the network interface belongs to. Defaults to
Default. - vpc
Id String - The ID of the VPC the network interface belongs to.
Import
Network Interface can be imported using the interface id, e.g.
$ pulumi import ucloud:index/networkInterface:NetworkInterface example uni-abc123456
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- ucloud ucloud/terraform-provider-ucloud
- License
- Notes
- This Pulumi package is based on the
ucloudTerraform Provider.
published on Thursday, Sep 24, 2026 by ucloud