UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

686 lines 28.9 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * 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 filesystem * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const volume = new scaleway.block.Volume("volume", { * iops: 15000, * sizeInGb: 15, * }); * const terraformInstanceFilesystem = new scaleway.FileFilesystem("terraform_instance_filesystem", { * name: "filesystem-instance-terraform", * sizeInGb: 100, * }); * const base = new scaleway.instance.Server("base", { * type: "POP2-HM-2C-16G", * state: "started", * tags: [ * "terraform-test", * "scaleway_instance_server", * "state", * ], * rootVolume: { * volumeType: "sbs_volume", * volumeId: volume.id, * }, * filesystems: [{ * filesystemId: terraformInstanceFilesystem.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 "@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. * * ```sh * $ pulumi import scaleway:index/instanceServer:InstanceServer web fr-par-1/11111111-1111-1111-1111-111111111111 * ``` * * @deprecated scaleway.index/instanceserver.InstanceServer has been deprecated in favor of scaleway.instance/server.Server */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: InstanceServerState, opts?: pulumi.CustomResourceOptions): InstanceServer; /** * 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: any): obj is InstanceServer; /** * The [additional volumes](https://www.scaleway.com/en/developers/api/instance/#path-volume-types-list-volume-types) * attached to the server. Updates to this field will trigger a stop/start of the server. * * > **Important:** If this field contains local volumes, the `state` must be set to `stopped`, otherwise it will fail. * * > **Important:** If this field contains local volumes, you have to first detach them, in one apply, and then delete the volume in another apply. */ readonly additionalVolumeIds: pulumi.Output<string[] | undefined>; /** * The ID of the SSH RSA key that will be used to encrypt the initial admin password for OS requiring it. * Mandatory for Windows OS. The publicKey value of this key is used to encrypt the admin password. * When set to an empty string, it resets this value and adminPasswordEncryptedValue to an empty string so a new password may be generated. */ readonly adminPasswordEncryptionSshKeyId: pulumi.Output<string | undefined>; /** * The boot Type of the server. Possible values are: `local`, `bootscript` or `rescue`. */ readonly bootType: pulumi.Output<string | undefined>; /** * ID of the target bootscript (set bootType to bootscript) * * @deprecated bootscript is not supported anymore. */ readonly bootscriptId: pulumi.Output<string>; /** * The cloud init script associated with this server */ readonly cloudInit: pulumi.Output<string>; /** * If true a dynamic IP will be attached to the server. */ readonly enableDynamicIp: pulumi.Output<boolean | undefined>; /** * List of filesystems attached to the server. */ readonly filesystems: pulumi.Output<outputs.InstanceServerFilesystem[]>; /** * The UUID or the label of the base image used by the server. You can use [this endpoint](https://www.scaleway.com/en/developers/api/marketplace/#path-marketplace-images-list-marketplace-images) * to find either the right `label` or the right local image `ID` for a given `type`. Optional when creating an instance with an existing root volume. * * You can check the available labels with our [CLI](https://www.scaleway.com/en/docs/compute/instances/api-cli/creating-managing-instances-with-cliv2/). ```scw marketplace image list``` * * To retrieve more information by label please use: ```scw marketplace image get label=<LABEL>``` * * To obtain a local-image UUID from a label, please use: ```scw marketplace local-image list image-label=<LABEL>``` */ readonly image: pulumi.Output<string | undefined>; /** * The ID of the reserved IP that is attached to the server. */ readonly ipId: pulumi.Output<string | undefined>; /** * List of ID of reserved IPs that are attached to the server. Cannot be used with `ipId`. * * > `ipId` to `ipIds` migration: if moving the ip from the old `ipId` field to the new `ipIds`, it should not detach the ip. */ readonly ipIds: pulumi.Output<string[] | undefined>; /** * The name of the server. */ readonly name: pulumi.Output<string>; /** * The organization ID the server is associated with. */ readonly organizationId: pulumi.Output<string>; /** * The [placement group](<https://www.scaleway.com/en/developers/api/instance/#path-security-groups-update-a-security-group> the server is attached to. * * > **Important:** When updating `placementGroupId` the `state` must be set to `stopped`, otherwise it will fail. */ readonly placementGroupId: pulumi.Output<string | undefined>; /** * (Deprecated) Always false, use instancePlacementGroup resource to known when the placement group policy is respected. */ readonly placementGroupPolicyRespected: pulumi.Output<boolean>; /** * The list of private IPv4 and IPv6 addresses associated with the resource. */ readonly privateIps: pulumi.Output<outputs.InstanceServerPrivateIp[]>; /** * The private network associated with the server. * Use the `pnId` key to attach a [privateNetwork](https://www.scaleway.com/en/developers/api/instance/#path-private-nics-list-all-private-nics) on your instance. */ readonly privateNetworks: pulumi.Output<outputs.InstanceServerPrivateNetwork[] | undefined>; /** * `projectId`) The ID of the project the server is associated with. */ readonly projectId: pulumi.Output<string>; /** * Set to true to activate server protection option. */ readonly protected: pulumi.Output<boolean | undefined>; /** * The list of public IPs of the server. */ readonly publicIps: pulumi.Output<outputs.InstanceServerPublicIp[]>; /** * If true, the server will be replaced if `type` is changed. Otherwise, the server will migrate. */ readonly replaceOnTypeChange: pulumi.Output<boolean | undefined>; /** * Root [volume](https://www.scaleway.com/en/developers/api/instance/#path-volume-types-list-volume-types) attached to the server on creation. */ readonly rootVolume: pulumi.Output<outputs.InstanceServerRootVolume>; /** * The [security group](https://www.scaleway.com/en/developers/api/instance/#path-security-groups-update-a-security-group9) the server is attached to. * * > **Important:** If you don't specify a security group, a default one will be created, which won't be tracked by Terraform unless you import it. */ readonly securityGroupId: pulumi.Output<string>; /** * The state of the server. Possible values are: `started`, `stopped` or `standby`. */ readonly state: pulumi.Output<string>; /** * The tags associated with the server. */ readonly tags: pulumi.Output<string[] | undefined>; /** * The commercial type of the server. * You find all the available types on the [pricing page](https://www.scaleway.com/en/pricing/). * Updates to this field will migrate the server, local storage constraint must be respected. [More info](https://www.scaleway.com/en/docs/compute/instances/api-cli/migrating-instances/). * Use `replaceOnTypeChange` to trigger replacement instead of migration. * * > **Important:** If `type` change and migration occurs, the server will be stopped and changed backed to its original state. It will be started again if it was running. */ readonly type: pulumi.Output<string>; /** * The user data associated with the server. * Use the `cloud-init` key to use [cloud-init](https://cloudinit.readthedocs.io/en/latest/) on your instance. * You can define values using: * - string * - UTF-8 encoded file content using file * - Binary files using filebase64. */ readonly userData: pulumi.Output<{ [key: string]: string; }>; /** * `zone`) The zone in which the server should be created. */ readonly zone: pulumi.Output<string | undefined>; /** * Create a InstanceServer resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ /** @deprecated scaleway.index/instanceserver.InstanceServer has been deprecated in favor of scaleway.instance/server.Server */ constructor(name: string, args: InstanceServerArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering InstanceServer resources. */ export interface InstanceServerState { /** * The [additional volumes](https://www.scaleway.com/en/developers/api/instance/#path-volume-types-list-volume-types) * attached to the server. Updates to this field will trigger a stop/start of the server. * * > **Important:** If this field contains local volumes, the `state` must be set to `stopped`, otherwise it will fail. * * > **Important:** If this field contains local volumes, you have to first detach them, in one apply, and then delete the volume in another apply. */ additionalVolumeIds?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The ID of the SSH RSA key that will be used to encrypt the initial admin password for OS requiring it. * Mandatory for Windows OS. The publicKey value of this key is used to encrypt the admin password. * When set to an empty string, it resets this value and adminPasswordEncryptedValue to an empty string so a new password may be generated. */ adminPasswordEncryptionSshKeyId?: pulumi.Input<string | undefined>; /** * The boot Type of the server. Possible values are: `local`, `bootscript` or `rescue`. */ bootType?: pulumi.Input<string | undefined>; /** * ID of the target bootscript (set bootType to bootscript) * * @deprecated bootscript is not supported anymore. */ bootscriptId?: pulumi.Input<string | undefined>; /** * The cloud init script associated with this server */ cloudInit?: pulumi.Input<string | undefined>; /** * If true a dynamic IP will be attached to the server. */ enableDynamicIp?: pulumi.Input<boolean | undefined>; /** * List of filesystems attached to the server. */ filesystems?: pulumi.Input<pulumi.Input<inputs.InstanceServerFilesystem>[] | undefined>; /** * The UUID or the label of the base image used by the server. You can use [this endpoint](https://www.scaleway.com/en/developers/api/marketplace/#path-marketplace-images-list-marketplace-images) * to find either the right `label` or the right local image `ID` for a given `type`. Optional when creating an instance with an existing root volume. * * You can check the available labels with our [CLI](https://www.scaleway.com/en/docs/compute/instances/api-cli/creating-managing-instances-with-cliv2/). ```scw marketplace image list``` * * To retrieve more information by label please use: ```scw marketplace image get label=<LABEL>``` * * To obtain a local-image UUID from a label, please use: ```scw marketplace local-image list image-label=<LABEL>``` */ image?: pulumi.Input<string | undefined>; /** * The ID of the reserved IP that is attached to the server. */ ipId?: pulumi.Input<string | undefined>; /** * List of ID of reserved IPs that are attached to the server. Cannot be used with `ipId`. * * > `ipId` to `ipIds` migration: if moving the ip from the old `ipId` field to the new `ipIds`, it should not detach the ip. */ ipIds?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The name of the server. */ name?: pulumi.Input<string | undefined>; /** * The organization ID the server is associated with. */ organizationId?: pulumi.Input<string | undefined>; /** * The [placement group](<https://www.scaleway.com/en/developers/api/instance/#path-security-groups-update-a-security-group> the server is attached to. * * > **Important:** When updating `placementGroupId` the `state` must be set to `stopped`, otherwise it will fail. */ placementGroupId?: pulumi.Input<string | undefined>; /** * (Deprecated) Always false, use instancePlacementGroup resource to known when the placement group policy is respected. */ placementGroupPolicyRespected?: pulumi.Input<boolean | undefined>; /** * The list of private IPv4 and IPv6 addresses associated with the resource. */ privateIps?: pulumi.Input<pulumi.Input<inputs.InstanceServerPrivateIp>[] | undefined>; /** * The private network associated with the server. * Use the `pnId` key to attach a [privateNetwork](https://www.scaleway.com/en/developers/api/instance/#path-private-nics-list-all-private-nics) on your instance. */ privateNetworks?: pulumi.Input<pulumi.Input<inputs.InstanceServerPrivateNetwork>[] | undefined>; /** * `projectId`) The ID of the project the server is associated with. */ projectId?: pulumi.Input<string | undefined>; /** * Set to true to activate server protection option. */ protected?: pulumi.Input<boolean | undefined>; /** * The list of public IPs of the server. */ publicIps?: pulumi.Input<pulumi.Input<inputs.InstanceServerPublicIp>[] | undefined>; /** * If true, the server will be replaced if `type` is changed. Otherwise, the server will migrate. */ replaceOnTypeChange?: pulumi.Input<boolean | undefined>; /** * Root [volume](https://www.scaleway.com/en/developers/api/instance/#path-volume-types-list-volume-types) attached to the server on creation. */ rootVolume?: pulumi.Input<inputs.InstanceServerRootVolume | undefined>; /** * The [security group](https://www.scaleway.com/en/developers/api/instance/#path-security-groups-update-a-security-group9) the server is attached to. * * > **Important:** If you don't specify a security group, a default one will be created, which won't be tracked by Terraform unless you import it. */ securityGroupId?: pulumi.Input<string | undefined>; /** * The state of the server. Possible values are: `started`, `stopped` or `standby`. */ state?: pulumi.Input<string | undefined>; /** * The tags associated with the server. */ tags?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The commercial type of the server. * You find all the available types on the [pricing page](https://www.scaleway.com/en/pricing/). * Updates to this field will migrate the server, local storage constraint must be respected. [More info](https://www.scaleway.com/en/docs/compute/instances/api-cli/migrating-instances/). * Use `replaceOnTypeChange` to trigger replacement instead of migration. * * > **Important:** If `type` change and migration occurs, the server will be stopped and changed backed to its original state. It will be started again if it was running. */ type?: pulumi.Input<string | undefined>; /** * The user data associated with the server. * Use the `cloud-init` key to use [cloud-init](https://cloudinit.readthedocs.io/en/latest/) on your instance. * You can define values using: * - string * - UTF-8 encoded file content using file * - Binary files using filebase64. */ userData?: pulumi.Input<{ [key: string]: pulumi.Input<string>; } | undefined>; /** * `zone`) The zone in which the server should be created. */ zone?: pulumi.Input<string | undefined>; } /** * The set of arguments for constructing a InstanceServer resource. */ export interface InstanceServerArgs { /** * The [additional volumes](https://www.scaleway.com/en/developers/api/instance/#path-volume-types-list-volume-types) * attached to the server. Updates to this field will trigger a stop/start of the server. * * > **Important:** If this field contains local volumes, the `state` must be set to `stopped`, otherwise it will fail. * * > **Important:** If this field contains local volumes, you have to first detach them, in one apply, and then delete the volume in another apply. */ additionalVolumeIds?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The ID of the SSH RSA key that will be used to encrypt the initial admin password for OS requiring it. * Mandatory for Windows OS. The publicKey value of this key is used to encrypt the admin password. * When set to an empty string, it resets this value and adminPasswordEncryptedValue to an empty string so a new password may be generated. */ adminPasswordEncryptionSshKeyId?: pulumi.Input<string | undefined>; /** * The boot Type of the server. Possible values are: `local`, `bootscript` or `rescue`. */ bootType?: pulumi.Input<string | undefined>; /** * ID of the target bootscript (set bootType to bootscript) * * @deprecated bootscript is not supported anymore. */ bootscriptId?: pulumi.Input<string | undefined>; /** * The cloud init script associated with this server */ cloudInit?: pulumi.Input<string | undefined>; /** * If true a dynamic IP will be attached to the server. */ enableDynamicIp?: pulumi.Input<boolean | undefined>; /** * List of filesystems attached to the server. */ filesystems?: pulumi.Input<pulumi.Input<inputs.InstanceServerFilesystem>[] | undefined>; /** * The UUID or the label of the base image used by the server. You can use [this endpoint](https://www.scaleway.com/en/developers/api/marketplace/#path-marketplace-images-list-marketplace-images) * to find either the right `label` or the right local image `ID` for a given `type`. Optional when creating an instance with an existing root volume. * * You can check the available labels with our [CLI](https://www.scaleway.com/en/docs/compute/instances/api-cli/creating-managing-instances-with-cliv2/). ```scw marketplace image list``` * * To retrieve more information by label please use: ```scw marketplace image get label=<LABEL>``` * * To obtain a local-image UUID from a label, please use: ```scw marketplace local-image list image-label=<LABEL>``` */ image?: pulumi.Input<string | undefined>; /** * The ID of the reserved IP that is attached to the server. */ ipId?: pulumi.Input<string | undefined>; /** * List of ID of reserved IPs that are attached to the server. Cannot be used with `ipId`. * * > `ipId` to `ipIds` migration: if moving the ip from the old `ipId` field to the new `ipIds`, it should not detach the ip. */ ipIds?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The name of the server. */ name?: pulumi.Input<string | undefined>; /** * The [placement group](<https://www.scaleway.com/en/developers/api/instance/#path-security-groups-update-a-security-group> the server is attached to. * * > **Important:** When updating `placementGroupId` the `state` must be set to `stopped`, otherwise it will fail. */ placementGroupId?: pulumi.Input<string | undefined>; /** * The list of private IPv4 and IPv6 addresses associated with the resource. */ privateIps?: pulumi.Input<pulumi.Input<inputs.InstanceServerPrivateIp>[] | undefined>; /** * The private network associated with the server. * Use the `pnId` key to attach a [privateNetwork](https://www.scaleway.com/en/developers/api/instance/#path-private-nics-list-all-private-nics) on your instance. */ privateNetworks?: pulumi.Input<pulumi.Input<inputs.InstanceServerPrivateNetwork>[] | undefined>; /** * `projectId`) The ID of the project the server is associated with. */ projectId?: pulumi.Input<string | undefined>; /** * Set to true to activate server protection option. */ protected?: pulumi.Input<boolean | undefined>; /** * The list of public IPs of the server. */ publicIps?: pulumi.Input<pulumi.Input<inputs.InstanceServerPublicIp>[] | undefined>; /** * If true, the server will be replaced if `type` is changed. Otherwise, the server will migrate. */ replaceOnTypeChange?: pulumi.Input<boolean | undefined>; /** * Root [volume](https://www.scaleway.com/en/developers/api/instance/#path-volume-types-list-volume-types) attached to the server on creation. */ rootVolume?: pulumi.Input<inputs.InstanceServerRootVolume | undefined>; /** * The [security group](https://www.scaleway.com/en/developers/api/instance/#path-security-groups-update-a-security-group9) the server is attached to. * * > **Important:** If you don't specify a security group, a default one will be created, which won't be tracked by Terraform unless you import it. */ securityGroupId?: pulumi.Input<string | undefined>; /** * The state of the server. Possible values are: `started`, `stopped` or `standby`. */ state?: pulumi.Input<string | undefined>; /** * The tags associated with the server. */ tags?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The commercial type of the server. * You find all the available types on the [pricing page](https://www.scaleway.com/en/pricing/). * Updates to this field will migrate the server, local storage constraint must be respected. [More info](https://www.scaleway.com/en/docs/compute/instances/api-cli/migrating-instances/). * Use `replaceOnTypeChange` to trigger replacement instead of migration. * * > **Important:** If `type` change and migration occurs, the server will be stopped and changed backed to its original state. It will be started again if it was running. */ type: pulumi.Input<string>; /** * The user data associated with the server. * Use the `cloud-init` key to use [cloud-init](https://cloudinit.readthedocs.io/en/latest/) on your instance. * You can define values using: * - string * - UTF-8 encoded file content using file * - Binary files using filebase64. */ userData?: pulumi.Input<{ [key: string]: pulumi.Input<string>; } | undefined>; /** * `zone`) The zone in which the server should be created. */ zone?: pulumi.Input<string | undefined>; } //# sourceMappingURL=instanceServer.d.ts.map