UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

308 lines 12.2 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.Server = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Creates and manages Scaleway compute Instances. For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/instance/#path-instances-list-all-instances). * * Please check our [FAQ - Instances](https://www.scaleway.com/en/docs/faq/instances). * * ## Example Usage * * ### Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const publicIp = new scaleway.instance.Ip("public_ip", {}); * const web = new scaleway.instance.Server("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 "@pulumiverse/scaleway"; * * const data = new scaleway.block.Volume("data", { * sizeInGb: 100, * iops: 5000, * }); * const web = new scaleway.instance.Server("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 "@pulumiverse/scaleway"; * * const ip = new scaleway.instance.Ip("ip", {}); * const web = new scaleway.instance.Server("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 "@pulumiverse/scaleway"; * * const www = new scaleway.instance.SecurityGroup("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.instance.Server("web", { * type: "DEV1-S", * image: "ubuntu_jammy", * securityGroupId: www.id, * }); * ``` * * ### With private network * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const pn01 = new scaleway.network.PrivateNetwork("pn01", {name: "private_network_instance"}); * const base = new scaleway.instance.Server("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 "@pulumiverse/scaleway"; * * const image = new scaleway.instance.Server("image", { * type: "PRO2-XXS", * image: "ubuntu_jammy", * rootVolume: { * sizeInGb: 100, * }, * }); * ``` * * ### From snapshot * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumi/scaleway"; * import * as scaleway from "@pulumiverse/scaleway"; * * const snapshot = scaleway.block.getSnapshot({ * name: "my_snapshot", * }); * const fromSnapshot = new scaleway.block.Volume("from_snapshot", { * snapshotId: snapshot.then(snapshot => snapshot.id), * iops: 5000, * }); * const fromSnapshotServer = new scaleway.instance.Server("from_snapshot", { * type: "PRO2-XXS", * rootVolume: { * volumeId: fromSnapshot.id, * volumeType: "sbs_volume", * }, * }); * ``` * * ### Using Scaleway Block Storage (SBS) volume * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const server = new scaleway.instance.Server("server", { * type: "PLAY2-MICRO", * image: "ubuntu_jammy", * rootVolume: { * volumeType: "sbs_volume", * sbsIops: 15000, * sizeInGb: 50, * }, * }); * ``` * * ## 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. * **Important:** Instance supports a maximum of 8 different private networks. * * ## Import * * Instance servers can be imported using the `{zone}/{id}`, e.g. * * bash * * ```sh * $ pulumi import scaleway:instance/server:Server web fr-par-1/11111111-1111-1111-1111-111111111111 * ``` */ class Server extends pulumi.CustomResource { /** * Get an existing Server 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 Server(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Server. 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'] === Server.__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["privateIps"] = state ? state.privateIps : undefined; resourceInputs["privateNetworks"] = state ? state.privateNetworks : undefined; resourceInputs["projectId"] = state ? state.projectId : undefined; resourceInputs["protected"] = state ? state.protected : 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["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["privateIps"] = args ? args.privateIps : undefined; resourceInputs["privateNetworks"] = args ? args.privateNetworks : undefined; resourceInputs["projectId"] = args ? args.projectId : undefined; resourceInputs["protected"] = args ? args.protected : undefined; resourceInputs["publicIps"] = args ? args.publicIps : undefined; resourceInputs["replaceOnTypeChange"] = args ? args.replaceOnTypeChange : undefined; resourceInputs["rootVolume"] = args ? args.rootVolume : 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); const aliasOpts = { aliases: [{ type: "scaleway:index/instanceServer:InstanceServer" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(Server.__pulumiType, name, resourceInputs, opts); } } exports.Server = Server; /** @internal */ Server.__pulumiType = 'scaleway:instance/server:Server'; //# sourceMappingURL=server.js.map