Manages a libvirt virtual network.
Create Network Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Network(name: string, args?: NetworkArgs, opts?: CustomResourceOptions);@overload
def Network(resource_name: str,
args: Optional[NetworkArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Network(resource_name: str,
opts: Optional[ResourceOptions] = None,
autostart: Optional[bool] = None,
bridge: Optional[str] = None,
ips: Optional[Sequence[NetworkIpArgs]] = None,
mode: Optional[str] = None,
name: Optional[str] = None,
uuid: Optional[str] = None)func NewNetwork(ctx *Context, name string, args *NetworkArgs, opts ...ResourceOption) (*Network, error)public Network(string name, NetworkArgs? args = null, CustomResourceOptions? opts = null)
public Network(String name, NetworkArgs args)
public Network(String name, NetworkArgs args, CustomResourceOptions options)
type: libvirt:Network
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args NetworkArgs
- 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 NetworkArgs
- 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 NetworkArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NetworkArgs
- 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 networkResource = new Libvirt.Network("networkResource", new()
{
Autostart = false,
Bridge = "string",
Ips = new[]
{
new Libvirt.Inputs.NetworkIpArgs
{
Address = "string",
Dhcp = new Libvirt.Inputs.NetworkIpDhcpArgs
{
Hosts = new[]
{
new Libvirt.Inputs.NetworkIpDhcpHostArgs
{
Ip = "string",
Mac = "string",
Name = "string",
},
},
Ranges = new[]
{
new Libvirt.Inputs.NetworkIpDhcpRangeArgs
{
End = "string",
Start = "string",
},
},
},
Family = "string",
LocalPtr = "string",
Netmask = "string",
Prefix = 0,
},
},
Mode = "string",
Name = "string",
Uuid = "string",
});
example, err := libvirt.NewNetwork(ctx, "networkResource", &libvirt.NetworkArgs{
Autostart: pulumi.Bool(false),
Bridge: pulumi.String("string"),
Ips: libvirt.NetworkIpArray{
&libvirt.NetworkIpArgs{
Address: pulumi.String("string"),
Dhcp: &libvirt.NetworkIpDhcpArgs{
Hosts: libvirt.NetworkIpDhcpHostArray{
&libvirt.NetworkIpDhcpHostArgs{
Ip: pulumi.String("string"),
Mac: pulumi.String("string"),
Name: pulumi.String("string"),
},
},
Ranges: libvirt.NetworkIpDhcpRangeArray{
&libvirt.NetworkIpDhcpRangeArgs{
End: pulumi.String("string"),
Start: pulumi.String("string"),
},
},
},
Family: pulumi.String("string"),
LocalPtr: pulumi.String("string"),
Netmask: pulumi.String("string"),
Prefix: pulumi.Float64(0),
},
},
Mode: pulumi.String("string"),
Name: pulumi.String("string"),
Uuid: pulumi.String("string"),
})
var networkResource = new Network("networkResource", NetworkArgs.builder()
.autostart(false)
.bridge("string")
.ips(NetworkIpArgs.builder()
.address("string")
.dhcp(NetworkIpDhcpArgs.builder()
.hosts(NetworkIpDhcpHostArgs.builder()
.ip("string")
.mac("string")
.name("string")
.build())
.ranges(NetworkIpDhcpRangeArgs.builder()
.end("string")
.start("string")
.build())
.build())
.family("string")
.localPtr("string")
.netmask("string")
.prefix(0.0)
.build())
.mode("string")
.name("string")
.uuid("string")
.build());
network_resource = libvirt.Network("networkResource",
autostart=False,
bridge="string",
ips=[{
"address": "string",
"dhcp": {
"hosts": [{
"ip": "string",
"mac": "string",
"name": "string",
}],
"ranges": [{
"end": "string",
"start": "string",
}],
},
"family": "string",
"local_ptr": "string",
"netmask": "string",
"prefix": 0,
}],
mode="string",
name="string",
uuid="string")
const networkResource = new libvirt.Network("networkResource", {
autostart: false,
bridge: "string",
ips: [{
address: "string",
dhcp: {
hosts: [{
ip: "string",
mac: "string",
name: "string",
}],
ranges: [{
end: "string",
start: "string",
}],
},
family: "string",
localPtr: "string",
netmask: "string",
prefix: 0,
}],
mode: "string",
name: "string",
uuid: "string",
});
type: libvirt:Network
properties:
autostart: false
bridge: string
ips:
- address: string
dhcp:
hosts:
- ip: string
mac: string
name: string
ranges:
- end: string
start: string
family: string
localPtr: string
netmask: string
prefix: 0
mode: string
name: string
uuid: string
Network 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 Network resource accepts the following input properties:
- Autostart bool
- Whether the network should be started automatically when the host boots.
- Bridge string
- Bridge name. If not specified, libvirt will auto-generate one.
- Ips
List<Network
Ip> - IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- Mode string
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- Name string
- Network name. Must be unique on the host.
- Uuid string
- Network UUID. If not specified, one will be generated.
- Autostart bool
- Whether the network should be started automatically when the host boots.
- Bridge string
- Bridge name. If not specified, libvirt will auto-generate one.
- Ips
[]Network
Ip Args - IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- Mode string
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- Name string
- Network name. Must be unique on the host.
- Uuid string
- Network UUID. If not specified, one will be generated.
- autostart Boolean
- Whether the network should be started automatically when the host boots.
- bridge String
- Bridge name. If not specified, libvirt will auto-generate one.
- ips
List<Network
Ip> - IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- mode String
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- name String
- Network name. Must be unique on the host.
- uuid String
- Network UUID. If not specified, one will be generated.
- autostart boolean
- Whether the network should be started automatically when the host boots.
- bridge string
- Bridge name. If not specified, libvirt will auto-generate one.
- ips
Network
Ip[] - IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- mode string
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- name string
- Network name. Must be unique on the host.
- uuid string
- Network UUID. If not specified, one will be generated.
- autostart bool
- Whether the network should be started automatically when the host boots.
- bridge str
- Bridge name. If not specified, libvirt will auto-generate one.
- ips
Sequence[Network
Ip Args] - IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- mode str
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- name str
- Network name. Must be unique on the host.
- uuid str
- Network UUID. If not specified, one will be generated.
- autostart Boolean
- Whether the network should be started automatically when the host boots.
- bridge String
- Bridge name. If not specified, libvirt will auto-generate one.
- ips List<Property Map>
- IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- mode String
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- name String
- Network name. Must be unique on the host.
- uuid String
- Network UUID. If not specified, one will be generated.
Outputs
All input properties are implicitly available as output properties. Additionally, the Network resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Network Resource
Get an existing Network 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?: NetworkState, opts?: CustomResourceOptions): Network@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
autostart: Optional[bool] = None,
bridge: Optional[str] = None,
ips: Optional[Sequence[NetworkIpArgs]] = None,
mode: Optional[str] = None,
name: Optional[str] = None,
uuid: Optional[str] = None) -> Networkfunc GetNetwork(ctx *Context, name string, id IDInput, state *NetworkState, opts ...ResourceOption) (*Network, error)public static Network Get(string name, Input<string> id, NetworkState? state, CustomResourceOptions? opts = null)public static Network get(String name, Output<String> id, NetworkState state, CustomResourceOptions options)resources: _: type: libvirt:Network get: 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.
- Autostart bool
- Whether the network should be started automatically when the host boots.
- Bridge string
- Bridge name. If not specified, libvirt will auto-generate one.
- Ips
List<Network
Ip> - IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- Mode string
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- Name string
- Network name. Must be unique on the host.
- Uuid string
- Network UUID. If not specified, one will be generated.
- Autostart bool
- Whether the network should be started automatically when the host boots.
- Bridge string
- Bridge name. If not specified, libvirt will auto-generate one.
- Ips
[]Network
Ip Args - IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- Mode string
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- Name string
- Network name. Must be unique on the host.
- Uuid string
- Network UUID. If not specified, one will be generated.
- autostart Boolean
- Whether the network should be started automatically when the host boots.
- bridge String
- Bridge name. If not specified, libvirt will auto-generate one.
- ips
List<Network
Ip> - IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- mode String
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- name String
- Network name. Must be unique on the host.
- uuid String
- Network UUID. If not specified, one will be generated.
- autostart boolean
- Whether the network should be started automatically when the host boots.
- bridge string
- Bridge name. If not specified, libvirt will auto-generate one.
- ips
Network
Ip[] - IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- mode string
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- name string
- Network name. Must be unique on the host.
- uuid string
- Network UUID. If not specified, one will be generated.
- autostart bool
- Whether the network should be started automatically when the host boots.
- bridge str
- Bridge name. If not specified, libvirt will auto-generate one.
- ips
Sequence[Network
Ip Args] - IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- mode str
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- name str
- Network name. Must be unique on the host.
- uuid str
- Network UUID. If not specified, one will be generated.
- autostart Boolean
- Whether the network should be started automatically when the host boots.
- bridge String
- Bridge name. If not specified, libvirt will auto-generate one.
- ips List<Property Map>
- IP address configurations for the network. Each entry can specify address, netmask/prefix, family, and DHCP settings.
- mode String
- Network forwarding mode: 'nat' (default), 'none' (isolated), 'route', 'open', 'bridge'.
- name String
- Network name. Must be unique on the host.
- uuid String
- Network UUID. If not specified, one will be generated.
Supporting Types
NetworkIp, NetworkIpArgs
- Address string
- IP address (e.g., '10.17.3.1', 'fd00::1'). Optional - if not specified, one will be derived from the network.
- Dhcp
Network
Ip Dhcp - DHCP server configuration for this IP range.
- Family string
- Address family ('ipv4' or 'ipv6'). Optional - will be auto-detected from address if not specified.
- Local
Ptr string - Whether to generate local PTR records ('yes' or 'no').
- Netmask string
- Network mask for IPv4 (e.g., '255.255.255.0'). Mutually exclusive with prefix.
- Prefix double
- Network prefix length (e.g., 24 for 255.255.255.0, 64 for IPv6). Mutually exclusive with netmask.
- Address string
- IP address (e.g., '10.17.3.1', 'fd00::1'). Optional - if not specified, one will be derived from the network.
- Dhcp
Network
Ip Dhcp - DHCP server configuration for this IP range.
- Family string
- Address family ('ipv4' or 'ipv6'). Optional - will be auto-detected from address if not specified.
- Local
Ptr string - Whether to generate local PTR records ('yes' or 'no').
- Netmask string
- Network mask for IPv4 (e.g., '255.255.255.0'). Mutually exclusive with prefix.
- Prefix float64
- Network prefix length (e.g., 24 for 255.255.255.0, 64 for IPv6). Mutually exclusive with netmask.
- address String
- IP address (e.g., '10.17.3.1', 'fd00::1'). Optional - if not specified, one will be derived from the network.
- dhcp
Network
Ip Dhcp - DHCP server configuration for this IP range.
- family String
- Address family ('ipv4' or 'ipv6'). Optional - will be auto-detected from address if not specified.
- local
Ptr String - Whether to generate local PTR records ('yes' or 'no').
- netmask String
- Network mask for IPv4 (e.g., '255.255.255.0'). Mutually exclusive with prefix.
- prefix Double
- Network prefix length (e.g., 24 for 255.255.255.0, 64 for IPv6). Mutually exclusive with netmask.
- address string
- IP address (e.g., '10.17.3.1', 'fd00::1'). Optional - if not specified, one will be derived from the network.
- dhcp
Network
Ip Dhcp - DHCP server configuration for this IP range.
- family string
- Address family ('ipv4' or 'ipv6'). Optional - will be auto-detected from address if not specified.
- local
Ptr string - Whether to generate local PTR records ('yes' or 'no').
- netmask string
- Network mask for IPv4 (e.g., '255.255.255.0'). Mutually exclusive with prefix.
- prefix number
- Network prefix length (e.g., 24 for 255.255.255.0, 64 for IPv6). Mutually exclusive with netmask.
- address str
- IP address (e.g., '10.17.3.1', 'fd00::1'). Optional - if not specified, one will be derived from the network.
- dhcp
Network
Ip Dhcp - DHCP server configuration for this IP range.
- family str
- Address family ('ipv4' or 'ipv6'). Optional - will be auto-detected from address if not specified.
- local_
ptr str - Whether to generate local PTR records ('yes' or 'no').
- netmask str
- Network mask for IPv4 (e.g., '255.255.255.0'). Mutually exclusive with prefix.
- prefix float
- Network prefix length (e.g., 24 for 255.255.255.0, 64 for IPv6). Mutually exclusive with netmask.
- address String
- IP address (e.g., '10.17.3.1', 'fd00::1'). Optional - if not specified, one will be derived from the network.
- dhcp Property Map
- DHCP server configuration for this IP range.
- family String
- Address family ('ipv4' or 'ipv6'). Optional - will be auto-detected from address if not specified.
- local
Ptr String - Whether to generate local PTR records ('yes' or 'no').
- netmask String
- Network mask for IPv4 (e.g., '255.255.255.0'). Mutually exclusive with prefix.
- prefix Number
- Network prefix length (e.g., 24 for 255.255.255.0, 64 for IPv6). Mutually exclusive with netmask.
NetworkIpDhcp, NetworkIpDhcpArgs
- Hosts
List<Network
Ip Dhcp Host> - Static DHCP host entries.
- Ranges
List<Network
Ip Dhcp Range> - DHCP address ranges to hand out.
- Hosts
[]Network
Ip Dhcp Host - Static DHCP host entries.
- Ranges
[]Network
Ip Dhcp Range - DHCP address ranges to hand out.
- hosts
List<Network
Ip Dhcp Host> - Static DHCP host entries.
- ranges
List<Network
Ip Dhcp Range> - DHCP address ranges to hand out.
- hosts
Network
Ip Dhcp Host[] - Static DHCP host entries.
- ranges
Network
Ip Dhcp Range[] - DHCP address ranges to hand out.
- hosts
Sequence[Network
Ip Dhcp Host] - Static DHCP host entries.
- ranges
Sequence[Network
Ip Dhcp Range] - DHCP address ranges to hand out.
- hosts List<Property Map>
- Static DHCP host entries.
- ranges List<Property Map>
- DHCP address ranges to hand out.
NetworkIpDhcpHost, NetworkIpDhcpHostArgs
NetworkIpDhcpRange, NetworkIpDhcpRangeArgs
Package Details
- Repository
- libvirt dmacvicar/terraform-provider-libvirt
- License
- Notes
- This Pulumi package is based on the
libvirtTerraform Provider.
