UNPKG

@lbrlabs/pulumi-scaleway

Version:

A Pulumi package for creating and managing scaleway cloud resources.

304 lines 12.1 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.InstanceServer = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Creates and manages Scaleway Compute Instance servers. For more information, see [the documentation](https://developers.scaleway.com/en/products/instance/api/#servers-8bf7d7). * * Please check our [FAQ - Instances](https://www.scaleway.com/en/docs/faq/instances). * * ## Examples * * ### Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const publicIp = new scaleway.InstanceIp("publicIp", {}); * const web = new scaleway.InstanceServer("web", { * type: "DEV1-S", * image: "ubuntu_jammy", * ipId: publicIp.id, * }); * ``` * * ### With additional volumes and tags * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const data = new scaleway.InstanceVolume("data", { * sizeInGb: 100, * type: "b_ssd", * }); * const web = new scaleway.InstanceServer("web", { * type: "DEV1-S", * image: "ubuntu_jammy", * tags: [ * "hello", * "public", * ], * rootVolume: { * deleteOnTermination: false, * }, * additionalVolumeIds: [data.id], * }); * ``` * * ### With a reserved IP * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const ip = new scaleway.InstanceIp("ip", {}); * const web = new scaleway.InstanceServer("web", { * type: "DEV1-S", * image: "f974feac-abae-4365-b988-8ec7d1cec10d", * tags: [ * "hello", * "public", * ], * ipId: ip.id, * }); * ``` * * ### With security group * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const www = new scaleway.InstanceSecurityGroup("www", { * inboundDefaultPolicy: "drop", * outboundDefaultPolicy: "accept", * inboundRules: [ * { * action: "accept", * port: 22, * ip: "212.47.225.64", * }, * { * action: "accept", * port: 80, * }, * { * action: "accept", * port: 443, * }, * ], * outboundRules: [{ * action: "drop", * ipRange: "10.20.0.0/24", * }], * }); * const web = new scaleway.InstanceServer("web", { * type: "DEV1-S", * image: "ubuntu_jammy", * securityGroupId: www.id, * }); * ``` * * ### With user data and cloud-init * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as fs from "fs"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const web = new scaleway.InstanceServer("web", { * type: "DEV1-S", * image: "ubuntu_jammy", * userData: { * foo: "bar", * "cloud-init": fs.readFileSync(`${path.module}/cloud-init.yml`), * }, * }); * ``` * * ### With private network * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const pn01 = new scaleway.VpcPrivateNetwork("pn01", {}); * const base = new scaleway.InstanceServer("base", { * image: "ubuntu_jammy", * type: "DEV1-S", * privateNetworks: [{ * pnId: pn01.id, * }], * }); * ``` * * ### Root volume configuration * * #### Resized block volume with installed image * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const image = new scaleway.InstanceServer("image", { * image: "ubuntu_jammy", * rootVolume: { * sizeInGb: 100, * volumeType: "b_ssd", * }, * type: "PRO2-XXS", * }); * ``` * * #### From snapshot * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * import * as scaleway from "@pulumi/scaleway"; * * const snapshot = scaleway.getInstanceSnapshot({ * name: "my_snapshot", * }); * const fromSnapshotInstanceVolume = new scaleway.InstanceVolume("fromSnapshotInstanceVolume", { * fromSnapshotId: snapshot.then(snapshot => snapshot.id), * type: "b_ssd", * }); * const fromSnapshotInstanceServer = new scaleway.InstanceServer("fromSnapshotInstanceServer", { * type: "PRO2-XXS", * rootVolume: { * volumeId: fromSnapshotInstanceVolume.id, * }, * }); * ``` * * ## Private Network * * > **Important:** Updates to `privateNetwork` will recreate a new private network interface. * * - `pnId` - (Required) The private network ID where to connect. * - `macAddress` The private NIC MAC address. * - `status` The private NIC state. * - `zone` - (Defaults to provider `zone`) The zone in which the server must be created. * * > **Important:** * * - You can only attach an instance in the same zone as a private network. * - Instance supports maximum 8 different private networks. * * ## Import * * Instance servers can be imported using the `{zone}/{id}`, e.g. bash * * ```sh * $ pulumi import scaleway:index/instanceServer:InstanceServer web fr-par-1/11111111-1111-1111-1111-111111111111 * ``` */ class InstanceServer extends pulumi.CustomResource { /** * Get an existing InstanceServer 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 InstanceServer(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of InstanceServer. 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'] === InstanceServer.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["additionalVolumeIds"] = state ? state.additionalVolumeIds : undefined; resourceInputs["bootType"] = state ? state.bootType : undefined; resourceInputs["bootscriptId"] = state ? state.bootscriptId : undefined; resourceInputs["cloudInit"] = state ? state.cloudInit : undefined; resourceInputs["enableDynamicIp"] = state ? state.enableDynamicIp : undefined; resourceInputs["enableIpv6"] = state ? state.enableIpv6 : undefined; resourceInputs["image"] = state ? state.image : undefined; resourceInputs["ipId"] = state ? state.ipId : undefined; resourceInputs["ipIds"] = state ? state.ipIds : undefined; resourceInputs["ipv6Address"] = state ? state.ipv6Address : undefined; resourceInputs["ipv6Gateway"] = state ? state.ipv6Gateway : undefined; resourceInputs["ipv6PrefixLength"] = state ? state.ipv6PrefixLength : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["organizationId"] = state ? state.organizationId : undefined; resourceInputs["placementGroupId"] = state ? state.placementGroupId : undefined; resourceInputs["placementGroupPolicyRespected"] = state ? state.placementGroupPolicyRespected : undefined; resourceInputs["privateIp"] = state ? state.privateIp : undefined; resourceInputs["privateNetworks"] = state ? state.privateNetworks : undefined; resourceInputs["projectId"] = state ? state.projectId : undefined; resourceInputs["publicIp"] = state ? state.publicIp : undefined; resourceInputs["publicIps"] = state ? state.publicIps : undefined; resourceInputs["replaceOnTypeChange"] = state ? state.replaceOnTypeChange : undefined; resourceInputs["rootVolume"] = state ? state.rootVolume : undefined; resourceInputs["routedIpEnabled"] = state ? state.routedIpEnabled : undefined; resourceInputs["securityGroupId"] = state ? state.securityGroupId : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["userData"] = state ? state.userData : 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["additionalVolumeIds"] = args ? args.additionalVolumeIds : undefined; resourceInputs["bootType"] = args ? args.bootType : undefined; resourceInputs["bootscriptId"] = args ? args.bootscriptId : undefined; resourceInputs["cloudInit"] = args ? args.cloudInit : undefined; resourceInputs["enableDynamicIp"] = args ? args.enableDynamicIp : undefined; resourceInputs["enableIpv6"] = args ? args.enableIpv6 : undefined; resourceInputs["image"] = args ? args.image : undefined; resourceInputs["ipId"] = args ? args.ipId : undefined; resourceInputs["ipIds"] = args ? args.ipIds : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["placementGroupId"] = args ? args.placementGroupId : undefined; resourceInputs["privateNetworks"] = args ? args.privateNetworks : undefined; resourceInputs["projectId"] = args ? args.projectId : undefined; resourceInputs["publicIps"] = args ? args.publicIps : undefined; resourceInputs["replaceOnTypeChange"] = args ? args.replaceOnTypeChange : undefined; resourceInputs["rootVolume"] = args ? args.rootVolume : undefined; resourceInputs["routedIpEnabled"] = args ? args.routedIpEnabled : undefined; resourceInputs["securityGroupId"] = args ? args.securityGroupId : undefined; resourceInputs["state"] = args ? args.state : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["userData"] = args ? args.userData : undefined; resourceInputs["zone"] = args ? args.zone : undefined; resourceInputs["ipv6Address"] = undefined /*out*/; resourceInputs["ipv6Gateway"] = undefined /*out*/; resourceInputs["ipv6PrefixLength"] = undefined /*out*/; resourceInputs["organizationId"] = undefined /*out*/; resourceInputs["placementGroupPolicyRespected"] = undefined /*out*/; resourceInputs["privateIp"] = undefined /*out*/; resourceInputs["publicIp"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(InstanceServer.__pulumiType, name, resourceInputs, opts); } } exports.InstanceServer = InstanceServer; /** @internal */ InstanceServer.__pulumiType = 'scaleway:index/instanceServer:InstanceServer'; //# sourceMappingURL=instanceServer.js.map