1. Packages
  2. Scaleway
  3. API Docs
  4. BlockVolume
Scaleway v1.20.0 published on Monday, Nov 4, 2024 by pulumiverse

scaleway.BlockVolume

Explore with Pulumi AI

scaleway logo
Scaleway v1.20.0 published on Monday, Nov 4, 2024 by pulumiverse

    The scaleway.BlockVolume resource is used to create and manage Scaleway Block Storage volumes.

    Refer to the Block Storage product documentation and API documentation for more information.

    Example Usage

    Create a Block Storage volume

    The following command allows you to create a Block Storage volume of 20 GB with a 5000 IOPS.

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const blockVolume = new scaleway.BlockVolume("block_volume", {
        iops: 5000,
        name: "some-volume-name",
        sizeInGb: 20,
    });
    
    import pulumi
    import pulumiverse_scaleway as scaleway
    
    block_volume = scaleway.BlockVolume("block_volume",
        iops=5000,
        name="some-volume-name",
        size_in_gb=20)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := scaleway.NewBlockVolume(ctx, "block_volume", &scaleway.BlockVolumeArgs{
    			Iops:     pulumi.Int(5000),
    			Name:     pulumi.String("some-volume-name"),
    			SizeInGb: pulumi.Int(20),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var blockVolume = new Scaleway.BlockVolume("block_volume", new()
        {
            Iops = 5000,
            Name = "some-volume-name",
            SizeInGb = 20,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.BlockVolume;
    import com.pulumi.scaleway.BlockVolumeArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var blockVolume = new BlockVolume("blockVolume", BlockVolumeArgs.builder()
                .iops(5000)
                .name("some-volume-name")
                .sizeInGb(20)
                .build());
    
        }
    }
    
    resources:
      blockVolume:
        type: scaleway:BlockVolume
        name: block_volume
        properties:
          iops: 5000
          name: some-volume-name
          sizeInGb: 20
    

    With snapshot

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const base = new scaleway.BlockVolume("base", {
        name: "block-volume-base",
        iops: 5000,
        sizeInGb: 20,
    });
    const main = new scaleway.BlockSnapshot("main", {
        name: "block-volume-from-snapshot",
        volumeId: base.id,
    });
    const mainBlockVolume = new scaleway.BlockVolume("main", {
        name: "block-volume-from-snapshot",
        iops: 5000,
        snapshotId: main.id,
    });
    
    import pulumi
    import pulumiverse_scaleway as scaleway
    
    base = scaleway.BlockVolume("base",
        name="block-volume-base",
        iops=5000,
        size_in_gb=20)
    main = scaleway.BlockSnapshot("main",
        name="block-volume-from-snapshot",
        volume_id=base.id)
    main_block_volume = scaleway.BlockVolume("main",
        name="block-volume-from-snapshot",
        iops=5000,
        snapshot_id=main.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		base, err := scaleway.NewBlockVolume(ctx, "base", &scaleway.BlockVolumeArgs{
    			Name:     pulumi.String("block-volume-base"),
    			Iops:     pulumi.Int(5000),
    			SizeInGb: pulumi.Int(20),
    		})
    		if err != nil {
    			return err
    		}
    		main, err := scaleway.NewBlockSnapshot(ctx, "main", &scaleway.BlockSnapshotArgs{
    			Name:     pulumi.String("block-volume-from-snapshot"),
    			VolumeId: base.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = scaleway.NewBlockVolume(ctx, "main", &scaleway.BlockVolumeArgs{
    			Name:       pulumi.String("block-volume-from-snapshot"),
    			Iops:       pulumi.Int(5000),
    			SnapshotId: main.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var @base = new Scaleway.BlockVolume("base", new()
        {
            Name = "block-volume-base",
            Iops = 5000,
            SizeInGb = 20,
        });
    
        var main = new Scaleway.BlockSnapshot("main", new()
        {
            Name = "block-volume-from-snapshot",
            VolumeId = @base.Id,
        });
    
        var mainBlockVolume = new Scaleway.BlockVolume("main", new()
        {
            Name = "block-volume-from-snapshot",
            Iops = 5000,
            SnapshotId = main.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.BlockVolume;
    import com.pulumi.scaleway.BlockVolumeArgs;
    import com.pulumi.scaleway.BlockSnapshot;
    import com.pulumi.scaleway.BlockSnapshotArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var base = new BlockVolume("base", BlockVolumeArgs.builder()
                .name("block-volume-base")
                .iops(5000)
                .sizeInGb(20)
                .build());
    
            var main = new BlockSnapshot("main", BlockSnapshotArgs.builder()
                .name("block-volume-from-snapshot")
                .volumeId(base.id())
                .build());
    
            var mainBlockVolume = new BlockVolume("mainBlockVolume", BlockVolumeArgs.builder()
                .name("block-volume-from-snapshot")
                .iops(5000)
                .snapshotId(main.id())
                .build());
    
        }
    }
    
    resources:
      base:
        type: scaleway:BlockVolume
        properties:
          name: block-volume-base
          iops: 5000
          sizeInGb: 20
      main:
        type: scaleway:BlockSnapshot
        properties:
          name: block-volume-from-snapshot
          volumeId: ${base.id}
      mainBlockVolume:
        type: scaleway:BlockVolume
        name: main
        properties:
          name: block-volume-from-snapshot
          iops: 5000
          snapshotId: ${main.id}
    

    Create BlockVolume Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new BlockVolume(name: string, args: BlockVolumeArgs, opts?: CustomResourceOptions);
    @overload
    def BlockVolume(resource_name: str,
                    args: BlockVolumeArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def BlockVolume(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    iops: Optional[int] = None,
                    name: Optional[str] = None,
                    project_id: Optional[str] = None,
                    size_in_gb: Optional[int] = None,
                    snapshot_id: Optional[str] = None,
                    tags: Optional[Sequence[str]] = None,
                    zone: Optional[str] = None)
    func NewBlockVolume(ctx *Context, name string, args BlockVolumeArgs, opts ...ResourceOption) (*BlockVolume, error)
    public BlockVolume(string name, BlockVolumeArgs args, CustomResourceOptions? opts = null)
    public BlockVolume(String name, BlockVolumeArgs args)
    public BlockVolume(String name, BlockVolumeArgs args, CustomResourceOptions options)
    
    type: scaleway:BlockVolume
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args BlockVolumeArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args BlockVolumeArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args BlockVolumeArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BlockVolumeArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BlockVolumeArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var blockVolumeResource = new Scaleway.BlockVolume("blockVolumeResource", new()
    {
        Iops = 0,
        Name = "string",
        ProjectId = "string",
        SizeInGb = 0,
        SnapshotId = "string",
        Tags = new[]
        {
            "string",
        },
        Zone = "string",
    });
    
    example, err := scaleway.NewBlockVolume(ctx, "blockVolumeResource", &scaleway.BlockVolumeArgs{
    	Iops:       pulumi.Int(0),
    	Name:       pulumi.String("string"),
    	ProjectId:  pulumi.String("string"),
    	SizeInGb:   pulumi.Int(0),
    	SnapshotId: pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Zone: pulumi.String("string"),
    })
    
    var blockVolumeResource = new BlockVolume("blockVolumeResource", BlockVolumeArgs.builder()
        .iops(0)
        .name("string")
        .projectId("string")
        .sizeInGb(0)
        .snapshotId("string")
        .tags("string")
        .zone("string")
        .build());
    
    block_volume_resource = scaleway.BlockVolume("blockVolumeResource",
        iops=0,
        name="string",
        project_id="string",
        size_in_gb=0,
        snapshot_id="string",
        tags=["string"],
        zone="string")
    
    const blockVolumeResource = new scaleway.BlockVolume("blockVolumeResource", {
        iops: 0,
        name: "string",
        projectId: "string",
        sizeInGb: 0,
        snapshotId: "string",
        tags: ["string"],
        zone: "string",
    });
    
    type: scaleway:BlockVolume
    properties:
        iops: 0
        name: string
        projectId: string
        sizeInGb: 0
        snapshotId: string
        tags:
            - string
        zone: string
    

    BlockVolume Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The BlockVolume resource accepts the following input properties:

    Iops int
    The maximum IOPs expected, must match available options.
    Name string
    The name of the volume. If not provided, a name will be randomly generated.
    ProjectId string
    ). The ID of the Project the volume is associated with.
    SizeInGb int
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    SnapshotId string
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    Tags List<string>
    A list of tags to apply to the volume.
    Zone string
    ). The zone in which the volume should be created.
    Iops int
    The maximum IOPs expected, must match available options.
    Name string
    The name of the volume. If not provided, a name will be randomly generated.
    ProjectId string
    ). The ID of the Project the volume is associated with.
    SizeInGb int
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    SnapshotId string
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    Tags []string
    A list of tags to apply to the volume.
    Zone string
    ). The zone in which the volume should be created.
    iops Integer
    The maximum IOPs expected, must match available options.
    name String
    The name of the volume. If not provided, a name will be randomly generated.
    projectId String
    ). The ID of the Project the volume is associated with.
    sizeInGb Integer
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    snapshotId String
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    tags List<String>
    A list of tags to apply to the volume.
    zone String
    ). The zone in which the volume should be created.
    iops number
    The maximum IOPs expected, must match available options.
    name string
    The name of the volume. If not provided, a name will be randomly generated.
    projectId string
    ). The ID of the Project the volume is associated with.
    sizeInGb number
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    snapshotId string
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    tags string[]
    A list of tags to apply to the volume.
    zone string
    ). The zone in which the volume should be created.
    iops int
    The maximum IOPs expected, must match available options.
    name str
    The name of the volume. If not provided, a name will be randomly generated.
    project_id str
    ). The ID of the Project the volume is associated with.
    size_in_gb int
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    snapshot_id str
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    tags Sequence[str]
    A list of tags to apply to the volume.
    zone str
    ). The zone in which the volume should be created.
    iops Number
    The maximum IOPs expected, must match available options.
    name String
    The name of the volume. If not provided, a name will be randomly generated.
    projectId String
    ). The ID of the Project the volume is associated with.
    sizeInGb Number
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    snapshotId String
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    tags List<String>
    A list of tags to apply to the volume.
    zone String
    ). The zone in which the volume should be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BlockVolume resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing BlockVolume Resource

    Get an existing BlockVolume resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: BlockVolumeState, opts?: CustomResourceOptions): BlockVolume
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            iops: Optional[int] = None,
            name: Optional[str] = None,
            project_id: Optional[str] = None,
            size_in_gb: Optional[int] = None,
            snapshot_id: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            zone: Optional[str] = None) -> BlockVolume
    func GetBlockVolume(ctx *Context, name string, id IDInput, state *BlockVolumeState, opts ...ResourceOption) (*BlockVolume, error)
    public static BlockVolume Get(string name, Input<string> id, BlockVolumeState? state, CustomResourceOptions? opts = null)
    public static BlockVolume get(String name, Output<String> id, BlockVolumeState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Iops int
    The maximum IOPs expected, must match available options.
    Name string
    The name of the volume. If not provided, a name will be randomly generated.
    ProjectId string
    ). The ID of the Project the volume is associated with.
    SizeInGb int
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    SnapshotId string
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    Tags List<string>
    A list of tags to apply to the volume.
    Zone string
    ). The zone in which the volume should be created.
    Iops int
    The maximum IOPs expected, must match available options.
    Name string
    The name of the volume. If not provided, a name will be randomly generated.
    ProjectId string
    ). The ID of the Project the volume is associated with.
    SizeInGb int
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    SnapshotId string
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    Tags []string
    A list of tags to apply to the volume.
    Zone string
    ). The zone in which the volume should be created.
    iops Integer
    The maximum IOPs expected, must match available options.
    name String
    The name of the volume. If not provided, a name will be randomly generated.
    projectId String
    ). The ID of the Project the volume is associated with.
    sizeInGb Integer
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    snapshotId String
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    tags List<String>
    A list of tags to apply to the volume.
    zone String
    ). The zone in which the volume should be created.
    iops number
    The maximum IOPs expected, must match available options.
    name string
    The name of the volume. If not provided, a name will be randomly generated.
    projectId string
    ). The ID of the Project the volume is associated with.
    sizeInGb number
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    snapshotId string
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    tags string[]
    A list of tags to apply to the volume.
    zone string
    ). The zone in which the volume should be created.
    iops int
    The maximum IOPs expected, must match available options.
    name str
    The name of the volume. If not provided, a name will be randomly generated.
    project_id str
    ). The ID of the Project the volume is associated with.
    size_in_gb int
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    snapshot_id str
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    tags Sequence[str]
    A list of tags to apply to the volume.
    zone str
    ). The zone in which the volume should be created.
    iops Number
    The maximum IOPs expected, must match available options.
    name String
    The name of the volume. If not provided, a name will be randomly generated.
    projectId String
    ). The ID of the Project the volume is associated with.
    sizeInGb Number
    The size of the volume in gigabytes. Only one of size_in_gb, and snapshot_id should be specified.
    snapshotId String
    If set, the new volume will be created from this snapshot. Only one of size_in_gb, snapshot_id should be specified.
    tags List<String>
    A list of tags to apply to the volume.
    zone String
    ). The zone in which the volume should be created.

    Import

    This section explains how to import a Block Storage volume using the zoned ID ({zone}/{id}) format.

    bash

    $ pulumi import scaleway:index/blockVolume:BlockVolume block_volume fr-par-1/11111111-1111-1111-1111-111111111111
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.20.0 published on Monday, Nov 4, 2024 by pulumiverse