@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
256 lines (255 loc) • 8.79 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Provides a VMware vSphere vnic resource.
*
* ## Example Usage
*
* ### Create a vnic attached to a distributed virtual switch using the vmotion TCP/IP stack
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenter = vsphere.getDatacenter({
* name: "dc-01",
* });
* const host = datacenter.then(datacenter => vsphere.getHost({
* name: "esxi-01.example.com",
* datacenterId: datacenter.id,
* }));
* const vds = new vsphere.DistributedVirtualSwitch("vds", {
* name: "vds-01",
* datacenterId: datacenter.then(datacenter => datacenter.id),
* hosts: [{
* hostSystemId: host.then(host => host.id),
* devices: ["vnic3"],
* }],
* });
* const pg = new vsphere.DistributedPortGroup("pg", {
* name: "pg-01",
* vlanId: 1234,
* distributedVirtualSwitchUuid: vds.id,
* });
* const vnic = new vsphere.Vnic("vnic", {
* host: host.then(host => host.id),
* distributedSwitchPort: vds.id,
* distributedPortGroup: pg.id,
* ipv4: {
* dhcp: true,
* },
* netstack: "vmotion",
* });
* ```
*
* ### Create a vnic attached to a portgroup using the default TCP/IP stack
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenter = vsphere.getDatacenter({
* name: "dc-01",
* });
* const host = datacenter.then(datacenter => vsphere.getHost({
* name: "esxi-01.example.com",
* datacenterId: datacenter.id,
* }));
* const hvs = new vsphere.HostVirtualSwitch("hvs", {
* name: "hvs-01",
* hostSystemId: host.then(host => host.id),
* networkAdapters: [
* "vmnic3",
* "vmnic4",
* ],
* activeNics: ["vmnic3"],
* standbyNics: ["vmnic4"],
* });
* const pg = new vsphere.HostPortGroup("pg", {
* name: "pg-01",
* virtualSwitchName: hvs.name,
* hostSystemId: host.then(host => host.id),
* });
* const vnic = new vsphere.Vnic("vnic", {
* host: host.then(host => host.id),
* portgroup: pg.name,
* ipv4: {
* dhcp: true,
* },
* services: [
* "vsan",
* "management",
* ],
* });
* ```
*
* ## Import
*
* An existing vNic can be imported into this resource
*
* via supplying the vNic's ID. An example is below:
*
* [docs-import]: /docs/import/index.html
*
* ```sh
* $ pulumi import vsphere:index/vnic:Vnic vnic host-123_vmk2
* ```
*
* The above would import the vnic `vmk2` from host with ID `host-123`.
*/
export declare class Vnic extends pulumi.CustomResource {
/**
* Get an existing Vnic 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?: VnicState, opts?: pulumi.CustomResourceOptions): Vnic;
/**
* Returns true if the given object is an instance of Vnic. 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 Vnic;
/**
* Key of the distributed portgroup the nic will connect to.
*/
readonly distributedPortGroup: pulumi.Output<string | undefined>;
/**
* UUID of the vdswitch the nic will be attached to. Do not set if you set portgroup.
*/
readonly distributedSwitchPort: pulumi.Output<string | undefined>;
/**
* ESX host the interface belongs to
*/
readonly host: pulumi.Output<string>;
/**
* IPv4 settings. Either this or `ipv6` needs to be set. See IPv4 options below.
*/
readonly ipv4: pulumi.Output<outputs.VnicIpv4 | undefined>;
/**
* IPv6 settings. Either this or `ipv6` needs to be set. See IPv6 options below.
*/
readonly ipv6: pulumi.Output<outputs.VnicIpv6 | undefined>;
/**
* MAC address of the interface.
*/
readonly mac: pulumi.Output<string>;
/**
* MTU of the interface.
*/
readonly mtu: pulumi.Output<number>;
/**
* TCP/IP stack setting for this interface. Possible values are `defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:`defaultTcpipStack`)
*/
readonly netstack: pulumi.Output<string | undefined>;
/**
* Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
*/
readonly portgroup: pulumi.Output<string | undefined>;
/**
* Enabled services setting for this interface. Currently support values are `vmotion`, `management`, and `vsan`.
*/
readonly services: pulumi.Output<string[] | undefined>;
/**
* Create a Vnic 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: VnicArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Vnic resources.
*/
export interface VnicState {
/**
* Key of the distributed portgroup the nic will connect to.
*/
distributedPortGroup?: pulumi.Input<string>;
/**
* UUID of the vdswitch the nic will be attached to. Do not set if you set portgroup.
*/
distributedSwitchPort?: pulumi.Input<string>;
/**
* ESX host the interface belongs to
*/
host?: pulumi.Input<string>;
/**
* IPv4 settings. Either this or `ipv6` needs to be set. See IPv4 options below.
*/
ipv4?: pulumi.Input<inputs.VnicIpv4>;
/**
* IPv6 settings. Either this or `ipv6` needs to be set. See IPv6 options below.
*/
ipv6?: pulumi.Input<inputs.VnicIpv6>;
/**
* MAC address of the interface.
*/
mac?: pulumi.Input<string>;
/**
* MTU of the interface.
*/
mtu?: pulumi.Input<number>;
/**
* TCP/IP stack setting for this interface. Possible values are `defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:`defaultTcpipStack`)
*/
netstack?: pulumi.Input<string>;
/**
* Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
*/
portgroup?: pulumi.Input<string>;
/**
* Enabled services setting for this interface. Currently support values are `vmotion`, `management`, and `vsan`.
*/
services?: pulumi.Input<pulumi.Input<string>[]>;
}
/**
* The set of arguments for constructing a Vnic resource.
*/
export interface VnicArgs {
/**
* Key of the distributed portgroup the nic will connect to.
*/
distributedPortGroup?: pulumi.Input<string>;
/**
* UUID of the vdswitch the nic will be attached to. Do not set if you set portgroup.
*/
distributedSwitchPort?: pulumi.Input<string>;
/**
* ESX host the interface belongs to
*/
host: pulumi.Input<string>;
/**
* IPv4 settings. Either this or `ipv6` needs to be set. See IPv4 options below.
*/
ipv4?: pulumi.Input<inputs.VnicIpv4>;
/**
* IPv6 settings. Either this or `ipv6` needs to be set. See IPv6 options below.
*/
ipv6?: pulumi.Input<inputs.VnicIpv6>;
/**
* MAC address of the interface.
*/
mac?: pulumi.Input<string>;
/**
* MTU of the interface.
*/
mtu?: pulumi.Input<number>;
/**
* TCP/IP stack setting for this interface. Possible values are `defaultTcpipStack``, 'vmotion', 'vSphereProvisioning'. Changing this will force the creation of a new interface since it's not possible to change the stack once it gets created. (Default:`defaultTcpipStack`)
*/
netstack?: pulumi.Input<string>;
/**
* Portgroup to attach the nic to. Do not set if you set distributed_switch_port.
*/
portgroup?: pulumi.Input<string>;
/**
* Enabled services setting for this interface. Currently support values are `vmotion`, `management`, and `vsan`.
*/
services?: pulumi.Input<pulumi.Input<string>[]>;
}