1. Packages
  2. Civo Provider
  3. API Docs
  4. Volume
Civo v2.4.6 published on Wednesday, Nov 6, 2024 by Pulumi

civo.Volume

Explore with Pulumi AI

civo logo
Civo v2.4.6 published on Wednesday, Nov 6, 2024 by Pulumi

    Provides a Civo volume which can be attached to an instance in order to provide expanded storage.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as civo from "@pulumi/civo";
    
    // Get network
    const defaultNetwork = civo.getNetwork({
        label: "Default",
    });
    // Create volume
    const db = new civo.Volume("db", {
        name: "backup-data",
        sizeGb: 5,
        networkId: defaultNetwork.then(defaultNetwork => defaultNetwork.id),
    }, {
        dependsOn: [defaultNetwork],
    });
    
    import pulumi
    import pulumi_civo as civo
    
    # Get network
    default_network = civo.get_network(label="Default")
    # Create volume
    db = civo.Volume("db",
        name="backup-data",
        size_gb=5,
        network_id=default_network.id,
        opts = pulumi.ResourceOptions(depends_on=[default_network]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-civo/sdk/v2/go/civo"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Get network
    		defaultNetwork, err := civo.LookupNetwork(ctx, &civo.LookupNetworkArgs{
    			Label: pulumi.StringRef("Default"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Create volume
    		_, err = civo.NewVolume(ctx, "db", &civo.VolumeArgs{
    			Name:      pulumi.String("backup-data"),
    			SizeGb:    pulumi.Int(5),
    			NetworkId: pulumi.String(defaultNetwork.Id),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			defaultNetwork,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Civo = Pulumi.Civo;
    
    return await Deployment.RunAsync(() => 
    {
        // Get network
        var defaultNetwork = Civo.GetNetwork.Invoke(new()
        {
            Label = "Default",
        });
    
        // Create volume
        var db = new Civo.Volume("db", new()
        {
            Name = "backup-data",
            SizeGb = 5,
            NetworkId = defaultNetwork.Apply(getNetworkResult => getNetworkResult.Id),
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                defaultNetwork,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.civo.CivoFunctions;
    import com.pulumi.civo.inputs.GetNetworkArgs;
    import com.pulumi.civo.Volume;
    import com.pulumi.civo.VolumeArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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) {
            // Get network
            final var defaultNetwork = CivoFunctions.getNetwork(GetNetworkArgs.builder()
                .label("Default")
                .build());
    
            // Create volume
            var db = new Volume("db", VolumeArgs.builder()
                .name("backup-data")
                .sizeGb(5)
                .networkId(defaultNetwork.applyValue(getNetworkResult -> getNetworkResult.id()))
                .build(), CustomResourceOptions.builder()
                    .dependsOn(defaultNetwork.applyValue(getNetworkResult -> getNetworkResult))
                    .build());
    
        }
    }
    
    resources:
      # Create volume
      db:
        type: civo:Volume
        properties:
          name: backup-data
          sizeGb: 5
          networkId: ${defaultNetwork.id}
        options:
          dependson:
            - ${defaultNetwork}
    variables:
      # Get network
      defaultNetwork:
        fn::invoke:
          Function: civo:getNetwork
          Arguments:
            label: Default
    

    Create Volume Resource

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

    Constructor syntax

    new Volume(name: string, args: VolumeArgs, opts?: CustomResourceOptions);
    @overload
    def Volume(resource_name: str,
               args: VolumeArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Volume(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               network_id: Optional[str] = None,
               size_gb: Optional[int] = None,
               name: Optional[str] = None,
               region: Optional[str] = None,
               volume_type: Optional[str] = None)
    func NewVolume(ctx *Context, name string, args VolumeArgs, opts ...ResourceOption) (*Volume, error)
    public Volume(string name, VolumeArgs args, CustomResourceOptions? opts = null)
    public Volume(String name, VolumeArgs args)
    public Volume(String name, VolumeArgs args, CustomResourceOptions options)
    
    type: civo:Volume
    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 VolumeArgs
    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 VolumeArgs
    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 VolumeArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VolumeArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VolumeArgs
    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 volumeResource = new Civo.Volume("volumeResource", new()
    {
        NetworkId = "string",
        SizeGb = 0,
        Name = "string",
        Region = "string",
        VolumeType = "string",
    });
    
    example, err := civo.NewVolume(ctx, "volumeResource", &civo.VolumeArgs{
    	NetworkId:  pulumi.String("string"),
    	SizeGb:     pulumi.Int(0),
    	Name:       pulumi.String("string"),
    	Region:     pulumi.String("string"),
    	VolumeType: pulumi.String("string"),
    })
    
    var volumeResource = new Volume("volumeResource", VolumeArgs.builder()
        .networkId("string")
        .sizeGb(0)
        .name("string")
        .region("string")
        .volumeType("string")
        .build());
    
    volume_resource = civo.Volume("volumeResource",
        network_id="string",
        size_gb=0,
        name="string",
        region="string",
        volume_type="string")
    
    const volumeResource = new civo.Volume("volumeResource", {
        networkId: "string",
        sizeGb: 0,
        name: "string",
        region: "string",
        volumeType: "string",
    });
    
    type: civo:Volume
    properties:
        name: string
        networkId: string
        region: string
        sizeGb: 0
        volumeType: string
    

    Volume 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 Volume resource accepts the following input properties:

    NetworkId string
    The network that the volume belongs to
    SizeGb int
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    Name string
    A name that you wish to use to refer to this volume
    Region string
    The region for the volume, if not declare we use the region in declared in the provider.
    VolumeType string
    The type of the volume
    NetworkId string
    The network that the volume belongs to
    SizeGb int
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    Name string
    A name that you wish to use to refer to this volume
    Region string
    The region for the volume, if not declare we use the region in declared in the provider.
    VolumeType string
    The type of the volume
    networkId String
    The network that the volume belongs to
    sizeGb Integer
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    name String
    A name that you wish to use to refer to this volume
    region String
    The region for the volume, if not declare we use the region in declared in the provider.
    volumeType String
    The type of the volume
    networkId string
    The network that the volume belongs to
    sizeGb number
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    name string
    A name that you wish to use to refer to this volume
    region string
    The region for the volume, if not declare we use the region in declared in the provider.
    volumeType string
    The type of the volume
    network_id str
    The network that the volume belongs to
    size_gb int
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    name str
    A name that you wish to use to refer to this volume
    region str
    The region for the volume, if not declare we use the region in declared in the provider.
    volume_type str
    The type of the volume
    networkId String
    The network that the volume belongs to
    sizeGb Number
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    name String
    A name that you wish to use to refer to this volume
    region String
    The region for the volume, if not declare we use the region in declared in the provider.
    volumeType String
    The type of the volume

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    MountPoint string
    The mount point of the volume (from instance's perspective)
    Id string
    The provider-assigned unique ID for this managed resource.
    MountPoint string
    The mount point of the volume (from instance's perspective)
    id String
    The provider-assigned unique ID for this managed resource.
    mountPoint String
    The mount point of the volume (from instance's perspective)
    id string
    The provider-assigned unique ID for this managed resource.
    mountPoint string
    The mount point of the volume (from instance's perspective)
    id str
    The provider-assigned unique ID for this managed resource.
    mount_point str
    The mount point of the volume (from instance's perspective)
    id String
    The provider-assigned unique ID for this managed resource.
    mountPoint String
    The mount point of the volume (from instance's perspective)

    Look up Existing Volume Resource

    Get an existing Volume 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?: VolumeState, opts?: CustomResourceOptions): Volume
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            mount_point: Optional[str] = None,
            name: Optional[str] = None,
            network_id: Optional[str] = None,
            region: Optional[str] = None,
            size_gb: Optional[int] = None,
            volume_type: Optional[str] = None) -> Volume
    func GetVolume(ctx *Context, name string, id IDInput, state *VolumeState, opts ...ResourceOption) (*Volume, error)
    public static Volume Get(string name, Input<string> id, VolumeState? state, CustomResourceOptions? opts = null)
    public static Volume get(String name, Output<String> id, VolumeState 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:
    MountPoint string
    The mount point of the volume (from instance's perspective)
    Name string
    A name that you wish to use to refer to this volume
    NetworkId string
    The network that the volume belongs to
    Region string
    The region for the volume, if not declare we use the region in declared in the provider.
    SizeGb int
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    VolumeType string
    The type of the volume
    MountPoint string
    The mount point of the volume (from instance's perspective)
    Name string
    A name that you wish to use to refer to this volume
    NetworkId string
    The network that the volume belongs to
    Region string
    The region for the volume, if not declare we use the region in declared in the provider.
    SizeGb int
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    VolumeType string
    The type of the volume
    mountPoint String
    The mount point of the volume (from instance's perspective)
    name String
    A name that you wish to use to refer to this volume
    networkId String
    The network that the volume belongs to
    region String
    The region for the volume, if not declare we use the region in declared in the provider.
    sizeGb Integer
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    volumeType String
    The type of the volume
    mountPoint string
    The mount point of the volume (from instance's perspective)
    name string
    A name that you wish to use to refer to this volume
    networkId string
    The network that the volume belongs to
    region string
    The region for the volume, if not declare we use the region in declared in the provider.
    sizeGb number
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    volumeType string
    The type of the volume
    mount_point str
    The mount point of the volume (from instance's perspective)
    name str
    A name that you wish to use to refer to this volume
    network_id str
    The network that the volume belongs to
    region str
    The region for the volume, if not declare we use the region in declared in the provider.
    size_gb int
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    volume_type str
    The type of the volume
    mountPoint String
    The mount point of the volume (from instance's perspective)
    name String
    A name that you wish to use to refer to this volume
    networkId String
    The network that the volume belongs to
    region String
    The region for the volume, if not declare we use the region in declared in the provider.
    sizeGb Number
    A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
    volumeType String
    The type of the volume

    Import

    using ID

    $ pulumi import civo:index/volume:Volume db 506f78a4-e098-11e5-ad9f-000f53306ae1
    

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

    Package Details

    Repository
    Civo pulumi/pulumi-civo
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the civo Terraform Provider.
    civo logo
    Civo v2.4.6 published on Wednesday, Nov 6, 2024 by Pulumi