@muhlba91/pulumi-proxmoxve
Version:
A Pulumi package for creating and managing Proxmox Virtual Environment cloud resources.
184 lines • 6.74 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Subnet = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Manages SDN Subnets in Proxmox VE.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
*
* const finalizer = new proxmoxve.sdn.Applier("finalizer", {});
* // SDN Zone (Simple) - Basic zone for simple vnets
* const exampleZone1 = new proxmoxve.sdn.zone.Simple("example_zone_1", {
* resourceId: "zone1",
* nodes: ["pve"],
* mtu: 1500,
* dns: "1.1.1.1",
* dnsZone: "example.com",
* ipam: "pve",
* reverseDns: "1.1.1.1",
* }, {
* dependsOn: [finalizer],
* });
* // SDN Zone (Simple) - Second zone for demonstration
* const exampleZone2 = new proxmoxve.sdn.zone.Simple("example_zone_2", {
* resourceId: "zone2",
* nodes: ["pve"],
* mtu: 1500,
* }, {
* dependsOn: [finalizer],
* });
* // SDN VNet - Basic vnet
* const exampleVnet1 = new proxmoxve.sdn.Vnet("example_vnet_1", {
* resourceId: "vnet1",
* zone: exampleZone1.resourceId,
* }, {
* dependsOn: [finalizer],
* });
* // SDN VNet - VNet with alias and port isolation
* const exampleVnet2 = new proxmoxve.sdn.Vnet("example_vnet_2", {
* resourceId: "vnet2",
* zone: exampleZone2.resourceId,
* alias: "Example VNet 2",
* isolatePorts: true,
* vlanAware: false,
* }, {
* dependsOn: [finalizer],
* });
* // Basic Subnet
* const basicSubnet = new proxmoxve.sdn.Subnet("basic_subnet", {
* cidr: "192.168.1.0/24",
* vnet: exampleVnet1.resourceId,
* gateway: "192.168.1.1",
* }, {
* dependsOn: [finalizer],
* });
* // Subnet with DHCP Configuration
* const dhcpSubnet = new proxmoxve.sdn.Subnet("dhcp_subnet", {
* cidr: "192.168.2.0/24",
* vnet: exampleVnet2.resourceId,
* gateway: "192.168.2.1",
* dhcpDnsServer: "192.168.2.53",
* dnsZonePrefix: "internal.example.com",
* snat: true,
* dhcpRange: {
* startAddress: "192.168.2.10",
* endAddress: "192.168.2.100",
* },
* }, {
* dependsOn: [finalizer],
* });
* // SDN Applier for all resources
* const subnetApplier = new proxmoxve.sdn.Applier("subnet_applier", {}, {
* dependsOn: [
* exampleZone1,
* exampleZone2,
* exampleVnet1,
* exampleVnet2,
* basicSubnet,
* dhcpSubnet,
* ],
* });
* ```
*
* ## Import
*
* !/usr/bin/env sh
* SDN subnet can be imported using its unique identifier in the format: <vnet>/<subnet-id>
* The <subnet-id> is the canonical ID from Proxmox, e.g., "zone1-192.168.1.0-24"
*
* ```sh
* $ pulumi import proxmoxve:sdn/subnet:Subnet basic_subnet vnet1/zone1-192.168.1.0-24
* $ pulumi import proxmoxve:sdn/subnet:Subnet dhcp_subnet vnet2/zone2-192.168.2.0-24
* ```
*/
class Subnet extends pulumi.CustomResource {
/**
* Get an existing Subnet 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, id, state, opts) {
return new Subnet(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'proxmoxve:sdn/subnet:Subnet';
/**
* Returns true if the given object is an instance of Subnet. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Subnet.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["cidr"] = state?.cidr;
resourceInputs["dhcpDnsServer"] = state?.dhcpDnsServer;
resourceInputs["dhcpRange"] = state?.dhcpRange;
resourceInputs["dnsZonePrefix"] = state?.dnsZonePrefix;
resourceInputs["gateway"] = state?.gateway;
resourceInputs["snat"] = state?.snat;
resourceInputs["vnet"] = state?.vnet;
}
else {
const args = argsOrState;
if (args?.cidr === undefined && !opts.urn) {
throw new Error("Missing required property 'cidr'");
}
if (args?.vnet === undefined && !opts.urn) {
throw new Error("Missing required property 'vnet'");
}
resourceInputs["cidr"] = args?.cidr;
resourceInputs["dhcpDnsServer"] = args?.dhcpDnsServer;
resourceInputs["dhcpRange"] = args?.dhcpRange;
resourceInputs["dnsZonePrefix"] = args?.dnsZonePrefix;
resourceInputs["gateway"] = args?.gateway;
resourceInputs["snat"] = args?.snat;
resourceInputs["vnet"] = args?.vnet;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Subnet.__pulumiType, name, resourceInputs, opts);
}
}
exports.Subnet = Subnet;
//# sourceMappingURL=subnet.js.map