Skip to content

Commit 7fdf7e4

Browse files
Terraform Team AutomationNagendraNigade
authored andcommitted
Deprecated - Deprecate backup_policy_id field for oci_core_volume_group
1 parent 6f5ea44 commit 7fdf7e4

File tree

6 files changed

+61
-22
lines changed

6 files changed

+61
-22
lines changed

examples/storage/block/volume/volume_backup_policy.tf

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
variable "tenancy_ocid" {
44
}
55

6-
variable "user_ocid" {
6+
variable "auth" {
77
}
88

9-
variable "fingerprint" {
10-
}
11-
12-
variable "private_key_path" {
9+
variable "config_file_profile" {
1310
}
1411

1512
variable "region" {
@@ -22,11 +19,9 @@ variable "destination_region" {
2219
}
2320

2421
provider "oci" {
25-
tenancy_ocid = var.tenancy_ocid
26-
user_ocid = var.user_ocid
27-
fingerprint = var.fingerprint
28-
private_key_path = var.private_key_path
29-
region = var.region
22+
auth = var.auth
23+
config_file_profile = var.config_file_profile
24+
region = var.region
3025
}
3126

3227
data "oci_identity_availability_domain" "ad" {
@@ -132,3 +127,46 @@ output "test_backup_policy_assignments_custom" {
132127
value = data.oci_core_volume_backup_policy_assignments.test_backup_policy_assignments_custom.volume_backup_policy_assignments
133128
}
134129

130+
// Example 3: Assign a policy to a volume group
131+
132+
resource "oci_core_volume" "test_volume" {
133+
count = 2
134+
availability_domain = data.oci_identity_availability_domain.ad.name
135+
compartment_id = var.compartment_ocid
136+
display_name = format("-tf-volume-%d", count.index + 1)
137+
size_in_gbs = "50"
138+
}
139+
140+
resource "oci_core_volume_group" "test_volume_group" {
141+
#Required
142+
availability_domain = data.oci_identity_availability_domain.ad.name
143+
compartment_id = var.compartment_ocid
144+
145+
source_details {
146+
#Required
147+
type = "volumeIds"
148+
149+
volume_ids = oci_core_volume.test_volume.*.id
150+
}
151+
152+
#Optional
153+
display_name = "test-volume-group-with-backup-policy"
154+
}
155+
156+
resource "oci_core_volume_backup_policy_assignment" "test_volume_group_backup_policy_assignment" {
157+
asset_id = oci_core_volume_group.test_volume_group.id
158+
policy_id = oci_core_volume_backup_policy.test_volume_backup_policy_custom.id
159+
}
160+
161+
data "oci_core_volume_backup_policy_assignments" "test_volume_group_backup_policy_assignments" {
162+
asset_id = oci_core_volume_group.test_volume_group.id
163+
164+
filter {
165+
name = "id"
166+
values = [oci_core_volume_backup_policy_assignment.test_volume_group_backup_policy_assignment.id]
167+
}
168+
}
169+
170+
output "volume_group_backup_policy_assignments" {
171+
value = data.oci_core_volume_backup_policy_assignments.test_volume_group_backup_policy_assignments
172+
}

internal/service/core/core_volume_group_resource.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ func CoreVolumeGroupResource() *schema.Resource {
105105
Optional: true,
106106
},
107107
"backup_policy_id": {
108-
Type: schema.TypeString,
109-
Optional: true,
110-
Computed: true,
111-
ForceNew: true,
108+
Type: schema.TypeString,
109+
Optional: true,
110+
Computed: true,
111+
ForceNew: true,
112+
Deprecated: tfresource.FieldDeprecatedButSupportedThroughAnotherResource("backup_policy_id", "oci_core_volume_backup_policy_assignment"),
112113
},
113114
"defined_tags": {
114115
Type: schema.TypeMap,

website/docs/r/core_boot_volume.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ The following arguments are supported:
6464
* `autotune_type` - (Required) (Updatable) This specifies the type of autotunes supported by OCI.
6565
* `max_vpus_per_gb` - (Required when autotune_type=PERFORMANCE_BASED) (Updatable) This will be the maximum VPUs/GB performance level that the volume will be auto-tuned temporarily based on performance monitoring.
6666
* `availability_domain` - (Optional) The availability domain of the volume. Omissible for cloning a volume. The new volume will be created in the availability domain of the source volume. Example: `Uocm:PHX-AD-1`
67-
* `backup_policy_id` - (Optional) If provided, specifies the ID of the boot volume backup policy to assign to the newly created boot volume. If omitted, no policy will be assigned.
67+
* `backup_policy_id` - (Optional) If provided, specifies the ID of the boot volume backup policy to assign to the newly created boot volume. If omitted, no policy will be assigned. This field is deprecated. Use the `oci_core_volume_backup_policy_assignments` instead to assign a backup policy to a boot volume.
6868
* `boot_volume_replicas` - (Optional) (Updatable) The list of boot volume replicas to be enabled for this boot volume in the specified destination availability domains.
6969
* `availability_domain` - (Required) (Updatable) The availability domain of the boot volume replica. Example: `Uocm:PHX-AD-1`
7070
* `display_name` - (Optional) (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

website/docs/r/core_volume.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ The following arguments are supported:
7575
* `autotune_type` - (Required) (Updatable) This specifies the type of autotunes supported by OCI.
7676
* `max_vpus_per_gb` - (Required when autotune_type=PERFORMANCE_BASED) (Updatable) This will be the maximum VPUs/GB performance level that the volume will be auto-tuned temporarily based on performance monitoring.
7777
* `availability_domain` - (Optional) The availability domain of the volume. Omissible for cloning a volume. The new volume will be created in the availability domain of the source volume. Example: `Uocm:PHX-AD-1`
78-
* `backup_policy_id` - (Optional) If provided, specifies the ID of the volume backup policy to assign to the newly created volume. If omitted, no policy will be assigned.
78+
* `backup_policy_id` - (Optional) If provided, specifies the ID of the volume backup policy to assign to the newly created volume. If omitted, no policy will be assigned. This field is deprecated. Use the `oci_core_volume_backup_policy_assignments` instead to assign a backup policy to a volume.
7979
* `block_volume_replicas` - (Optional) (Updatable) The list of block volume replicas to be enabled for this volume in the specified destination availability domains.
8080
* `availability_domain` - (Required) (Updatable) The availability domain of the block volume replica. Example: `Uocm:PHX-AD-1`
8181
* `display_name` - (Optional) (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

website/docs/r/core_volume_backup_policy_assignment.html.markdown

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ description: |-
1010
# oci_core_volume_backup_policy_assignment
1111
This resource provides the Volume Backup Policy Assignment resource in Oracle Cloud Infrastructure Core service.
1212

13-
Assigns a volume backup policy to the specified volume. Note that a given volume can
14-
only have one backup policy assigned to it. If this operation is used for a volume that already
13+
Assigns a volume backup policy to the specified volume or volume group. Note that a given volume or volume group can
14+
only have one backup policy assigned to it. If this operation is used for a volume or volume group that already
1515
has a different backup policy assigned, the prior backup policy will be silently unassigned.
1616

1717

@@ -29,7 +29,7 @@ resource "oci_core_volume_backup_policy_assignment" "test_volume_backup_policy_a
2929

3030
The following arguments are supported:
3131

32-
* `asset_id` - (Required) The OCID of the volume to assign the policy to.
32+
* `asset_id` - (Required) The OCID of the volume or volume group to assign the policy to.
3333
* `policy_id` - (Required) The OCID of the volume backup policy to assign to the volume.
3434

3535

@@ -40,9 +40,9 @@ Any change to a property that does not support update will force the destruction
4040

4141
The following attributes are exported:
4242

43-
* `asset_id` - The OCID of the volume the policy has been assigned to.
43+
* `asset_id` - The OCID of the volume or volume group the policy has been assigned to.
4444
* `id` - The OCID of the volume backup policy assignment.
45-
* `policy_id` - The OCID of the volume backup policy that has been assigned to the volume.
45+
* `policy_id` - The OCID of the volume backup policy that has been assigned to the volume or volume group. For a volume group, only the **user defined** policy is allowed to use. For more information, see [Policy-Based Backups](https://docs.oracle.com/en-us/iaas/Content/Block/Tasks/schedulingvolumebackups.htm).
4646
* `time_created` - The date and time the volume backup policy was assigned to the volume. The format is defined by [RFC3339](https://tools.ietf.org/html/rfc3339).
4747

4848
## Timeouts

website/docs/r/core_volume_group.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ resource "oci_core_volume_group" "test_volume_group" {
5353
The following arguments are supported:
5454

5555
* `availability_domain` - (Required) The availability domain of the volume group.
56-
* `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.
56+
* `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 the `oci_core_volume_backup_policy_assignments` instead to assign a backup policy to a volume group.
5757
* `compartment_id` - (Required) (Updatable) The OCID of the compartment that contains the volume group.
5858
* `defined_tags` - (Optional) (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
5959
* `display_name` - (Optional) (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

0 commit comments

Comments
 (0)