@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
238 lines • 8.65 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.InstanceGroup = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Books and manages Autoscaling Instance groups.
*
* ## Example Usage
*
* ### Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const main = new scaleway.autoscaling.InstanceGroup("main", {
* name: "asg-group",
* templateId: mainScalewayAutoscalingInstanceTemplate.id,
* tags: [
* "terraform-test",
* "instance-group",
* ],
* capacities: [{
* maxReplicas: 5,
* minReplicas: 1,
* cooldownDelay: 300,
* }],
* loadBalancers: [{
* id: mainScalewayLb.id,
* backendIds: [mainScalewayLbBackend.id],
* privateNetworkId: mainScalewayVpcPrivateNetwork.id,
* }],
* });
* ```
*
* ### With template and policies
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const main = new scaleway.network.Vpc("main", {name: "TestAccAutoscalingVPC"});
* const mainPrivateNetwork = new scaleway.network.PrivateNetwork("main", {
* name: "TestAccAutoscalingVPC",
* vpcId: main.id,
* });
* const mainVolume = new scaleway.block.Volume("main", {
* iops: 5000,
* sizeInGb: 10,
* });
* const mainSnapshot = new scaleway.block.Snapshot("main", {
* name: "test-ds-block-snapshot-basic",
* volumeId: mainVolume.id,
* });
* const mainIp = new scaleway.loadbalancers.Ip("main", {});
* const mainLoadBalancer = new scaleway.loadbalancers.LoadBalancer("main", {
* ipId: mainIp.id,
* name: "test-lb",
* type: "lb-s",
* privateNetworks: [{
* privateNetworkId: mainPrivateNetwork.id,
* }],
* });
* const mainBackend = new scaleway.loadbalancers.Backend("main", {
* lbId: mainLoadBalancer.id,
* forwardProtocol: "tcp",
* forwardPort: 80,
* proxyProtocol: "none",
* });
* const mainInstanceTemplate = new scaleway.autoscaling.InstanceTemplate("main", {
* name: "autoscaling-instance-template-basic",
* commercialType: "PLAY2-MICRO",
* tags: [
* "terraform-test",
* "basic",
* ],
* volumes: [{
* name: "as-volume",
* volumeType: "sbs",
* boot: true,
* fromSnapshot: {
* snapshotId: mainSnapshot.id,
* },
* perfIops: 5000,
* }],
* publicIpsV4Count: 1,
* privateNetworkIds: [mainPrivateNetwork.id],
* });
* const mainInstanceGroup = new scaleway.autoscaling.InstanceGroup("main", {
* name: "autoscaling-instance-group-basic",
* templateId: mainInstanceTemplate.id,
* tags: [
* "terraform-test",
* "instance-group",
* ],
* capacities: [{
* maxReplicas: 5,
* minReplicas: 1,
* cooldownDelay: 300,
* }],
* loadBalancers: [{
* id: mainLoadBalancer.id,
* backendIds: [mainBackend.id],
* privateNetworkId: mainPrivateNetwork.id,
* }],
* deleteServersOnDestroy: true,
* });
* const up = new scaleway.autoscaling.InstancePolicy("up", {
* instanceGroupId: mainInstanceGroup.id,
* name: "scale-up-if-cpu-high",
* action: "scale_up",
* type: "flat_count",
* value: 1,
* priority: 1,
* metrics: [{
* name: "cpu scale up",
* managedMetric: "managed_metric_instance_cpu",
* operator: "operator_greater_than",
* aggregate: "aggregate_average",
* samplingRangeMin: 5,
* threshold: 70,
* }],
* });
* const down = new scaleway.autoscaling.InstancePolicy("down", {
* instanceGroupId: mainInstanceGroup.id,
* name: "scale-down-if-cpu-low",
* action: "scale_down",
* type: "flat_count",
* value: 1,
* priority: 2,
* metrics: [{
* name: "cpu scale down",
* managedMetric: "managed_metric_instance_cpu",
* operator: "operator_less_than",
* aggregate: "aggregate_average",
* samplingRangeMin: 5,
* threshold: 40,
* }],
* });
* ```
*
* ## Import
*
* Autoscaling Instance groups can be imported using `{zone}/{id}`, e.g.
*
* ```sh
* $ pulumi import scaleway:autoscaling/instanceGroup:InstanceGroup main fr-par-1/11111111-1111-1111-1111-111111111111
* ```
*/
class InstanceGroup extends pulumi.CustomResource {
/**
* Get an existing InstanceGroup 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 InstanceGroup(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'scaleway:autoscaling/instanceGroup:InstanceGroup';
/**
* Returns true if the given object is an instance of InstanceGroup. 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'] === InstanceGroup.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["capacities"] = state?.capacities;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["deleteServersOnDestroy"] = state?.deleteServersOnDestroy;
resourceInputs["loadBalancers"] = state?.loadBalancers;
resourceInputs["name"] = state?.name;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["tags"] = state?.tags;
resourceInputs["templateId"] = state?.templateId;
resourceInputs["updatedAt"] = state?.updatedAt;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.templateId === undefined && !opts.urn) {
throw new Error("Missing required property 'templateId'");
}
resourceInputs["capacities"] = args?.capacities;
resourceInputs["deleteServersOnDestroy"] = args?.deleteServersOnDestroy;
resourceInputs["loadBalancers"] = args?.loadBalancers;
resourceInputs["name"] = args?.name;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["tags"] = args?.tags;
resourceInputs["templateId"] = args?.templateId;
resourceInputs["zone"] = args?.zone;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(InstanceGroup.__pulumiType, name, resourceInputs, opts);
}
}
exports.InstanceGroup = InstanceGroup;
//# sourceMappingURL=instanceGroup.js.map