1. Packages
  2. Civo Provider
  3. API Docs
  4. Volume
civo 1.1.5 published on Thursday, Feb 6, 2025 by civo

civo.Volume

Explore with Pulumi AI

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";

const defaultNetwork = civo.getNetwork({
    label: "Default",
});
// Create volume
const db = new civo.Volume("db", {
    sizeGb: 5,
    networkId: defaultNetwork.then(defaultNetwork => defaultNetwork.id),
}, {
    dependsOn: [defaultNetwork],
});
Copy
import pulumi
import pulumi_civo as civo

default_network = civo.get_network(label="Default")
# Create volume
db = civo.Volume("db",
    size_gb=5,
    network_id=default_network.id,
    opts = pulumi.ResourceOptions(depends_on=[default_network]))
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/civo/civo"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		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{
			SizeGb:    pulumi.Float64(5),
			NetworkId: pulumi.String(defaultNetwork.Id),
		}, pulumi.DependsOn([]pulumi.Resource{
			defaultNetwork,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Civo = Pulumi.Civo;

return await Deployment.RunAsync(() => 
{
    var defaultNetwork = Civo.GetNetwork.Invoke(new()
    {
        Label = "Default",
    });

    // Create volume
    var db = new Civo.Volume("db", new()
    {
        SizeGb = 5,
        NetworkId = defaultNetwork.Apply(getNetworkResult => getNetworkResult.Id),
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            defaultNetwork,
        },
    });

});
Copy
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) {
        final var defaultNetwork = CivoFunctions.getNetwork(GetNetworkArgs.builder()
            .label("Default")
            .build());

        // Create volume
        var db = new Volume("db", VolumeArgs.builder()
            .sizeGb(5)
            .networkId(defaultNetwork.applyValue(getNetworkResult -> getNetworkResult.id()))
            .build(), CustomResourceOptions.builder()
                .dependsOn(defaultNetwork.applyValue(getNetworkResult -> getNetworkResult))
                .build());

    }
}
Copy
resources:
  # Create volume
  db:
    type: civo:Volume
    properties:
      sizeGb: 5
      networkId: ${defaultNetwork.id}
    options:
      dependsOn:
        - ${defaultNetwork}
variables:
  defaultNetwork:
    fn::invoke:
      function: civo:getNetwork
      arguments:
        label: Default
Copy

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[float] = None,
           name: Optional[str] = None,
           region: Optional[str] = None,
           volume_id: 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 This property is required. string
The unique name of the resource.
args This property is required. VolumeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. VolumeArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. VolumeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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",
    VolumeId = "string",
    VolumeType = "string",
});
Copy
example, err := civo.NewVolume(ctx, "volumeResource", &civo.VolumeArgs{
NetworkId: pulumi.String("string"),
SizeGb: pulumi.Float64(0),
Name: pulumi.String("string"),
Region: pulumi.String("string"),
VolumeId: pulumi.String("string"),
VolumeType: pulumi.String("string"),
})
Copy
var volumeResource = new Volume("volumeResource", VolumeArgs.builder()
    .networkId("string")
    .sizeGb(0)
    .name("string")
    .region("string")
    .volumeId("string")
    .volumeType("string")
    .build());
Copy
volume_resource = civo.Volume("volumeResource",
    network_id="string",
    size_gb=0,
    name="string",
    region="string",
    volume_id="string",
    volume_type="string")
Copy
const volumeResource = new civo.Volume("volumeResource", {
    networkId: "string",
    sizeGb: 0,
    name: "string",
    region: "string",
    volumeId: "string",
    volumeType: "string",
});
Copy
type: civo:Volume
properties:
    name: string
    networkId: string
    region: string
    sizeGb: 0
    volumeId: string
    volumeType: string
Copy

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 This property is required. string
The network that the volume belongs to
SizeGb This property is required. double
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.
VolumeId string
The ID of this resource.
VolumeType string
The type of the volume
NetworkId This property is required. string
The network that the volume belongs to
SizeGb This property is required. float64
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.
VolumeId string
The ID of this resource.
VolumeType string
The type of the volume
networkId This property is required. String
The network that the volume belongs to
sizeGb This property is required. Double
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.
volumeId String
The ID of this resource.
volumeType String
The type of the volume
networkId This property is required. string
The network that the volume belongs to
sizeGb This property is required. 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.
volumeId string
The ID of this resource.
volumeType string
The type of the volume
network_id This property is required. str
The network that the volume belongs to
size_gb This property is required. float
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_id str
The ID of this resource.
volume_type str
The type of the volume
networkId This property is required. String
The network that the volume belongs to
sizeGb This property is required. 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.
volumeId String
The ID of this resource.
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[float] = None,
        volume_id: Optional[str] = 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)
resources:  _:    type: civo:Volume    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 double
A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
VolumeId string
The ID of this resource.
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 float64
A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
VolumeId string
The ID of this resource.
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 Double
A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
volumeId String
The ID of this resource.
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
volumeId string
The ID of this resource.
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 float
A minimum of 1 and a maximum of your available disk space from your quota specifies the size of the volume in gigabytes
volume_id str
The ID of this resource.
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
volumeId String
The ID of this resource.
volumeType String
The type of the volume

Import

using ID

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

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

Package Details

Repository
Civo civo/terraform-provider-civo
License
Notes
This Pulumi package is based on the civo Terraform Provider.