@pulumi/libvirt
Version:
A Pulumi package for creating and managing libvirt cloud resources.
269 lines (268 loc) • 12.1 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Manages a VM network resource within libvirt. For more information see
* [the official documentation](https://libvirt.org/formatnetwork.html).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as libvirt from "@pulumi/libvirt";
*
* const kubeNetwork = new libvirt.Network("kube_network", {
* name: "k8snet",
* mode: "nat",
* domain: "k8s.local",
* addresses: [
* "10.17.3.0/24",
* "2001:db8:ca2:2::1/64",
* ],
* dns: {
* enabled: true,
* localOnly: true,
* },
* dnsmasqOptions: {},
* });
* ```
*/
export declare class Network extends pulumi.CustomResource {
/**
* Get an existing Network resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: NetworkState, opts?: pulumi.CustomResourceOptions): Network;
/**
* Returns true if the given object is an instance of Network. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Network;
/**
* A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in
* CIDR notation. This defines the subnets associated to that network.
* This argument is also used to define the address on the real host.
* If `dhcp { enabled = true }` addresses is also used to define the address range served by
* the DHCP server.
* No DHCP server will be started if `addresses` is omitted.
*/
readonly addresses: pulumi.Output<string[] | undefined>;
/**
* Set to `true` to start the network on host boot up.
* If not specified `false` is assumed.
*/
readonly autostart: pulumi.Output<boolean>;
/**
* The bridge device defines the name of a bridge
* device which will be used to construct the virtual network (when not provided,
* it will be automatically obtained by libvirt in `none`, `nat`, `route` and `open` modes).
*/
readonly bridge: pulumi.Output<string>;
readonly dhcp: pulumi.Output<outputs.NetworkDhcp>;
/**
* configuration of DNS specific settings for the network
*/
readonly dns: pulumi.Output<outputs.NetworkDns>;
readonly dnsmasqOptions: pulumi.Output<outputs.NetworkDnsmasqOptions | undefined>;
/**
* The domain used by the DNS server.
*/
readonly domain: pulumi.Output<string | undefined>;
/**
* One of:
* - "none": the guests can talk to each other and the host OS, but cannot reach
* any other machines on the LAN.
* - "nat": it is the default network mode. This is a configuration that
* allows guest OS to get outbound connectivity regardless of whether the host
* uses ethernet, wireless, dialup, or VPN networking without requiring any
* specific admin configuration. In the absence of host networking, it at
* least allows guests to talk directly to each other.
* - "route": this is a variant on the default network which routes traffic from
* the virtual network to the LAN **without applying any NAT**. It requires that
* the IP address range be pre-configured in the routing tables of the router
* on the host network.
* - "open": similar to `route`, but no firewall rules are added.
* - "bridge": use a pre-existing host bridge. The guests will effectively be
* directly connected to the physical network (i.e. their IP addresses will
* all be on the subnet of the physical network, and there will be no
* restrictions on inbound or outbound connections). The `bridge` network
* attribute is mandatory in this case.
*/
readonly mode: pulumi.Output<string | undefined>;
/**
* The MTU to set for the underlying network interfaces. When
* not supplied, libvirt will use the default for the interface, usually 1500.
* Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
*/
readonly mtu: pulumi.Output<number | undefined>;
/**
* A unique name for the resource, required by libvirt.
* Changing this forces a new resource to be created.
*/
readonly name: pulumi.Output<string>;
/**
* a list of static routes. A `cidr` and a `gateway` must
* be provided. The `gateway` must be reachable via the bridge interface.
*/
readonly routes: pulumi.Output<outputs.NetworkRoute[] | undefined>;
readonly xml: pulumi.Output<outputs.NetworkXml | undefined>;
/**
* Create a Network resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args?: NetworkArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Network resources.
*/
export interface NetworkState {
/**
* A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in
* CIDR notation. This defines the subnets associated to that network.
* This argument is also used to define the address on the real host.
* If `dhcp { enabled = true }` addresses is also used to define the address range served by
* the DHCP server.
* No DHCP server will be started if `addresses` is omitted.
*/
addresses?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Set to `true` to start the network on host boot up.
* If not specified `false` is assumed.
*/
autostart?: pulumi.Input<boolean>;
/**
* The bridge device defines the name of a bridge
* device which will be used to construct the virtual network (when not provided,
* it will be automatically obtained by libvirt in `none`, `nat`, `route` and `open` modes).
*/
bridge?: pulumi.Input<string>;
dhcp?: pulumi.Input<inputs.NetworkDhcp>;
/**
* configuration of DNS specific settings for the network
*/
dns?: pulumi.Input<inputs.NetworkDns>;
dnsmasqOptions?: pulumi.Input<inputs.NetworkDnsmasqOptions>;
/**
* The domain used by the DNS server.
*/
domain?: pulumi.Input<string>;
/**
* One of:
* - "none": the guests can talk to each other and the host OS, but cannot reach
* any other machines on the LAN.
* - "nat": it is the default network mode. This is a configuration that
* allows guest OS to get outbound connectivity regardless of whether the host
* uses ethernet, wireless, dialup, or VPN networking without requiring any
* specific admin configuration. In the absence of host networking, it at
* least allows guests to talk directly to each other.
* - "route": this is a variant on the default network which routes traffic from
* the virtual network to the LAN **without applying any NAT**. It requires that
* the IP address range be pre-configured in the routing tables of the router
* on the host network.
* - "open": similar to `route`, but no firewall rules are added.
* - "bridge": use a pre-existing host bridge. The guests will effectively be
* directly connected to the physical network (i.e. their IP addresses will
* all be on the subnet of the physical network, and there will be no
* restrictions on inbound or outbound connections). The `bridge` network
* attribute is mandatory in this case.
*/
mode?: pulumi.Input<string>;
/**
* The MTU to set for the underlying network interfaces. When
* not supplied, libvirt will use the default for the interface, usually 1500.
* Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
*/
mtu?: pulumi.Input<number>;
/**
* A unique name for the resource, required by libvirt.
* Changing this forces a new resource to be created.
*/
name?: pulumi.Input<string>;
/**
* a list of static routes. A `cidr` and a `gateway` must
* be provided. The `gateway` must be reachable via the bridge interface.
*/
routes?: pulumi.Input<pulumi.Input<inputs.NetworkRoute>[]>;
xml?: pulumi.Input<inputs.NetworkXml>;
}
/**
* The set of arguments for constructing a Network resource.
*/
export interface NetworkArgs {
/**
* A list of (0 or 1) IPv4 and (0 or 1) IPv6 subnets in
* CIDR notation. This defines the subnets associated to that network.
* This argument is also used to define the address on the real host.
* If `dhcp { enabled = true }` addresses is also used to define the address range served by
* the DHCP server.
* No DHCP server will be started if `addresses` is omitted.
*/
addresses?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Set to `true` to start the network on host boot up.
* If not specified `false` is assumed.
*/
autostart?: pulumi.Input<boolean>;
/**
* The bridge device defines the name of a bridge
* device which will be used to construct the virtual network (when not provided,
* it will be automatically obtained by libvirt in `none`, `nat`, `route` and `open` modes).
*/
bridge?: pulumi.Input<string>;
dhcp?: pulumi.Input<inputs.NetworkDhcp>;
/**
* configuration of DNS specific settings for the network
*/
dns?: pulumi.Input<inputs.NetworkDns>;
dnsmasqOptions?: pulumi.Input<inputs.NetworkDnsmasqOptions>;
/**
* The domain used by the DNS server.
*/
domain?: pulumi.Input<string>;
/**
* One of:
* - "none": the guests can talk to each other and the host OS, but cannot reach
* any other machines on the LAN.
* - "nat": it is the default network mode. This is a configuration that
* allows guest OS to get outbound connectivity regardless of whether the host
* uses ethernet, wireless, dialup, or VPN networking without requiring any
* specific admin configuration. In the absence of host networking, it at
* least allows guests to talk directly to each other.
* - "route": this is a variant on the default network which routes traffic from
* the virtual network to the LAN **without applying any NAT**. It requires that
* the IP address range be pre-configured in the routing tables of the router
* on the host network.
* - "open": similar to `route`, but no firewall rules are added.
* - "bridge": use a pre-existing host bridge. The guests will effectively be
* directly connected to the physical network (i.e. their IP addresses will
* all be on the subnet of the physical network, and there will be no
* restrictions on inbound or outbound connections). The `bridge` network
* attribute is mandatory in this case.
*/
mode?: pulumi.Input<string>;
/**
* The MTU to set for the underlying network interfaces. When
* not supplied, libvirt will use the default for the interface, usually 1500.
* Libvirt version 5.1 and greater will advertise this value to nodes via DHCP.
*/
mtu?: pulumi.Input<number>;
/**
* A unique name for the resource, required by libvirt.
* Changing this forces a new resource to be created.
*/
name?: pulumi.Input<string>;
/**
* a list of static routes. A `cidr` and a `gateway` must
* be provided. The `gateway` must be reachable via the bridge interface.
*/
routes?: pulumi.Input<pulumi.Input<inputs.NetworkRoute>[]>;
xml?: pulumi.Input<inputs.NetworkXml>;
}