@lbrlabs/pulumi-scaleway
Version:
A Pulumi package for creating and managing scaleway cloud resources.
160 lines • 6.93 kB
JavaScript
;
// *** 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.VpcGatewayNetwork = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Creates and manages Scaleway VPC Public Gateway Network.
* It allows attaching Private Networks to the VPC Public Gateway and your DHCP config
* For more information, see [the documentation](https://developers.scaleway.com/en/products/vpc-gw/api/v1/#step-3-attach-private-networks-to-the-vpc-public-gateway).
*
* ## Example
*
* ### Create a gateway network with DHCP
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const pn01 = new scaleway.VpcPrivateNetwork("pn01", {});
* const gw01 = new scaleway.VpcPublicGatewayIp("gw01", {});
* const dhcp01 = new scaleway.VpcPublicGatewayDhcp("dhcp01", {
* subnet: "192.168.1.0/24",
* pushDefaultRoute: true,
* });
* const pg01 = new scaleway.VpcPublicGateway("pg01", {
* type: "VPC-GW-S",
* ipId: gw01.id,
* });
* const main = new scaleway.VpcGatewayNetwork("main", {
* gatewayId: pg01.id,
* privateNetworkId: pn01.id,
* dhcpId: dhcp01.id,
* cleanupDhcp: true,
* enableMasquerade: true,
* });
* ```
*
* ### Create a gateway network with a static IP address
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const pn01 = new scaleway.VpcPrivateNetwork("pn01", {});
* const pg01 = new scaleway.VpcPublicGateway("pg01", {type: "VPC-GW-S"});
* const main = new scaleway.VpcGatewayNetwork("main", {
* gatewayId: pg01.id,
* privateNetworkId: pn01.id,
* enableDhcp: false,
* enableMasquerade: true,
* staticAddress: "192.168.1.42/24",
* });
* ```
*
* ### Create a gateway network with IPAM config
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const vpc01 = new scaleway.Vpc("vpc01", {});
* const pn01 = new scaleway.VpcPrivateNetwork("pn01", {
* ipv4Subnet: {
* subnet: "172.16.64.0/22",
* },
* vpcId: vpc01.id,
* });
* const pg01 = new scaleway.VpcPublicGateway("pg01", {type: "VPC-GW-S"});
* const main = new scaleway.VpcGatewayNetwork("main", {
* gatewayId: pg01.id,
* privateNetworkId: pn01.id,
* enableMasquerade: true,
* ipamConfigs: [{
* pushDefaultRoute: true,
* }],
* });
* ```
*
* ## Import
*
* Gateway network can be imported using the `{zone}/{id}`, e.g. bash
*
* ```sh
* $ pulumi import scaleway:index/vpcGatewayNetwork:VpcGatewayNetwork main fr-par-1/11111111-1111-1111-1111-111111111111
* ```
*/
class VpcGatewayNetwork extends pulumi.CustomResource {
/**
* Get an existing VpcGatewayNetwork 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 VpcGatewayNetwork(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of VpcGatewayNetwork. 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'] === VpcGatewayNetwork.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["cleanupDhcp"] = state ? state.cleanupDhcp : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["dhcpId"] = state ? state.dhcpId : undefined;
resourceInputs["enableDhcp"] = state ? state.enableDhcp : undefined;
resourceInputs["enableMasquerade"] = state ? state.enableMasquerade : undefined;
resourceInputs["gatewayId"] = state ? state.gatewayId : undefined;
resourceInputs["ipamConfigs"] = state ? state.ipamConfigs : undefined;
resourceInputs["macAddress"] = state ? state.macAddress : undefined;
resourceInputs["privateNetworkId"] = state ? state.privateNetworkId : undefined;
resourceInputs["staticAddress"] = state ? state.staticAddress : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["updatedAt"] = state ? state.updatedAt : undefined;
resourceInputs["zone"] = state ? state.zone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.gatewayId === undefined) && !opts.urn) {
throw new Error("Missing required property 'gatewayId'");
}
if ((!args || args.privateNetworkId === undefined) && !opts.urn) {
throw new Error("Missing required property 'privateNetworkId'");
}
resourceInputs["cleanupDhcp"] = args ? args.cleanupDhcp : undefined;
resourceInputs["dhcpId"] = args ? args.dhcpId : undefined;
resourceInputs["enableDhcp"] = args ? args.enableDhcp : undefined;
resourceInputs["enableMasquerade"] = args ? args.enableMasquerade : undefined;
resourceInputs["gatewayId"] = args ? args.gatewayId : undefined;
resourceInputs["ipamConfigs"] = args ? args.ipamConfigs : undefined;
resourceInputs["privateNetworkId"] = args ? args.privateNetworkId : undefined;
resourceInputs["staticAddress"] = args ? args.staticAddress : undefined;
resourceInputs["zone"] = args ? args.zone : undefined;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["macAddress"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VpcGatewayNetwork.__pulumiType, name, resourceInputs, opts);
}
}
exports.VpcGatewayNetwork = VpcGatewayNetwork;
/** @internal */
VpcGatewayNetwork.__pulumiType = 'scaleway:index/vpcGatewayNetwork:VpcGatewayNetwork';
//# sourceMappingURL=vpcGatewayNetwork.js.map