oci_core_volume

This resource provides the Volume resource in Oracle Cloud Infrastructure Core service.

Creates a new volume in the specified compartment. Volumes can be created in sizes ranging from 50 GB (51200 MB) to 32 TB (33554432 MB), in 1 GB (1024 MB) increments. By default, volumes are 1 TB (1048576 MB). For general information about block volumes, see Overview of Block Volume Service.

A volume and instance can be in separate compartments but must be in the same availability domain. For information about access control and compartments, see Overview of the IAM Service. For information about availability domains, see Regions and Availability Domains. To get a list of availability domains, use the ListAvailabilityDomains operation in the Identity and Access Management Service API.

You may optionally specify a display name for the volume, which is simply a friendly name or description. It does not have to be unique, and you can change it. Avoid entering confidential information.

Example Usage

resource "oci_core_volume" "test_volume" {
	#Required
	compartment_id = var.compartment_id

	#Optional
	autotune_policies {
		#Required
		autotune_type = var.volume_autotune_policies_autotune_type

		#Optional
		max_vpus_per_gb = var.volume_autotune_policies_max_vpus_per_gb
	}
	availability_domain = var.volume_availability_domain
	backup_policy_id = data.oci_core_volume_backup_policies.test_volume_backup_policies.volume_backup_policies.0.id
	block_volume_replicas {
		#Required
		availability_domain = var.volume_block_volume_replicas_availability_domain

		#Optional
		display_name = var.volume_block_volume_replicas_display_name
	}
	cluster_placement_group_id = oci_identity_group.test_group.id
	defined_tags = {"Operations.CostCenter"= "42"}
	display_name = var.volume_display_name
	freeform_tags = {"Department"= "Finance"}
	is_auto_tune_enabled = var.volume_is_auto_tune_enabled
	kms_key_id = oci_kms_key.test_key.id
	size_in_gbs = var.volume_size_in_gbs
	size_in_mbs = var.volume_size_in_mbs
	source_details {
		#Required
		id = var.volume_source_details_id
		type = var.volume_source_details_type
	}
	vpus_per_gb = var.volume_vpus_per_gb
    block_volume_replicas_deletion = true
}

Argument Reference

The following arguments are supported:

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain operations: * create - (Defaults to 20 minutes), when creating the Volume * update - (Defaults to 20 minutes), when updating the Volume * delete - (Defaults to 20 minutes), when destroying the Volume

Import

Volumes can be imported using the id, e.g.

$ terraform import oci_core_volume.test_volume "id"