oci_core_volume_group
This resource provides the Volume Group resource in Oracle Cloud Infrastructure Core service.
Creates a new volume group in the specified compartment. A volume group is a collection of volumes and may be created from a list of volumes, cloning an existing volume group, or by restoring a volume group backup. You may optionally specify a display name for the volume group, which is simply a friendly name or description. It does not have to be unique, and you can change it. Avoid entering confidential information.
For more information, see Volume Groups.
Note: If the volume group is created from another volume group or from a volume group backup, a copy of the volumes from the source is made in your compartment. However, this is not automatically deleted by Terraform when this volume group is deleted. To track these volumes, you can import them into the terraform statefile and run terraform destroy. Alternatively, you can also use another interface like CLI, SDK, or Console to remove them manually.
Example Usage
resource "oci_core_volume_group" "test_volume_group" {
#Required
availability_domain = var.volume_group_availability_domain
compartment_id = var.compartment_id
source_details {
#Required
type = "volumeIds"
volume_ids = [var.volume_group_source_id]
}
#Optional
backup_policy_id = data.oci_core_volume_backup_policies.test_volume_backup_policies.volume_backup_policies.0.id
cluster_placement_group_id = oci_identity_group.test_group.id
defined_tags = {"Operations.CostCenter"= "42"}
display_name = var.volume_group_display_name
freeform_tags = {"Department"= "Finance"}
volume_group_replicas {
#Required
availability_domain = var.volume_group_volume_group_replicas_availability_domain
#Optional
display_name = var.volume_group_volume_group_replicas_display_name
xrr_kms_key_id = oci_kms_key.test_key.id
}
volume_ids = [var.volume_group_source_id]
xrc_kms_key_id = oci_kms_key.test_key.id
}
Argument Reference
The following arguments are supported:
availability_domain
- (Required) The availability domain of the volume group.backup_policy_id
- (Optional) If provided, specifies the ID of the volume backup policy to assign to the newly created volume group. If omitted, no policy will be assigned. This field is deprecated. Use theoci_core_volume_backup_policy_assignments
instead to assign a backup policy to a volume group.cluster_placement_group_id
- (Optional) The clusterPlacementGroup Id of the volume group for volume group placement.compartment_id
- (Required) (Updatable) The OCID of the compartment that contains the volume group.defined_tags
- (Optional) (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example:{"Operations.CostCenter": "42"}
display_name
- (Optional) (Updatable) A user-friendly name. Does not have to be unique, and it’s changeable. Avoid entering confidential information.freeform_tags
- (Optional) (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example:{"Department": "Finance"}
source_details
- (Required) Specifies the source for a volume group.type
- (Required) The type can be one of these values:volumeGroupBackupId
,volumeGroupId
,volumeGroupReplicaId
,volumeIds
volume_group_backup_id
- (Required when type=volumeGroupBackupId) The OCID of the volume group backup to restore from.volume_group_id
- (Required when type=volumeGroupId) The OCID of the volume group to clone from.volume_group_replica_id
- (Required when type=volumeGroupReplicaId) The OCID of the volume group replica.volume_ids
- (Required when type=volumeIds) OCIDs for the volumes used to create this volume group.
volume_group_replicas
- (Optional) (Updatable) The list of volume group replicas that this volume group will be enabled to have in the specified destination availability domains.availability_domain
- (Required) (Updatable) The availability domain of the volume group replica. Example:Uocm:PHX-AD-1
display_name
- (Optional) (Updatable) A user-friendly name. Does not have to be unique, and it’s changeable. Avoid entering confidential information.xrr_kms_key_id
- (Optional) (Updatable) The OCID of the Vault service key which is the master encryption key for the cross region volume group’s replicas, which will be used in the destination region to encrypt the volume group’s replicas encryption keys. For more information about the Vault service and encryption keys, see Overview of Vault service and Using Keys.
xrc_kms_key_id
- (Optional) The OCID of the Vault service key which is the master encryption key for the volume’s cross region backups, which will be used in the destination region to encrypt the backup’s encryption keys. For more information about the Vault service and encryption keys, see Overview of Vault service and Using Keys.volume_ids
- (Optional) (Updatable) Use this for update operation only. This field is not supported during creation. For create usevolume_ids
undersource_details
.
** 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:
availability_domain
- The availability domain of the volume group.compartment_id
- The OCID of the compartment that contains the volume group.defined_tags
- Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example:{"Operations.CostCenter": "42"}
display_name
- A user-friendly name. Does not have to be unique, and it’s changeable. Avoid entering confidential information.freeform_tags
- Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example:{"Department": "Finance"}
id
- The OCID for the volume group.is_hydrated
- Specifies whether the newly created cloned volume group’s data has finished copying from the source volume group or backup.size_in_gbs
- The aggregate size of the volume group in GBs.size_in_mbs
- The aggregate size of the volume group in MBs.source_details
- Specifies the source for a volume group.type
- The type can be one of these values:volumeGroupBackupId
,volumeGroupId
,volumeGroupReplicaId
,volumeIds
volume_group_backup_id
- The OCID of the volume group backup to restore from.volume_group_id
- The OCID of the volume group to clone from.volume_group_replica_id
- The OCID of the volume group replica.volume_ids
- OCIDs for the volumes used to create this volume group. This field never changes after creation.
state
- The current state of a volume group.time_created
- The date and time the volume group was created. Format defined by RFC3339.volume_group_replicas
- The list of volume group replicas of this volume group.availability_domain
- The availability domain of the boot volume replica replica. Example:Uocm:PHX-AD-1
display_name
- A user-friendly name. Does not have to be unique, and it’s changeable. Avoid entering confidential information.kms_key_id
- The OCID of the Vault service key to assign as the master encryption key for the block volume replica, see Overview of Vault service and Using Keys.volume_group_replica_id
- The volume group replica’s Oracle ID (OCID).
volume_ids
- OCIDs for the current volumes in this volume group.
Timeouts
The timeouts
block allows you to specify timeouts for certain operations:
* create
- (Defaults to 20 minutes), when creating the Volume Group
* update
- (Defaults to 20 minutes), when updating the Volume Group
* delete
- (Defaults to 20 minutes), when destroying the Volume Group
Import
VolumeGroups can be imported using the id
, e.g.
$ terraform import oci_core_volume_group.test_volume_group "id"