UNPKG

@lbrlabs/pulumi-scaleway

Version:

A Pulumi package for creating and managing scaleway cloud resources.

131 lines 6.63 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.VpcPublicGatewayDhcpReservation = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Creates and manages the [Scaleway DHCP Reservations](https://www.scaleway.com/en/docs/network/vpc/concepts/#dhcp). * * The static associations are used to assign IP addresses based on the MAC addresses of the Instance. * * Statically assigned IP addresses should fall within the configured subnet, but be outside of the dynamic range. * * For more information, see [the documentation](https://developers.scaleway.com/en/products/vpc-gw/api/v1/#dhcp-c05544) and [configuration guide](https://www.scaleway.com/en/docs/network/vpc/how-to/configure-a-public-gateway/#how-to-review-and-configure-dhcp). * * [DHCP reservations](https://developers.scaleway.com/en/products/vpc-gw/api/v1/#dhcp-entries-e40fb6) hold both dynamic DHCP leases (IP addresses dynamically assigned by the gateway to instances) and static user-created DHCP reservations. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const mainVpcPrivateNetwork = new scaleway.VpcPrivateNetwork("mainVpcPrivateNetwork", {}); * const mainInstanceServer = new scaleway.InstanceServer("mainInstanceServer", { * image: "ubuntu_jammy", * type: "DEV1-S", * zone: "fr-par-1", * privateNetworks: [{ * pnId: mainVpcPrivateNetwork.id, * }], * }); * const mainVpcPublicGatewayIp = new scaleway.VpcPublicGatewayIp("mainVpcPublicGatewayIp", {}); * const mainVpcPublicGatewayDhcp = new scaleway.VpcPublicGatewayDhcp("mainVpcPublicGatewayDhcp", {subnet: "192.168.1.0/24"}); * const mainVpcPublicGateway = new scaleway.VpcPublicGateway("mainVpcPublicGateway", { * type: "VPC-GW-S", * ipId: mainVpcPublicGatewayIp.id, * }); * const mainVpcGatewayNetwork = new scaleway.VpcGatewayNetwork("mainVpcGatewayNetwork", { * gatewayId: mainVpcPublicGateway.id, * privateNetworkId: mainVpcPrivateNetwork.id, * dhcpId: mainVpcPublicGatewayDhcp.id, * cleanupDhcp: true, * enableMasquerade: true, * }, { * dependsOn: [ * mainVpcPublicGatewayIp, * mainVpcPrivateNetwork, * ], * }); * const mainVpcPublicGatewayDhcpReservation = new scaleway.VpcPublicGatewayDhcpReservation("mainVpcPublicGatewayDhcpReservation", { * gatewayNetworkId: mainVpcGatewayNetwork.id, * macAddress: mainInstanceServer.privateNetworks.apply(privateNetworks => privateNetworks?.[0]?.macAddress), * ipAddress: "192.168.1.1", * }); * ``` * * ## Import * * Public gateway DHCP Reservation config can be imported using the `{zone}/{id}`, e.g. bash * * ```sh * $ pulumi import scaleway:index/vpcPublicGatewayDhcpReservation:VpcPublicGatewayDhcpReservation main fr-par-1/11111111-1111-1111-1111-111111111111 * ``` */ class VpcPublicGatewayDhcpReservation extends pulumi.CustomResource { /** * Get an existing VpcPublicGatewayDhcpReservation 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 VpcPublicGatewayDhcpReservation(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of VpcPublicGatewayDhcpReservation. 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'] === VpcPublicGatewayDhcpReservation.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["gatewayNetworkId"] = state ? state.gatewayNetworkId : undefined; resourceInputs["hostname"] = state ? state.hostname : undefined; resourceInputs["ipAddress"] = state ? state.ipAddress : undefined; resourceInputs["macAddress"] = state ? state.macAddress : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["updatedAt"] = state ? state.updatedAt : undefined; resourceInputs["zone"] = state ? state.zone : undefined; } else { const args = argsOrState; if ((!args || args.gatewayNetworkId === undefined) && !opts.urn) { throw new Error("Missing required property 'gatewayNetworkId'"); } if ((!args || args.ipAddress === undefined) && !opts.urn) { throw new Error("Missing required property 'ipAddress'"); } if ((!args || args.macAddress === undefined) && !opts.urn) { throw new Error("Missing required property 'macAddress'"); } resourceInputs["gatewayNetworkId"] = args ? args.gatewayNetworkId : undefined; resourceInputs["ipAddress"] = args ? args.ipAddress : undefined; resourceInputs["macAddress"] = args ? args.macAddress : undefined; resourceInputs["zone"] = args ? args.zone : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["hostname"] = undefined /*out*/; resourceInputs["type"] = undefined /*out*/; resourceInputs["updatedAt"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(VpcPublicGatewayDhcpReservation.__pulumiType, name, resourceInputs, opts); } } exports.VpcPublicGatewayDhcpReservation = VpcPublicGatewayDhcpReservation; /** @internal */ VpcPublicGatewayDhcpReservation.__pulumiType = 'scaleway:index/vpcPublicGatewayDhcpReservation:VpcPublicGatewayDhcpReservation'; //# sourceMappingURL=vpcPublicGatewayDhcpReservation.js.map