@lbrlabs/pulumi-scaleway
Version:
A Pulumi package for creating and managing scaleway cloud resources.
212 lines • 8.23 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.Loadbalancer = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Creates and manages Scaleway Load-Balancers.
* For more information, see [the documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api).
*
* ## Examples
*
* ### Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const main = new scaleway.LoadbalancerIp("main", {zone: "fr-par-1"});
* const base = new scaleway.Loadbalancer("base", {
* ipId: main.id,
* zone: main.zone,
* type: "LB-S",
* });
* ```
*
* ### Private LB
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const base = new scaleway.Loadbalancer("base", {
* ipId: scaleway_lb_ip.main.id,
* zone: scaleway_lb_ip.main.zone,
* type: "LB-S",
* assignFlexibleIp: false,
* });
* ```
*
* ### IP for Public Gateway
* resource "scaleway_vpc_public_gateway_ip" "main" {
* }
*
* ### Scaleway Private Network
* resource scaleway_vpc_private_network main {
* }
*
* ### VPC Public Gateway Network
* resource "scaleway_vpc_public_gateway" "main" {
* name = "tf-test-public-gw"
* type = "VPC-GW-S"
* ip_id = scaleway_vpc_public_gateway_ip.main.id
* }
*
* ### VPC Public Gateway Network DHCP config
* resource "scaleway_vpc_public_gateway_dhcp" "main" {
* subnet = "10.0.0.0/24"
* }
*
* ### VPC Gateway Network
* resource "scaleway_vpc_gateway_network" "main" {
* gateway_id = scaleway_vpc_public_gateway.main.id
* private_network_id = scaleway_vpc_private_network.main.id
* dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id
* cleanup_dhcp = true
* enable_masquerade = true
* }
*
* ### Scaleway Instance
* resource "scaleway_instance_server" "main" {
* name = "Scaleway Terraform Provider"
* type = "DEV1-S"
* image = "debian_bullseye"
* enable_ipv6 = false
*
* private_network {
* pn_id = scaleway_vpc_private_network.main.id
* }
* }
*
* ### IP for LB IP
* resource scaleway_lb_ip main {
* }
*
* ### Scaleway Private Network
* resource scaleway_vpc_private_network "main" {
* name = "private network with static config"
* }
*
* ## Migration
*
* In order to migrate to other types you can check the migration up or down via our CLI `scw lb lb-types list`.
* this change will not recreate your Load Balancer.
*
* Please check our [documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-load-balancer-migrate-a-load-balancer) for further details
*
* ## IP ID
*
* Since v1.15.0, `ipId` is a required field. This means that now a separate `scaleway.LoadbalancerIp` is required.
* When importing, the IP needs to be imported as well as the LB.
* When upgrading to v1.15.0, you will need to create a new `scaleway.LoadbalancerIp` resource and import it.
*
* For instance, if you had the following:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const main = new scaleway.Loadbalancer("main", {
* type: "LB-S",
* zone: "fr-par-1",
* });
* ```
*
* You will need to update it to:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const mainLoadbalancerIp = new scaleway.LoadbalancerIp("mainLoadbalancerIp", {});
* const mainLoadbalancer = new scaleway.Loadbalancer("mainLoadbalancer", {
* ipId: mainLoadbalancerIp.id,
* zone: "fr-par-1",
* type: "LB-S",
* releaseIp: false,
* });
* ```
*
* ## Import
*
* Load-Balancer can be imported using the `{zone}/{id}`, e.g. bash
*
* ```sh
* $ pulumi import scaleway:index/loadbalancer:Loadbalancer main fr-par-1/11111111-1111-1111-1111-111111111111
* ```
*
* Be aware that you will also need to import the `scaleway_lb_ip` resource.
*/
class Loadbalancer extends pulumi.CustomResource {
/**
* Get an existing Loadbalancer 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 Loadbalancer(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Loadbalancer. 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'] === Loadbalancer.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["assignFlexibleIp"] = state ? state.assignFlexibleIp : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["ipAddress"] = state ? state.ipAddress : undefined;
resourceInputs["ipId"] = state ? state.ipId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["organizationId"] = state ? state.organizationId : undefined;
resourceInputs["privateNetworks"] = state ? state.privateNetworks : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["releaseIp"] = state ? state.releaseIp : undefined;
resourceInputs["sslCompatibilityLevel"] = state ? state.sslCompatibilityLevel : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["zone"] = state ? state.zone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["assignFlexibleIp"] = args ? args.assignFlexibleIp : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["ipId"] = args ? args.ipId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["privateNetworks"] = args ? args.privateNetworks : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["releaseIp"] = args ? args.releaseIp : undefined;
resourceInputs["sslCompatibilityLevel"] = args ? args.sslCompatibilityLevel : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["zone"] = args ? args.zone : undefined;
resourceInputs["ipAddress"] = undefined /*out*/;
resourceInputs["organizationId"] = undefined /*out*/;
resourceInputs["region"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Loadbalancer.__pulumiType, name, resourceInputs, opts);
}
}
exports.Loadbalancer = Loadbalancer;
/** @internal */
Loadbalancer.__pulumiType = 'scaleway:index/loadbalancer:Loadbalancer';
//# sourceMappingURL=loadbalancer.js.map